7.5.1.5. pymodaq_gui.examples.parameter_ex module

S Weber 2020 Examples of custome parameter types derived from pyqtgraph

class pymodaq_gui.examples.parameter_ex.ParameterEx[source]

Bases: ParameterManager

Methods

limits_changed(param, data)

Non-mandatory method to be subclassed for actions to perform when the limits of any parameter in the settings attribute has been changed

options_changed(param, data)

Non-mandatory method to be subclassed for actions to perform when one of the options of any parameter in the settings attribute has been changed.

value_changed

limits_changed(param, data)[source]

Non-mandatory method to be subclassed for actions to perform when the limits of any parameter in the settings attribute has been changed

For this to be triggered, the Parameter method: setLimits should be used

Parameters:
  • param (Parameter) – the parameter chose option has been changed

  • data (tuple of numbers) – tuple of float or int depending on the parameter type. For peculiar Parameter, could be a tuple of some other objects

options_changed(param, data: dict)[source]

Non-mandatory method to be subclassed for actions to perform when one of the options of any parameter in the settings attribute has been changed.

For this to be triggered, the Parameter method: setOpts should be used

Parameters:
  • param (Parameter) – the parameter chose option has been changed

  • data (dict) – the key is the string of the changed option the value depend on the type of option

value_changed(param)[source]
params = [{'title': 'Groups:', 'name': 'groups', 'type': 'group', 'children': [{'title': 'A visible group:', 'name': 'agroup', 'type': 'group', 'children': []}, {'title': 'An hidden group:', 'name': 'bgroup', 'type': 'group', 'children': [], 'visible': False}, {'title': 'A bool with children:', 'name': 'booleans_group', 'type': 'bool', 'value': False, 'tip': 'Any Parameter can have its own children', 'children': [{'title': 'A bool in a bool', 'name': 'a_bool_in_a_bool', 'type': 'bool', 'value': True}, {'title': 'A push with children', 'name': 'aboolpush', 'type': 'bool_push', 'value': True, 'label': 'action', 'children': [{'title': 'A string in a group', 'name': 'atte_in_a_group', 'type': 'str', 'value': 'this is a string you can edit'}]}]}]}, {'title': 'Numbers:', 'name': 'numbers', 'type': 'group', 'children': [{'title': 'Standard float', 'name': 'afloat', 'type': 'float', 'value': 20.0, 'min': 1.0, 'tip': 'displays this text as a tooltip'}, {'title': 'Linear Slide float', 'name': 'linearslidefloat', 'type': 'slide', 'value': 50, 'default': 50, 'min': 0, 'max': 123, 'subtype': 'linear'}, {'title': 'Linear Slide float w limits', 'name': 'linearslidefloatlimits', 'type': 'slide', 'value': 50, 'default': 50, 'limits': (24, 123), 'subtype': 'linear'}, {'title': 'Linear int Slide', 'name': 'linearslideint', 'type': 'slide', 'value': 50, 'default': 50, 'step': 1, 'min': 0, 'max': 123, 'subtype': 'linear', 'int': True}, {'title': 'Linear Slide with suffix', 'name': 'linearslidewithsuffixandsiPrefix', 'type': 'slide', 'value': 50, 'default': 50, 'min': 0, 'max': 1000000.0, 'subtype': 'linear', 'suffix': 'V', 'siPrefix': True}, {'title': 'Log Slide float', 'name': 'logslidefloat', 'type': 'slide', 'value': 50, 'default': 50, 'min': 1e-05, 'max': 100000.0, 'subtype': 'log', 'suffix': 'V', 'siPrefix': True}]}, {'title': 'Booleans:', 'name': 'booleans', 'type': 'group', 'children': [{'title': 'Standard bool', 'name': 'abool', 'type': 'bool', 'value': True}, {'title': 'bool push', 'name': 'aboolpush', 'type': 'bool_push', 'value': True, 'label': 'action'}, {'title': 'A led', 'name': 'aled', 'type': 'led', 'value': False, 'tip': 'a led you cannot toggle'}, {'title': 'A led', 'name': 'anotherled', 'type': 'led_push', 'value': True, 'tip': 'a led you can toggle'}]}, {'title': 'DateTime:', 'name': 'datetimes', 'type': 'group', 'children': [{'title': 'Time:', 'name': 'atime', 'type': 'time', 'value': PyQt5.QtCore.QTime(13, 16, 13, 333)}, {'title': 'Date:', 'name': 'adate', 'type': 'date', 'value': PyQt5.QtCore.QDate(2025, 1, 21), 'format': 'dd/MM/yyyy'}, {'title': 'DateTime:', 'name': 'adatetime', 'type': 'date_time', 'value': PyQt5.QtCore.QDateTime(2025, 1, 21, 13, 16, 13, 333), 'format': 'MM/dd/yyyy hh:mm', 'tip': 'displays this text as a tooltip'}]}, {'title': 'An action', 'name': 'action', 'type': 'action'}, {'title': 'Lists:', 'name': 'lists', 'type': 'group', 'children': [{'title': 'Standard list:', 'name': 'alist', 'type': 'list', 'limits': ['a value', 'another one'], 'value': 'a value'}, {'title': 'List with add:', 'name': 'anotherlist', 'type': 'list', 'limits': ['a value', 'another one'], 'value': 'a value', 'show_pb': True, 'tip': 'when using the "show_pb" option, displays a plus button to add elt to the list'}, {'title': 'List defined from a dict:', 'name': 'dict_list', 'type': 'list', 'limits': {'xaxis': 0, 'yaxis': [0, 1, 2]}, 'value': 'yaxis', 'tip': 'Such a parameter display text that are keys of a dict whilevalues could be any object'}]}, {'title': 'Browsing files:', 'name': 'browser', 'type': 'group', 'children': [{'title': 'Look for a file:', 'name': 'afile', 'type': 'browsepath', 'value': '', 'filetype': True, 'tip': 'If filetype is True select a file otherwise a directory'}, {'title': 'Look for a dir:', 'name': 'adir', 'type': 'browsepath', 'value': '', 'filetype': False, 'tip': 'If filetype is True select a file otherwise a directory'}]}, {'title': 'Selectable items:', 'name': 'itemss', 'type': 'group', 'children': [{'title': 'Selectable items', 'name': 'items', 'type': 'itemselect', 'value': {'all_items': ['item1', 'item2', 'item3', 'item4', 'item5'], 'selected': ['item2']}, 'tip': 'Press Ctrl+click  to select items in any order'}, {'title': 'Selectable items', 'name': 'itemsbis', 'type': 'itemselect', 'value': {'all_items': ['item1', 'item2', 'item3'], 'selected': ['item2']}, 'tip': 'If show_pb is True, user can add items to the list', 'show_pb': True}, {'title': 'Removable items', 'name': 'itemsbisbis', 'type': 'itemselect', 'value': {'all_items': ['item1', 'item2', 'item3'], 'selected': ['item2']}, 'tip': 'If show_mb is True, user can remove selected items from the list', 'show_mb': True}, {'title': 'Checkable items', 'name': 'itemscheckable', 'type': 'itemselect', 'value': {'all_items': ['item1', 'item2', 'item3'], 'selected': ['item2']}, 'tip': 'If checkbox is True, user can select item by checking/unchecking items. Remove items is still used with standard selections', 'show_pb': True, 'checkbox': True, 'show_mb': True}, {'title': 'Dragable items', 'name': 'itemsdragablecheckable', 'type': 'itemselect', 'value': {'all_items': ['item1', 'item2', 'item3'], 'selected': ['item2']}, 'tip': 'If dragdrop is True, user can drag or drop items inside the list', 'checkbox': True, 'dragdrop': True}]}, {'title': 'Plain text:', 'name': 'texts', 'type': 'group', 'children': [{'title': 'Standard str', 'name': 'atte', 'type': 'str', 'value': 'this is a string you can edit'}, {'title': 'Plain text', 'name': 'text', 'type': 'text', 'value': 'this is some text'}, {'title': 'Plain text', 'name': 'textpb', 'type': 'text_pb', 'value': 'this is some text', 'tip': 'If text_pb type is used, user can add text to the parameter'}]}, {'title': 'Tables:', 'name': 'tables', 'type': 'group', 'children': [{'title': 'Table widget', 'name': 'tablewidget', 'type': 'table', 'value': OrderedDict([('key1', 'data1'), ('key2', 24)]), 'header': ['keys', 'limits'], 'height': 100}, {'title': 'Table view', 'name': 'tabular_table', 'type': 'table_view', 'delegate': <class 'pymodaq_gui.utils.widgets.table.SpinBoxDelegate'>, 'menu': True, 'value': <pymodaq_gui.utils.widgets.table.TableModel object>, 'tip': 'The advantage of the Table model lies in its modularity.\n For concrete examples see theTableModelTabular and the TableModelSequential custom models in the pymodaq.utils.scanner module'}]}]
pymodaq_gui.examples.parameter_ex.main()[source]