7.5.3.2. pymodaq_gui.managers.parameter_manager module

class pymodaq_gui.managers.parameter_manager.ParameterManager(settings_name: str | None = None, action_list: tuple = ('save', 'update', 'load'))[source]

Bases: object

Class dealing with Parameter and ParameterTree

params

Defining the Parameter tree like structure

Type:

list of dicts

settings_name

The particular name to give to the object parent Parameter (self.settings)

Type:

str

settings

The higher level (parent) Parameter

Type:

Parameter

settings_tree

widget Holding a ParameterTree and a toolbar for interacting with the tree

Type:

QWidget

tree

the underlying ParameterTree

Type:

ParameterTree

Attributes:
settings
settings_tree
tree

Methods

child_added(param, data)

Non-mandatory method to be subclassed for actions to perform when a param has been added in the attribute settings

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

load_settings_slot([file_path])

Method to load settings into the parameter using a xml file extension.

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.

param_deleted(param)

Non-mandatory method to be subclassed for actions to perform when one of the param in self.settings has been deleted

save_settings_slot([file_path])

Method to save the current settings using a xml file extension.

update_settings_slot([file_path])

Method to update settings using a xml file extension.

value_changed(param)

Non-mandatory method to be subclassed for actions to perform (methods to call) when one of the param's value in self._settings is changed

create_parameter

parameter_tree_changed

child_added(param: Parameter, data: Parameter)[source]

Non-mandatory method to be subclassed for actions to perform when a param has been added in the attribute settings

For this to be triggered, one of the Parameter methods: addChild, addChildren or insertChildren should be used

Parameters:
  • param (Parameter) – the parameter where child will be added

  • data (Parameter) – the child parameter

static create_parameter(settings: Parameter | List[Dict[str, str]] | Path) Parameter[source]
limits_changed(param: Parameter, data: Tuple[Number, Number])[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

load_settings_slot(file_path: Path = None)[source]

Method to load settings into the parameter using a xml file extension.

The starting directory is the user config folder with a subfolder called settings folder

Parameters:

file_path (Path) – Path like object pointing to a xml file encoding a Parameter object If None, opens a file explorer window to pick manually a file

options_changed(param: Parameter, data: Dict[str, Any])[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

param_deleted(param: Parameter)[source]

Non-mandatory method to be subclassed for actions to perform when one of the param in self.settings has been deleted

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

Parameters:

param (Parameter) – the parameter that has been deleted

parameter_tree_changed(param, changes)[source]
save_settings_slot(file_path: Path = None)[source]

Method to save the current settings using a xml file extension.

The starting directory is the user config folder with a subfolder called settings folder

Parameters:

file_path (Path) – Path like object pointing to a xml file encoding a Parameter object If None, opens a file explorer window to save manually a file

update_settings_slot(file_path: Path = None)[source]

Method to update settings using a xml file extension.

The file should define the same settings structure (names and children)

The starting directory is the user config folder with a subfolder called settings folder

Parameters:

file_path (Path) – Path like object pointing to a xml file encoding a Parameter object If None, opens a file explorer window to pick manually a file

value_changed(param: Parameter)[source]

Non-mandatory method to be subclassed for actions to perform (methods to call) when one of the param’s value in self._settings is changed

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

Parameters:

param (Parameter) – the parameter whose value just changed

Examples

>>> if param.name() == 'do_something':
>>>     if param.value():
>>>         print('Do something')
>>>         self.settings.child('main_settings', 'something_done').setValue(False)
params = []
property settings: Parameter
settings_name = 'custom_settings'
property settings_tree
property tree
class pymodaq_gui.managers.parameter_manager.ParameterTreeWidget(action_list: tuple = ('save', 'update', 'load'))[source]

Bases: ActionManager

Methods

setup_actions([action_list])

See also

ActionManager.add_action

setup_actions(action_list: tuple = ('save', 'update', 'load'))[source]

See also

ActionManager.add_action