qudi.util.parameters

This file contains utility methods to annotate arguments for which the user can potentially edit values via GUI. These arguments are boiled down to simple builtin types that can be represented by a GUI editor.

:param : An integer type represented by a scientific spinbox widget. :type : int: ScienSpinBox :param : A floating-point type represented by a double precision scientific spinbox widget. :type : float: ScienDSpinbox :param : A string type represented by a QLineEdit widget. :type : str: QLineEdit :param : A complex number type represented by a custom ComplexLineEdit widget. :type : complex: ComplexLineEdit :param : A set type represented by a custom SetLineEdit widget. :type : set: SetLineEdit :param : A dictionary type represented by a custom DictLineEdit widget. :type : dict: DictLineEdit :param : A list type represented by a custom ListLineEdit widget. :type : list: ListLineEdit :param : A tuple type represented by a custom TupleLineEdit widget. :type : tuple: TupleLineEdit :param : A type for file paths represented by a QLineEdit widget. :type : FilePath: QLineEdit

Notes

Here defined are also custom generic types that can be used like any other type from the typing module. Arguments annotated with these types are represented with the corresponding widgets. Any other type annotation that cannot be mapped to a simple builtin or a custom generic type (see above) will result in no corresponding widget (None).

Classes

ParameterWidgetMapper()

class qudi.util.parameters.ParameterWidgetMapper[source]

Bases: builtins.object

classmethod widget_for_parameter(param: Parameter) Type[QWidget] | None[source]

Tries to determine a suitable QWidget to represent the given parameter. If no type annotation is given for a parameter it will try to determine the type from the default value. If no (known) type can be determined, None will be returned.

classmethod widget_from_annotation(annotation: Any) Type[QWidget] | None[source]

Tries to determine a suitable QWidget to represent values of the given annotation type.

classmethod widget_from_value(value: Any) Type[QWidget] | None[source]

Tries to determine a suitable QWidget to represent the type of the given value.

classmethod widgets_for_callable(func: Callable) Dict[str, Type[QWidget] | None][source]

Returns QWidget classes for each parameter from the call signature of “func”. See ParameterWidgetMapper.widget_for_parameter for more information.