spacr.qt.import_demo¶
Import’s “Load test data…”: every vendor format and naming, one press away.
A press of “Test Zeiss CZI import” downloads Zeiss CZI files named by ZEN’s
split-tiles convention, fills the Import screen with their paths on disk and
previews them, so the user can import them and see each file land on the
well, field and channel it came from. Every other format and filename
convention in spacr.import_examples.IMPORT_VARIANTS works the same way.
WHAT THE BUTTON DOES. It opens ImportTestDataChooser, one button
per variant in spacr.import_examples.IMPORT_VARIANTS, each described
on hover. The chosen one is fetched – the whole set is one archive, so the
first press downloads every variant and every later press opens from the
cache – and then:
an
importvariant fills the Import screen itself: the image folder, the three mask folders, the measurement table, the naming convention and, for Custom, its pattern. A fresh destination is chosen, so a second demo never lands in the first one’s project, and Preview is pressed. Nothing is written until the user presses Import.a
convertvariant – the public ND2 and LIF samples, which have no masks – opens the Format Converter page and fills and previews that.
SAME MACHINERY AS EVERY OTHER EXAMPLE SET: _TarExampleWorker
streams the archive on a worker thread behind the shared progress dialog and
unpacks it through the tar data filter.
Classes¶
Every Import test variant, described on hover, in a grid. |
Functions¶
|
Fill the screen for one unpacked variant and press Preview. |
|
Show the chooser, then load whatever was picked. |
|
Fetch Import's test data behind the shared progress dialog. |
|
Open one variant, downloading the set first when it is not cached. |
Module Contents¶
- class spacr.qt.import_demo.ImportTestDataChooser(parent=None)[source]¶
Bases:
spacr.qt.widgets.test_data_chooser.TestDataChooserEvery Import test variant, described on hover, in a grid.
- Parameters:
parent – parent widget.
Build the chooser from the variant registry.
- spacr.qt.import_demo.apply_variant(screen, root, key: str) bool[source]¶
Fill the screen for one unpacked variant and press Preview.
- Parameters:
screen – the Import screen.
root – the unpacked
import_examplefolder.key – the variant.
- Returns:
whether the variant was complete and the preview started.
- spacr.qt.import_demo.choose_import_test_data(screen, *, chooser=None, ask=None, plate=None) bool[source]¶
Show the chooser, then load whatever was picked.
- Parameters:
screen – the Import screen.
chooser – replaces
ImportTestDataChooser, for tests – a headless run cannot show a modal dialog.ask – passed to
load_import_test_data().plate – passed to
load_import_test_data().
- Returns:
whether a variant was opened by this call.
- spacr.qt.import_demo.download_import_example(parent, dest, on_done: Callable[[spacr.qt.hf_download.DownloadResult | None, str], None]) None[source]¶
Fetch Import’s test data behind the shared progress dialog.
- Parameters:
parent – the widget the progress dialog belongs to.
dest – the example plate folder the archive unpacks into.
on_done – called on the GUI thread as
on_done(result, error).
- spacr.qt.import_demo.load_import_test_data(screen, key: str, *, ask=None, plate=None) bool[source]¶
Open one variant, downloading the set first when it is not cached.
- Parameters:
screen – the Import screen.
key – the variant.
ask – replaces
download_import_example(), for tests. Called asask(screen, plate, on_done).plate – replaces the example plate folder, for tests.
- Returns:
whether the variant was opened by this call.
Falsewhile a download is still running, and after a failure.
Nested helpers¶
- _load_import_variant._done(result, error)¶
Put the button back, then hand over the variant or say why not.
spacr/qt/import_demo.py:303
- _load_import_variant._report(message: str) None¶
Show
messagewhere the owner asked, or log it.spacr/qt/import_demo.py:290
- load_import_test_data._done(result, error)¶
Put the button back, then open the variant or say why not.
spacr/qt/import_demo.py:141