Hdf5TreeModel
class#
- class Hdf5TreeModel(parent=None, ownFiles=True)[source]#
Bases:
QAbstractItemModel
Tree model storing a list of
h5py.File
like objects.The main column display the
h5py.File
list and there hierarchy. Other columns display information on node hierarchy.- H5PY_ITEM_ROLE = 256#
Role to reach h5py item from an item index
- H5PY_OBJECT_ROLE = 257#
Role to reach h5py object from an item index
- USER_ROLE = 258#
Start of range of available user role for derivative models
- NAME_COLUMN = 0#
Column id containing HDF5 node names
- TYPE_COLUMN = 1#
Column id containing HDF5 dataset types
- SHAPE_COLUMN = 2#
Column id containing HDF5 dataset shapes
- VALUE_COLUMN = 3#
Column id containing HDF5 dataset values
- DESCRIPTION_COLUMN = 4#
Column id containing HDF5 node description/title/message
- NODE_COLUMN = 5#
Column id containing HDF5 node type
- LINK_COLUMN = 6#
Column id containing HDF5 link type
- COLUMN_IDS = [0, 1, 2, 3, 4, 5, 6]#
List of logical columns available
- sigH5pyObjectLoaded#
Emitted when a new root item was loaded and inserted to the model.
- sigH5pyObjectRemoved#
Emitted when a root item is removed from the model.
- sigH5pyObjectSynchronized#
Emitted when an item was synchronized.
- fileDropEnabled#
Property to enable/disable file dropping in the model.
- datasetDragEnabled#
Property to enable/disable drag of datasets.
- fileMoveEnabled#
Property to enable/disable drag-and-drop of files to change the ordering in the model.
- mimeData(indexes)[source]#
Returns an object that contains serialized items of data corresponding to the list of indexes specified.
- Parameters:
indexes (List[qt.QModelIndex]) – List of indexes
- Return type:
qt.QMimeData
- dropMimeData(self, data: QMimeData | None, action: Qt.DropAction, row: int, column: int, parent: QModelIndex) bool [source]#
- headerData(self, section: int, orientation: Qt.Orientation, role: int = Qt.ItemDataRole.DisplayRole) Any [source]#
- moveRow(self, sourceParent: QModelIndex, sourceRow: int, destinationParent: QModelIndex, destinationChild: int) bool [source]#
- moveRows(self, sourceParent: QModelIndex, sourceRow: int, count: int, destinationParent: QModelIndex, destinationChild: int) bool [source]#
- synchronizeIndex(index)[source]#
Synchronize a file a given its index.
Basically close it and load it again.
- Parameters:
index (qt.QModelIndex) – Index of the item to update
- synchronizeH5pyObject(h5pyObject)[source]#
Synchronize a h5py object in all the tree.
Basically close it and load it again.
- Parameters:
h5pyObject (h5py.File) – A
h5py.File
object.
- removeIndex(index)[source]#
Remove an item from the model using its index.
- Parameters:
index (qt.QModelIndex) – Index of the item to remove
- removeH5pyObject(h5pyObject)[source]#
Remove an item from the model using the holding h5py object. It can remove more than one item.
- Parameters:
h5pyObject (h5py.File) – A
h5py.File
object.
- insertH5pyObject(h5pyObject, text=None, row=-1, filename=None)[source]#
Append an HDF5 object from h5py to the tree.
- Parameters:
h5pyObject – File handle/descriptor for a
h5py.File
or any other class of h5py file structure.text (
Optional
[str
])row (
int
)filename (
Optional
[str
])