iblrig.gui.tools.Worker

Inheritance diagram of Worker

class iblrig.gui.tools.Worker[source]

A generic worker class for executing functions concurrently in a separate thread.

This class is designed to run functions concurrently in a separate thread and emit signals to communicate the results or errors back to the main thread.

Adapted from: https://www.pythonguis.com/tutorials/multithreading-pyqt-applications-qthreadpool/

fn

The function to be executed concurrently.

Type:

Callable

args

Positional arguments for the function.

Type:

tuple

kwargs

Keyword arguments for the function.

Type:

dict

signals

An instance of WorkerSignals used to emit signals.

Type:

WorkerSignals

run() None[source]

The main entry point for running the worker. Executes the provided function and emits signals accordingly.

Return type:

None

__init__(fn, *args, **kwargs)[source]

Initialize the Worker instance.

Parameters:
  • fn (Callable) – The function to be executed concurrently.

  • *args (tuple) – Positional arguments for the function.

  • **kwargs (dict) – Keyword arguments for the function.

Parameters:
run()[source]

Execute the provided function and emit signals accordingly.

This method is the main entry point for running the worker. It executes the provided function and emits signals to communicate the results or errors back to the main thread.

Return type:

None