def _selectDataset(filename, mode=DatasetDialog.SaveMode): """Open a dialog to prompt the user to select a dataset in a hdf5 file. :param str filename: name of an existing HDF5 file :param mode: DatasetDialog.SaveMode or DatasetDialog.LoadMode :rtype: str :return: Name of selected dataset """ dialog = DatasetDialog() dialog.addFile(filename) dialog.setWindowTitle("Select a 2D dataset") dialog.setMode(mode) if not dialog.exec_(): return None return dialog.getSelectedDataUrl().data_path()