Utility Classes

class pymodaq_utils.utils.ThreadCommand(command: str, attribute=None, attributes=None, args=(), kwargs: dict | None = 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)

command

The command to be analysed for further action

Type:

str

attribute

the attribute related to the command. The actual type and value depend on the command and the situation

Type:

any type

args
Type:

some variables in a list

kwargs
Type:

some variables in a dict

static deserialize(bytes_str: bytes) Tuple[ThreadCommand, bytes][source]

Implements deserialization into self type from bytes

Parameters:

bytes_str (bytes)

Returns:

  • SerializableBase (object to reconstruct)

  • bytes (leftover bytes to deserialize)

Notes

The actual deserialization should be done using the SerializableFactory and its method :meth:SerializableFactory.get_apply_deserializer

static serialize(obj: ThreadCommand) bytes[source]

Implements self serialization into bytes

Parameters:

obj (SerializableBase)

Return type:

bytes

Notes

The actual serialization should be done using the SerializableFactory and its method :meth:SerializableFactory.get_apply_serializer