Skip to main content
`Ctrl`+`K`

# `GroupDialog`

This module provides a dialog widget to select a HDF5 group in a tree.

class GroupDialog(parent=None)

  This `QDialog` uses a `silx.gui.hdf5.Hdf5TreeView` to provide a HDF5 group selection dialog.

  The information identifying the selected node is provided as a `silx.io.url.DataUrl`.

  Example:

      dialog = GroupDialog()
      dialog.addFile(filepath1)
      dialog.addFile(filepath2)

      if dialog.exec():
          print("File path: %s" % dialog.getSelectedDataUrl().file_path())
          print("HDF5 group path : %s " % dialog.getSelectedDataUrl().data_path())
      else:
          print("Operation cancelled :(")

  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.

  setMode(mode)

    Set dialog mode DatasetDialog.SaveMode or DatasetDialog.LoadMode

    Parameters:

      mode – DatasetDialog.SaveMode or DatasetDialog.LoadMode