From: Philou <Kal...@wa...> - 2005-06-03 16:17:11
|
Hi list, I want to display all the node of an hdf5 in a treeview but reflecting exactly the hdf5 structure of the file. For example i try to display this structure in a treeview: / (Group) -> columns (Group) -> name (Array) -> pressure (Array) -> test (Group) -> detector (Group) -> readout (Table) Here you probably recognize the structure of the tutorial hdf5 file except that i add an empty group test in columns group. ;) My problem is i didn't succeed to display the real structure of the hdf5 file in a treeview. When i use a for loop listing nodes, it's not exactly the structure of the hdf5 file: for node in h5file: components_list.append({'name':node._v_name, 'type':node._v_attrs.CLASS}) the result is: / columns detector name pressure readin test readout The problem is the group detector is displayed after the group columns and before the childs of the group columns. So when i display it in a treeview, detector is part of columns group. I use for the moment this loop: for group in h5file.walkGroups("/"): if group._v_name == "/": iter0 = self.__model.append(None, [group._v_name,"group"]) else: iter1 = self.__model.append(iter0, [group._v_name,"group"]) for array in h5file.listNodes(group, classname = 'Array'): if iter1 == None: iter2 = self.__model.append(iter0, [array.hdf5name,"array"]) else: iter2 = self.__model.append(iter1, [array.hdf5name,"array"]) for Table in h5file.listNodes(group, "Table"):#"Table"): if iter1 == None: iter3 = self.__model.append(iter0, [Table.hdf5name,"Table"]) else: iter3 = self.__model.append(iter1, [Table.hdf5name,"Table"]) and add a different but not better result: / (Group) -> columns (Group) -> name (Array) -> pressure (Array) -> detector (Group) -> readout (Table) -> test (Group) How can i display the real structure of an hdf5 in a treeview? Thanks in advance, I'm sad to go into week end without solving this problem :/. Have a good week end, Philippe Collet |