ibl_alignment_gui.app.load_worker
Generic background worker for running slow tasks off the GUI thread.
Classes
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:
QObjectRun a single callable on a background thread and report the outcome via Qt signals.
The worker runs
func(*args, **kwargs)when itsrun()slot is invoked (typically by aQThread.startedsignal). It must not touch any Qt widgets; results are delivered back to the main thread through thefinishedanderrorsignals (Qt marshals cross-thread signal emissions onto the receiving thread’s event loop).When
report_progressis True the worker injects its own progress emitter as aprogress_callbackkeyword argument, sofunccan report progress by callingprogress_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_callbackkeyword tofuncthat re-emits as theprogresssignal.**kwargs (Any) – Keyword arguments forwarded to
func.
- Variables:
progress (QtCore.Signal) – Emitted as
(message, current, total)whilefuncruns (only if it reports progress).finished (QtCore.Signal) – Emitted with the return value of
funconce it completes successfully.error (QtCore.Signal) – Emitted with a formatted traceback string if
funcraises.