qudi.util.mapper
This file contains the Qudi mapper module.
Classes
Class for converting data between display and storage (i.e. widget and model). |
|
|
The Mapper connects a Qt widget for displaying and editing certain data types with a model property or setter and getter functions. |
- class qudi.util.mapper.Converter[source]
Bases:
builtins.objectClass for converting data between display and storage (i.e. widget and model).
- class qudi.util.mapper.Mapper(**kwargs)[source]
Bases:
builtins.objectThe Mapper connects a Qt widget for displaying and editing certain data types with a model property or setter and getter functions. The model can be e.g. a logic or a hardware module.
- add_mapping(widget, model, model_getter, model_property_notifier=None, model_setter=None, widget_property_name='', widget_property_notifier=None, converter=None)[source]
Adds a mapping.
- Parameters:
- widget QtWidget A widget displaying some data. You want to map this
widget to model data
- model object Instance of a class holding model data (e.g. a logic
or hardware module)
- model_getter property/callable either a property holding the data to
be displayed in widget or a getter method to retrieve data from the model was changed.
- model_property_notifier Signal A signal that is fired when the data
was changed. Default: None. If None then data changes are not monitored and the widget is not updated.
- model_setter callable A setter method which is called to set data to
the model. If model_getter is a property the setter can be determined from this property and model_setter is ignored if it is None. If it is not None always this callable is used. Default: None
- widget_property_name str The name of the pyqtProperty of the widget
used to map the data. Default: ‘’ If it is an empty string the relevant property is guessed from the widget’s type.
- widget_property_notifier Signal Notifier signal which is fired by the
widget when the data changed. If None this is determined directly from the property. Example usage: QLineEdit().editingFinished Default: None
- converter Converter converter instance for converting data between
widget display and model. Default: None
- remove_mapping(widget, widget_property_name='')[source]
Removes the mapping which maps the QtWidget widget to some model data.
- Parameters:
- widget: QtWidget/(QtWidget, str) widget the mapping is attached to
or a tuple containing the widget and the widget’s property name
- widget_property_name: str name of the property of the widget we are
dealing with. If ‘’ it will be determined from the widget. Default: ‘’
- property submit_policy
Returns the submit policy.