ibl_alignment_gui.app.load_worker

Generic background worker for running slow tasks off the GUI thread.

Classes

Worker

Run a single callable on a background thread and report the outcome via Qt signals.

class ibl_alignment_gui.app.load_worker.Worker(func, *args, report_progress=False, **kwargs)[source]

Bases: QObject

Run a single callable on a background thread and report the outcome via Qt signals.

The worker runs func(*args, **kwargs) when its run() slot is invoked (typically by a QThread.started signal). It must not touch any Qt widgets; results are delivered back to the main thread through the finished and error signals (Qt marshals cross-thread signal emissions onto the receiving thread’s event loop).

When report_progress is True the worker injects its own progress emitter as a progress_callback keyword argument, so func can report progress by calling progress_callback(message, current, total).

Parameters:
  • func (Callable) – The callable to run on the background thread.

  • *args (Any) – Positional arguments forwarded to func.

  • report_progress (bool) – If True, pass a progress_callback keyword to func that re-emits as the progress signal.

  • **kwargs (Any) – Keyword arguments forwarded to func.

Variables:
  • progress (QtCore.Signal) – Emitted as (message, current, total) while func runs (only if it reports progress).

  • finished (QtCore.Signal) – Emitted with the return value of func once it completes successfully.

  • error (QtCore.Signal) – Emitted with a formatted traceback string if func raises.

run()[source]

Run the callable, emitting finished with its result or error on failure.

Return type:

None