pysepal.scripts.thread_controller.TaskController#
- class pysepal.scripts.thread_controller.TaskController(function, callback=None, alert=None, start_button=None, stop_button=None, disable_components=None, *function_args, **function_kwargs)[source]#
Initializes the TaskController.
- Parameters:
function (Callable) – The long-running function to execute.
callback (Callable | None) – A function to call with the result after the task completes.
alert (Alert | None) – An optional alert widget for displaying messages.
start_button (Btn | None) – An optional button to start the task.
stop_button (Btn | None) – An optional button to stop the task.
disable_components (List | None) – A list of components to disable while the task is running.
*function_args – Positional arguments for the function.
**function_kwargs – Keyword arguments for the function.
Methods
Initializes the TaskController.
Enables or disables UI components.
Starts the long-running task in a separate thread.
Signals the task to stop.
- TaskController.__init__(function, callback=None, alert=None, start_button=None, stop_button=None, disable_components=None, *function_args, **function_kwargs)[source]#
Initializes the TaskController.
- Parameters:
function (Callable) – The long-running function to execute.
callback (Callable | None) – A function to call with the result after the task completes.
alert (Alert | None) – An optional alert widget for displaying messages.
start_button (Btn | None) – An optional button to start the task.
stop_button (Btn | None) – An optional button to stop the task.
disable_components (List | None) – A list of components to disable while the task is running.
*function_args – Positional arguments for the function.
**function_kwargs – Keyword arguments for the function.