devctrl.task.tasks.UserConfirmTask#
- class UserConfirmTask(msg: str = '', allow_cancel: bool = False)[source]#
Bases:
TaskTask that waits for user input. Can be used to block until the user did some manual task, or serve as a reminder.
Methods
Convenience wrapper for dataclasses.asdict(self)
Recursively construct a SettingsClass from a dictionary.
Get formatted task name with settings
Return relevant settings as a formatted string for GUI display
Return the human-readable name of the task.
Attributes
Whether to also show a 'cancel' button that stops task processing
- __abstractmethods__ = frozenset({})#
- __annotations__ = {'allow_cancel': <class 'bool'>, 'msg': <class 'str'>}#
- __dataclass_fields__ = {'allow_cancel': Field(name='allow_cancel',type=<class 'bool'>,default=False,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=False,_field_type=_FIELD), 'msg': Field(name='msg',type=<class 'str'>,default='',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=False,_field_type=_FIELD)}#
- __dataclass_params__ = _DataclassParams(init=True,repr=True,eq=True,order=False,unsafe_hash=False,frozen=False,match_args=True,kw_only=False,slots=False,weakref_slot=False)#
- __dict__ = mappingproxy({'__module__': 'devctrl.task.tasks', '__firstlineno__': 33, '__annotations__': {'msg': <class 'str'>, 'allow_cancel': <class 'bool'>}, '__doc__': '\nTask that waits for user input.\nCan be used to block until the user did some manual task, or serve as a reminder.\n', 'msg': '', 'allow_cancel': False, 'get_settings_name': <function UserConfirmTask.get_settings_name>, 'estimate_runtime_s': <function UserConfirmTask.estimate_runtime_s>, '__static_attributes__': (), '__abstractmethods__': frozenset(), '_abc_impl': <_abc._abc_data object>, '__dataclass_params__': _DataclassParams(init=True,repr=True,eq=True,order=False,unsafe_hash=False,frozen=False,match_args=True,kw_only=False,slots=False,weakref_slot=False), '__dataclass_fields__': {'msg': Field(name='msg',type=<class 'str'>,default='',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=False,_field_type=_FIELD), 'allow_cancel': Field(name='allow_cancel',type=<class 'bool'>,default=False,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=False,_field_type=_FIELD)}, '__replace__': <function _replace>, '__hash__': None, '__init__': <function UserConfirmTask.__init__>, '__repr__': <function UserConfirmTask.__repr__>, '__eq__': <function UserConfirmTask.__eq__>, '__match_args__': ('msg', 'allow_cancel')})#
- __eq__(other)#
Return self==value.
- __firstlineno__ = 33#
- __hash__ = None#
- __init__(msg: str = '', allow_cancel: bool = False) None#
- __match_args__ = ('msg', 'allow_cancel')#
- __module__ = 'devctrl.task.tasks'#
- __or__(other)#
Merge with another settings class or a dictionary.
- __replace__(**changes)#
- __repr__()#
Get formatted task name with settings
- Returns:
Formatted string as ‘typename (settings_name)’
- __slots__ = ()#
- __static_attributes__ = ()#
- __weakref__#
list of weak references to the object
- _abc_impl = <_abc._abc_data object>#
- _children: Dict[str, Type[Task]] = {'DebugTask': <class 'devctrl.task.tasks.DebugTask'>, 'MeasurementTask': <class 'prsctrl_gui.task.measurement.MeasurementTask'>, 'UserConfirmTask': <class 'devctrl.task.tasks.UserConfirmTask'>, 'WaitTask': <class 'devctrl.task.tasks.WaitTask'>}#
- allow_cancel: bool = False#
Whether to also show a ‘cancel’ button that stops task processing
- as_dict() dict#
Convenience wrapper for dataclasses.asdict(self)
- classmethod from_dict(data: dict)#
Recursively construct a SettingsClass from a dictionary. If the value of a field is another SettingsClass, from_dict will be called for that field as well. Handled are: - SettingsClass - list[SettingsClass] - dict[<any>, SettingsClass] - all of the above as Optional
- Raises:
ValueError – If data contains a value that has the wrong type for the field of cls (ONLY if the type is a subclass of SettingsClass! Other types are not enforced)
KeyError – If data contains a key that is not a field name of cls
- get_name()#
Get formatted task name with settings
- Returns:
Formatted task name including settings
- get_settings_name() str[source]#
Return relevant settings as a formatted string for GUI display
Iterates through task fields and returns a string representation of non-default values that can be used for displaying the task in the GUI.
- Returns:
Formatted string of settings, or empty string if no settings differ from defaults
- classmethod get_type_name() str#
Return the human-readable name of the task.
- classmethod load_yaml(yaml_path: str, loader=<class 'yaml.loader.Loader'>)#
- msg: str = ''#
- save_yaml(yaml_path: str)#