Hdf5TreeModel class

class silx.gui.hdf5.Hdf5TreeModel(parent=None)[source]

Bases: PyQt4.QtCore.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 = 32

Role to reach h5py item from an item index

H5PY_OBJECT_ROLE = 33

Role to reach h5py object from an item index

USER_ROLE = 34

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

Column id containing HDF5 link type

COLUMN_IDS = [0, 1, 2, 3, 4, 5, 6]

List of logical columns available

fileDropEnabled

Property to enable/disable file dropping in the model.

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
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)[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.
insertFile(filename, row=-1)[source]

Load a HDF5 file into the data model.

Parameters:filename – file path.
indexFromH5Object(h5Object)[source]

Returns a model index from an h5py-like object.

Parameters:h5Object (object) – An h5py-like object
Return type:qt.QModelIndex