def populate_tree(self): """ | Init the ui-tree and store data into calling the h5_tree_to_Qtree convertor method See Also -------- h5tree_to_QTree, update_status """ try: if self.h5file is not None: self.ui.h5file_tree.ui.Tree.clear() base_node = self.h5file.root base_tree_item, pixmap_items = utils.h5tree_to_QTree(self.h5file, base_node) self.ui.h5file_tree.ui.Tree.addTopLevelItem(base_tree_item) self.add_widget_totree(pixmap_items) except Exception as e: self.update_status(str(e), wait_time=self.wait_time)
filename='Cest pas sorcier') ]), dict(name='fiston1', contents=[ dict(name='subfiston', contents='baby', filename='Cest pas malin') ]), dict(name='fiston2', contents=[ dict(name='subfiston', contents='baby', filename='Cest pas normal') ]) ]), dict(name='maman', contents=[ dict(name='fistone', contents=[dict(name='subfistone', contents='baby')]) ]) ] prog.populate_Tree(data) filename = 'C:\\Data\\2019\\20190220\\Dataset_20190220_004\\Dataset_20190220_004.h5' import tables h5_file = tables.open_file(filename, mode="a") for node in h5_file.walk_nodes(): print(node) base_node = h5_file.root base_tree_item, pixmap_items = h5tree_to_QTree(h5_file, base_node) prog.ui.Tree.addTopLevelItem(base_tree_item) sys.exit(app.exec_())