Hdf5TreeView class

class silx.gui.hdf5.Hdf5TreeView(parent=None)

Bases: PyQt4.QtGui.QTreeView

TreeView which allow to browse HDF5 file structure.

It provides columns width auto-resizing and additional signals.

The default model is a NexusSortFilterProxyModel sourcing a Hdf5TreeModel. The Hdf5TreeModel is reachable using findHdf5TreeModel(). The default header is Hdf5HeaderView.

Context menu is managed by the setContextMenuPolicy() with the value Qt.CustomContextMenu. This policy must not be changed, otherwise context menus will not work anymore. You can use addContextMenuCallback() and removeContextMenuCallback() to add your custum actions according to the selected objects.

addContextMenuCallback(callback)

Register a context menu callback.

The callback will be called when a context menu is requested with the treeview and the list of selected h5py objects in parameters. The callback must return a list of qt.QAction object.

Callbacks are stored as saferef. The object must store a reference by itself.

removeContextMenuCallback(callback)

Unregister a context menu callback

findHdf5TreeModel()

Find the Hdf5TreeModel from the stack of model filters.

Returns:A Hdf5TreeModel, else None
Return type:Hdf5TreeModel
selectedH5Nodes(ignoreBrokenLinks=True)

Returns selected h5py objects like h5py.File, h5py.Group, h5py.Dataset or mimicked objects.

Parameters:bool (ignoreBrokenLinks) – Returns objects which are not not broken links.
Return type:iterator(_utils.H5Node)
mousePressEvent(event)

Override mousePressEvent to provide a consistante compatible API between Qt4 and Qt5

Previous topic

hdf5widget.py

Next topic

Hdf5TreeModel class

This Page