8.5.4.3. pymodaq_gui.parameter.utils module

class pymodaq_gui.parameter.utils.ParameterWithPath(parameter, path=None)[source]

Bases: SerializableBase

holds together a Parameter object and its full path

To be used when communicating between TCPIP to reconstruct properly the Parameter

parameter

a Parameter object

Type:

Parameter

path
Type:

full path of the parameter, if None it is constructed from the parameter parents

Attributes:
parameter
path

Methods

deserialize(bytes_str)

Convert bytes into a ParameterWithPath object

serialize

value

classmethod deserialize(bytes_str)[source]

Convert bytes into a ParameterWithPath object

Return type:

Union[ParameterWithPath, Tuple[ParameterWithPath, bytes]]

Returns:

  • ParameterWithPath (the decoded object)

  • bytes (the remaining bytes string if any)

static serialize(param)[source]
Return type:

bytes

value()[source]
property parameter: Parameter
property path: List[str]
pymodaq_gui.parameter.utils.change_visibility_all_descendants(param, visible=True)[source]

Recursively show all descendants of a parameter

pymodaq_gui.parameter.utils.compareParameters(param1, param2, with_self=True)[source]

Compare the structure and the opts of two parameters with their children, return True if structure and all opts are identical. If with_self is False, only the children opts are compared.

Parameters:
  • param1 (Parameter)

  • param2 (Parameter)

  • with_self (bool)

Return type:

bool

pymodaq_gui.parameter.utils.compareStructureParameter(param1, param2)[source]

Compare the structure of two parameters with their children, return True if structure is identical

Parameters:
  • param1 (Parameter)

  • param2 (Parameter)

Return type:

bool

pymodaq_gui.parameter.utils.compareValuesParameter(param1, param2, with_self=True)[source]

Compare the structure and the values of two parameters with their children, return True if structures and values are identical. If with_self is False, only the children opts are compared.

Parameters:
  • param1 (Parameter)

  • param2 (Parameter)

  • with_self (bool)

Return type:

bool

pymodaq_gui.parameter.utils.filter_parameter_tree(param, search_text='')[source]

Filter parameter tree based on search text. Returns True if this parameter or any of its children match the search.

Return type:

bool

pymodaq_gui.parameter.utils.getOpts(param)[source]

Return an OrderedDict with tree structures of all opts for all children of this parameter

Parameters:

param (Parameter)

Return type:

OrderedDict

pymodaq_gui.parameter.utils.getStruct(param)[source]

Return an OrderedDict with tree structures of all children of this parameter

Parameters:

param (Parameter)

Return type:

OrderedDict

pymodaq_gui.parameter.utils.getValues(param)[source]

Return an OrderedDict with tree structures of all values for all children of this parameter

Parameters:

param (Parameter)

Return type:

OrderedDict

pymodaq_gui.parameter.utils.get_param_dict_from_name(parent_list, name, pop=False)[source]

Get dict under parent whose name is name. The parent_list structure is the one used to init a Parameter object

Parameters:
  • parent_list ((list of dicts) as defined to init Parameter object)

  • name ((str) value to find for the key: name)

  • pop ((bool) if True remove the matched dict from parent)

Return type:

dict the matched dict

pymodaq_gui.parameter.utils.get_param_from_name(parent, name)[source]

Get Parameter under parent whose name is name

Parameters:
  • parent (Parameter)

  • name (str)

Return type:

Parameter

pymodaq_gui.parameter.utils.get_param_path(param)[source]

Get the parameter path from its highest parent down to the given parameter including its identifier (name)

Parameters:

param (Parameter) – The parameter object

Returns:

List[str]

Return type:

List[str]

pymodaq_gui.parameter.utils.get_widget_from_tree(parameter_tree, widget_instance)[source]
pymodaq_gui.parameter.utils.is_name_in_dict(dict_tmp, name)[source]
pymodaq_gui.parameter.utils.iter_children(param, childlist=[], filter_type=(), filter_name=(), select_filter=False)[source]

Get a list of parameters’ name under a given Parameter (see iter_children_params)

Returns:

The list of the children name from the given node.

Return type:

list

pymodaq_gui.parameter.utils.iter_children_params(param, childlist=[], output_type=None, filter_type=(), filter_name=(), select_filter=False)[source]

Get a list of parameters under a given Parameter.

Parameters:
  • param (Parameter (pyqtgraph)) – the root node to be coursed

  • childlist (list) – the child/output list

  • output_type (str) – the attribute of parameter that will be added to the output list

  • filter_type (list) – filter children sharing those types

  • filter_name (list) – filter children sharing those names

  • select_filter (bool) – if True, add filtered parameters to output list. if False (default), add non-filtered parameter to output list.

Returns:

The list of the children from the given node.

Return type:

list

pymodaq_gui.parameter.utils.scroll_linear(scroll_val, min_val, max_val)[source]

Convert a scroll value [0-100] to a linear scale between min_val and max_val

Parameters:
  • scroll

  • min_val

  • max_val

Return type:

the scaled value

pymodaq_gui.parameter.utils.scroll_log(scroll_val, min_val, max_val)[source]

Convert a scroll value [0-100] to a log scale between min_val and max_val

Parameters:
  • scroll

  • min_val

  • max_val

Return type:

the scaled value

pymodaq_gui.parameter.utils.set_param_from_param(param_old, param_new)[source]

Walk through parameters children and set values using new parameter values.