spacr.qt.widgets.loading_screen¶
The screen that covers the preload.
spaCR imports ~3.1 s of heavy modules (torch, cellpose, pandas and the
pipeline that depends on them) before the first click on a module can be
instant. Measured on a real windowed launch: spacr.core alone is 1968 ms
and spacr.deep_spacr 711 ms.
Those imports have to run on the MAIN thread – doing them on a worker races
Qt’s own GPU initialisation and segfaults, which is recorded above
spacr.qt.app._PipelinePreloader. So the event loop will be blocked
for seconds. The only question is whether the user is looking at a window
that appears interactive while it happens.
This is the answer: cover the whole window until the work is done. A freeze behind a screen that says LOADING is not a freeze, and the same three seconds stop being a defect.
THE PROGRESS IS THE PRODUCT’S OWN SENTENCE. Rather than a bar, the three
phases of STRAP_LINE light up in turn as the modules land –
microscopy, then single-cell analysis, then genotype-to-phenotype. It reads
as the pipeline describing itself, and it is honest: the denominator is the
number of modules, which is known before the first one is imported.
Classes¶
Full-window cover shown until the pipeline modules are imported. |
Functions¶
|
The whole strap line as one translated string. |
|
The strap line's phases, translated, for the home screen to reuse. |
Module Contents¶
- class spacr.qt.widgets.loading_screen.LoadingScreen(total: int = 0, parent: PySide6.QtWidgets.QWidget | None = None)[source]¶
Bases:
PySide6.QtWidgets.QWidgetFull-window cover shown until the pipeline modules are imported.
- Parameters:
total – how many steps will be reported. Zero or negative means “unknown”, and the phases stay dim rather than dividing by it.
parent – the window this fills. It is sized to the parent and resizes with it, rather than being a separate top-level – a second window would earn its own taskbar entry and could be dragged off the thing it is supposed to be covering.
Build the splash that covers the window while it is being assembled.
Opaque by construction: it covers a partly-built window, and any transparency would show the thing it exists to hide.
- Parameters:
total – how many steps the progress bar counts to;
0shows no proportion.parent – the window to cover; its geometry is adopted.
- advance(done: int | None = None) None[source]¶
Report progress. Without an argument, counts one more step.
- lit_phases() int[source]¶
How many of the three phases are lit at the current fraction.
The last phase lights only at completion, so a user never sees the sentence finished while work is still running.
- resizeEvent(event) None[source]¶
Re-centre the message for the new size.
- Parameters:
event – the Qt resize event.
- set_total(total: int) None[source]¶
Set the denominator; repaints if it changed.
- Parameters:
total – number of steps the progress counts towards; converted to
intand floored at 0, which means unknown and makesfraction()report 0.0.
- spacr.qt.widgets.loading_screen.strap_line() str[source]¶
The whole strap line as one translated string.
- spacr.qt.widgets.loading_screen.strap_phrases() Sequence[str][source]¶
The strap line’s phases, translated, for the home screen to reuse.
The home screen shows the same sentence beside the same logo, so it takes the words from here rather than repeating them – one string, one place, one set of translation rows.