DatasetDialog
¶
This module provides a dialog widget to select a HDF5 dataset in a tree.
- class DatasetDialog(parent=None)[source]¶
This
QDialog
uses asilx.gui.hdf5.Hdf5TreeView
to provide a HDF5 dataset selection dialog.The information identifying the selected node is provided as a
silx.io.url.DataUrl
.Example:
dialog = DatasetDialog() dialog.addFile(filepath1) dialog.addFile(filepath2) if dialog.exec(): print("File path: %s" % dialog.getSelectedDataUrl().file_path()) print("HDF5 dataset path : %s " % dialog.getSelectedDataUrl().data_path()) else: print("Operation cancelled :(")
- setMode(mode)[source]¶
Set dialog mode DatasetDialog.SaveMode or DatasetDialog.LoadMode
- Parameters
mode – DatasetDialog.SaveMode or DatasetDialog.LoadMode
- addFile(path)¶
Add a HDF5 file to the tree. All groups it contains will be selectable in the dialog.
- Parameters
path (str) – File path
- addGroup(group)¶
Add a HDF5 group to the tree. This group and all its subgroups will be selectable in the dialog.
- Parameters
group (h5py.Group) – HDF5 group
- getSelectedDataUrl()¶
Return a
DataUrl
with a file path and a data path. Return None if the dialog was cancelled.- Returns
silx.io.url.DataUrl
object pointing to the selected HDF5 item.