The widgets.selection sub-package#
Package with widgets which allow the selection of a specific element.
- class pydidas.widgets.selection.DirectoryExplorer(**kwargs: dict)#
Bases:
EmptyWidget
,CreateWidgetsMixIn
,PydidasQsettingsMixin
The DirectoryExplorer is an implementation of a QTreeView widget with a file system model to display the contents of directories.
- Parameters:
parent (Union[QWidget, None], optional) – The parent widget, if appplicable. The default is None.
current_path (str, optional) – The default path in the file system. The default is ‘’.
**kwargs (dict) – Any additional keyword arguments
- sizeHint() QSize #
Overload the generic sizeHint.
- Returns:
The updated size hint.
- Return type:
QtCore.QSize
- class pydidas.widgets.selection.Hdf5DatasetSelector(plot_widget=None, dataset_key_filters=None, **kwargs)#
Bases:
QWidget
,CreateWidgetsMixIn
A compound widget to select datasets in Hdf5 files.
The Hdf5DatasetSelector is a compound widget which allows to select a hdf5 dataset key and the frame number. By convention, the first dimension of an n-dimensional (n >= 3) dataset is the frame number. Any 2-dimensional datasets will be interpreted as single frames.
- Parameters:
plot_widget (Union[QWidget, None], optional) – A widget for a full view. It can also be registered later using the register_plot_widget method. The default is None.
dataset_key_filters (Union[dict, None], optional) – A dictionary with dataset keys to be filtered from the list of displayed datasets. Entries must be in the format {<Key to filter>: <Descriptive text for checkbox>}. The default is None.
**kwargs (dict) – Any additional keyword arguments. See below for supported arguments.
**QtAttribute (depends on the attribute) – Any Qt attributes which are supported by the generic QWidget. Use the Qt attribute name with a lowercase first character. Examples are
fixedWidth
,fixedHeight
.
- click_view_button()#
Process clicking the view button.
This method is connected to the clicked event of the View button.
- enable_signal_slot(enable: bool)#
Toggle the signal slot to emit the selected frame as signal for other widgets.
- Parameters:
enable (bool) – Flag to enable the signal slot. If True, a signal is emitted every time a new frame is selected. If False, the signal slot is not used.
- new_filename(name: str)#
Process the new filename.
If the new filename has a suffix associated with hdf5 files, show the widget.
- Parameters:
name (str) – The full file system path to the new file.
- register_plot_widget(widget: QWidget)#
Register a view widget to be used for full visualization of data.
This method registers an external view widget for data visualization. Note that the widget must accept frames through a
addImage
method.- Parameters:
self (object) – The class to call this method.
widget (QWidget) – A widget with an
addImage
ordisplay_image
method to pass frames to.
- Raises:
TypeError – If the widget is not a QWidget.
AttributeError – if the widget does not have a
addImage
ordisplay_image
method.
- class pydidas.widgets.selection.RawMetadataSelector(**kwargs: dict)#
Bases:
WidgetWithParameterCollection
A compound widget to select metadata in raw image files.
- Parameters:
**kwargs (dict) –
Any additional keyword arguments. In addition to all QAttributes supported by QWidget, see below for supported arguments:
- plot_widgetUnion[QWidget, None], optional
A widget for plotting the data. It can also be registered later using the register_plot_widget method. The default is None.
- new_filename(name: str)#
Process the new filename.
If the new filename has a suffix associated with raw files, show the widget.
- Parameters:
name (str) – The full file system path to the new file.
- register_plot_widget(widget: QWidget)#
Register a view widget to be used for full visualization of data.
This method registers an external view widget for data visualization. Note that the widget must accept frames through a
addImage
method.- Parameters:
self (object) – The class to call this method.
widget (QWidget) – A widget with an
addImage
ordisplay_image
method to pass frames to.
- Raises:
TypeError – If the widget is not a QWidget.
AttributeError – if the widget does not have a
addImage
ordisplay_image
method.
- class pydidas.widgets.selection.ResultSelectionWidget(select_results_param: None | Parameter = None, **kwargs: dict)#
Bases:
EmptyWidget
,CreateWidgetsMixIn
,ParameterWidgetsMixIn
,ParameterCollectionMixIn
A Widget to select data slices from WorkflowResults for plotting.
The widget allows to select a
WorkflowNode
, using meta information from theScanContext <pydidas.core.ScanContext<
andWorkflowResults
singletons. It displays information for all dimensions in the results (label, unit, range) and allows selecting data dimension(s) (based on the dimensionality of the plot) and slice indices for other dimensions. In addition, an option to hande the Scan as a “timeline” is given. In a timeline, all Scan points will be flattened to a 1d-dataset.Notes
The ResultSelectionWidget offers the following signal which can be used:
.sig_new_selection : QtCore.Signal( use_timeline : int, active_dims : list, active_node : int, selection : tuple, plot_type : str )
The signal signature is: flag to use timeline or scan shape, active scan dimensions, node ID of the active node, the selection in form of a tuple with entries for every dimension (in form of a numpy array), the type of plot in form of a string.
- Parameters:
parent (QtWidgets.QWidget) – The parent widget.
select_results_param (pydidas.core.Parameter) – The select_results Parameter instance. This instance should be shared between the ResultSelectionWidget and the parent.
- get_and_store_result_node_labels()#
Get and store the labels of the current nodes in the WorkflowResults.
This method will also update the choice of selections based on these items.
- reset()#
Reset the instance to its default selection.
This method should be called for example when a new processing has been started and the old information is no longer valid.
- show_info_popup(data_x: float, data_y: float)#
Open a pop-up to show more information for the selected datapoint.
- Parameters:
data_x (float) – The data x value.
data_y (float) – the data y value.