exlab_wizard.tray.status#

Status-submenu rendering. Backend Spec §4.3.2.

The tray’s status submenu shows live state derived from server-side components: SessionStore.active_sessions, NASSyncClient.queue_depth, Validator.audit_summary. The string follows the §4.3.2 formatter:

  • "Idle" – nothing in progress.

  • "Sync: <N> jobs" – N >= 1 NAS-sync jobs in queue.

  • "<N> plugin needs input" – one or more sessions in INPUT_REQUIRED (the warning emoji is omitted from the canonical formatter; pystray menu labels are plain text).

  • Combined when multiple conditions hold (e.g. "Sync: 2 jobs; 1 plugin needs input").

A 5-second StatusTicker re-evaluates the formatter and notifies a callback the tray uses to refresh the menu label. The ticker runs on a daemon thread; tests can drive a single tick deterministically by calling StatusTicker.tick_once().

Functions

format_status(snapshot)

Return the menu-label string for the §4.3.2 formatter.

snapshot_status(*[, session_store, nas_sync])

Build a StatusSnapshot from live component references.

Classes

StatusSnapshot([active_sessions, ...])

Immutable view over the §4.3.2 status inputs.

StatusTicker(*[, session_store, nas_sync, ...])

Polls snapshot_status() on a fixed cadence.

class exlab_wizard.tray.status.StatusSnapshot(active_sessions=0, sync_queue_depth=0, input_required_count=0)[source]#

Bases: object

Immutable view over the §4.3.2 status inputs.

Parameters:
  • active_sessions (int)

  • sync_queue_depth (int)

  • input_required_count (int)

active_sessions: int#
input_required_count: int#
sync_queue_depth: int#
class exlab_wizard.tray.status.StatusTicker(*, session_store=None, nas_sync=None, on_update=None, interval_seconds=5.0)[source]#

Bases: object

Polls snapshot_status() on a fixed cadence.

On every tick the formatted string is computed; if it differs from the previous label the on_update callback is invoked with the new label. The callback is the tray menu’s “set status text” hook; tests pass a recording callable.

Parameters:
start()[source]#

Spawn the ticker thread. Idempotent.

Return type:

None

stop()[source]#

Signal the ticker to exit. Idempotent.

Return type:

None

tick_once()[source]#

Run a single tick synchronously. Returns the new label.

Tests call this directly so they don’t have to wait for a real 5-second interval.

Return type:

str

exlab_wizard.tray.status.format_status(snapshot)[source]#

Return the menu-label string for the §4.3.2 formatter.

Parameters:

snapshot (StatusSnapshot)

Return type:

str

exlab_wizard.tray.status.snapshot_status(*, session_store=None, nas_sync=None)[source]#

Build a StatusSnapshot from live component references.

Each component is read defensively so the launcher can pass None (setup-incomplete state) without the formatter crashing. The function reads active_sessions and input_required-style counts from session_store and in_flight_jobs / queue_depth from nas_sync.

Parameters:
  • session_store (Any)

  • nas_sync (Any)

Return type:

StatusSnapshot