Skip to content

Commit

Permalink
Merge pull request #27 from PyMoDAQ/feature/added_arguments_threadcom…
Browse files Browse the repository at this point in the history
…mand

allows to add variable arguments and named arguments as list and dict  arguments of threadcommand
  • Loading branch information
seb5g authored Feb 28, 2025
2 parents 4e05c0b + f89aad9 commit 9efa51b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/pymodaq_utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,9 +197,11 @@ class ThreadCommand:
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
"""

def __init__(self, command: str, attribute=None, attributes=None):
def __init__(self, command: str, attribute=None, attributes=None, args=(), kwargs=dict([])):
if not isinstance(command, str):
raise TypeError(f'The command in a Threadcommand object should be a string, not a {type(command)}')
self.command = command
Expand All @@ -208,6 +210,8 @@ def __init__(self, command: str, attribute=None, attributes=None):
self.attribute = attributes
self.attributes = attributes
self.attribute = attribute
self.args = args
self.kwargs = kwargs

def __repr__(self):
return f'Threadcommand: {self.command} with attribute {self.attribute}'
Expand Down

0 comments on commit 9efa51b

Please sign in to comment.