Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allows to add variable arguments and named arguments as list and dict arguments of threadcommand #27

Merged
merged 1 commit into from
Feb 28, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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