The widgets.selection sub-package#

Package with widgets which allow the selection of a specific element.

class pydidas.widgets.selection.ConfigureBinaryDecodingWidget(**kwargs: Any)#

Bases: WidgetWithParameterCollection, AssociatedFileMixin

A widget to configure the decoding of raw binary files.

The widget allows to set the datatype, shape, and header offset of the binary file which is required to decode the file correctly.

Parameters:

**kwargs (Any) –

Any additional keyword arguments. In addition to all QAttributes supported by QWidget, see below for supported arguments:

paramsParameterCollection, optional

A ParameterCollection with Parameters to share with this widget. If not given, new Parameters will be created.

property decoding_is_valid: bool#

Get the check whether the current decoding file/parameter combination is valid.

set_new_filename(filename: str | Path) None#

Process a new filename.

If the new filename has a suffix associated with raw binary files, show the widget.

Parameters:

filename (Path or str) – The full file system path to the new file.

class pydidas.widgets.selection.DirectoryExplorer(**kwargs: Any)#

Bases: WidgetWithParameterCollection

The DirectoryExplorer is an implementation of a QTreeView widget with a file system model to display the contents of directories.

Parameters:

**kwargs (Any) –

Supported keywords are any keywords that are supported by QTreeView as well as:

parentUnion[QWidget, None], optional

The parent widget, if applicable. The default is None.

current_pathstr, optional

The default path in the file system. The default is ‘’.

sizeHint() QSize#

Overload the generic sizeHint.

Returns:

The updated size hint.

Return type:

QtCore.QSize

class pydidas.widgets.selection.Hdf5DatasetSelector(dataset_key_filters=None, **kwargs: Any)#

Bases: WidgetWithParameterCollection

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:
  • 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.

clear() None#

Clear all entries for the widget.

property dataset: str#

Get the currently selected dataset.

display_dataset() None#

Select a dataset from the drop-down list.

This internal method is called by the Qt event system if the QComBoBox text has changed to notify the main program that the user has selected a different dataset to be visualized. This method also updates the accepted frame range for the sliders.

new_filename(filename: str) None#

Process the new filename.

If the new filename has a suffix associated with hdf5 files, show the widget.

Parameters:

filename (str) – The full file system path to the new file.

class pydidas.widgets.selection.SelectDataFrameWidget(**kwargs: Any)#

Bases: WidgetWithParameterCollection, AssociatedFileMixin

A widget which allows to select a data frame from a file.

Parameters:

**kwargs (Any) –

Supported keyword arguments are;

parentQWidget | None, optional

The parent widget. The default is None.

import_referencestr | None, optional

The reference for the file dialogue to store persistent settings. If None, no persistent settings are stored. The default is None.

ndimint, optional

The number of dimensions of the data to be imported. The default is 2.

filenameParameter | None, optional

A Parameter to use for the filename selection. If None, a default Parameter will be created. The default is None.

font_metric_width_factorint | None, optional

An optional factor to modify the width of text elements in the widget based on the font metrics. If None, the default width for the used Parameter widgets is applied. The default is None.

connect_signals()#

Connect the widget signals to the relevant slots.

process_new_filename()#

Process the input of a new filename in the Parameter widget.