spacr.qt.screens.queue

Queue screen — dashboard for the plate queue.

Layout:

┌───────────────────────────────────────────────────────────────┐ │ [Add plate] [Import CSV…] [Clear finished] [Run] [Stop] │ ├───────────────────────────────────────────────────────────────┤ │ ID │ App │ Label │ Status │ Elapsed │ │ │ … │ mask │ /data/plateA │ success │ 42.1 s │ [Remove] │ │ … │ mask │ /data/plateB │ running │ 08.5 s │ │ │ … │ mask │ /data/plateC │ queued │ │ [Remove] │ └───────────────────────────────────────────────────────────────┘

Each row reflects a spacr.qt.plate_queue.QueueItem. The screen owns a spacr.qt.plate_queue.PlateQueue and a single worker QThread that walks items sequentially.

Classes

QueueScreen

Main widget rendering the plate queue.

Module Contents

class spacr.qt.screens.queue.QueueScreen(queue: spacr.qt.plate_queue.PlateQueue | None = None, parent=None)[source]

Bases: PySide6.QtWidgets.QWidget

Main widget rendering the plate queue.

Parameters:
  • queue – the queue to render. None loads spaCR’s own, which is the ordinary case; a test passes one built on a temporary path so it does not disturb the user’s real queue.

  • parent – parent widget.

Build the queue screen and start its elapsed-time tick.

Parameters:
  • queue – the queue to show; None builds an empty one.

  • parent – parent widget, or None.

add_item(app_key: str, settings: dict) → spacr.qt.plate_queue.QueueItem[source]

Build a queue item from settings and add it.

Parameters:
  • app_key – which module the item runs.

  • settings – the settings that run uses.

Returns:

the queued item.

closeEvent(event)[source]

Stop the queue runner before Qt destroys this screen.

_QueueRunner is parented to this widget and executes whole pipelines, so its thread can be hours long. Destroying the screen with it running deletes a live QThread, which Qt answers with qFatal("QThread: Destroyed while thread is still running"). It also does not go through spacr.qt.bridge.make_thread(), so the process-wide run registry — and therefore MainWindow.closeEvent’s drain — has never been able to see it.

Parameters:

event – the close event; it is passed on to the base class once the queue runner has been aborted and drained.

queue() → spacr.qt.plate_queue.PlateQueue[source]

The plate queue this screen shows.

Returns:

the queue.

start_runner()[source]

Start working through the queue, unless it is already running.

IDEMPOTENT ON PURPOSE. The button can be pressed twice, and a second runner over one queue would run every item twice.

stop_runner()[source]

Ask the runner to stop after the item it is on.

AFTER, not during: a half-written plate is worse than a queue that takes another minute to come to rest.

wire_add_current(callback)[source]

Route the “Add current plate” button through callback.

MainWindow supplies a callback that snapshots the currently active AppScreen’s settings dict and returns (app_key, settings_dict). This screen calls add_item() with that pair.

Parameters:

callback – a no-argument callable returning (app_key, settings_dict). It is called on every click; an exception it raises, or a settings dict without src, is shown in a message box instead of adding an item.

Nested helpers

QueueScreen.wire_add_current._on_click()

Add the current screen’s settings to the queue.

spacr/qt/screens/queue.py:267