spacr.qt.bridge

Background execution + progress bridge between the Qt UI and the pipeline functions in spacr.core / spacr.deep_spacr / spacr.submodules / etc.

Runs each pipeline call in a QThread so the UI stays responsive. The worker installs stdout/stderr shims that emit line_ready(str) on every print, so the caller can pipe them into a QPlainTextEdit console.

Module Contents

class spacr.qt.bridge.PipelineWorker(fn: Callable[Ellipsis, Any], settings: Dict[str, Any])[source]

Bases: PySide6.QtCore.QObject

Runs one pipeline function in its own thread.

Signals:

line_ready(str) — a chunk of stdout/stderr text finished(bool) — True if the function returned without an

unhandled exception

error(str) — traceback string on failure figure_ready(object)

— a matplotlib Figure that the pipeline

asked to show(); emitted from the worker thread so the UI slot can attach it.

line_ready[source]
finished[source]
error[source]
figure_ready[source]
run() None[source]

Invoked by QThread.started; runs the pipeline function to completion.

spacr.qt.bridge.resolve_pipeline_entry(app_key: str) Callable[[Dict[str, Any]], Any] | None[source]

Return the pipeline function that runs a given app, or None if the app is interactive-only (annotate / make_masks) or unknown.

spacr.qt.bridge.make_thread(fn: Callable[[Dict[str, Any]], Any], settings: Dict[str, Any]) tuple[PySide6.QtCore.QThread, PipelineWorker][source]

Return (thread, worker) — caller connects worker signals and calls thread.start().