8.4.1. Utility Classes

class pymodaq_utils.utils.ThreadCommand(command, attribute=None, attributes=None, args=(), kwargs=None)[source]

Generic object to pass info (command) and data (attribute) between thread or objects using signals

Parameters:
  • command (str) – The command to be analysed for further action

  • attribute (any type) – the attribute related to the command. The actual type and value depend on the command and the situation

  • attributes (deprecated, attribute should be used instead)

Variables:
  • command (str) – The command to be analysed for further action

  • attribute (any type) – the attribute related to the command. The actual type and value depend on the command and the situation

  • args (some variables in a list)

  • kwargs (some variables in a dict)

static deserialize(bytes_str)[source]

Rebuild a ThreadCommand from bytes created by serialize()

Returns:

The ThreadCommand and the remaining bytes that were not consumed.

Return type:

Tuple[ThreadCommand, bytes]

static serialize(obj)[source]

Serialize the command, attribute, args and kwargs of a ThreadCommand into bytes

Return type:

bytes