exlab_wizard.tray.icon#
pystray icon construction. Backend Spec §4.3.2.
The tray icon’s menu has three top-level items per the §4.1 contract:
Open – spawns or focuses the window subprocess (the launcher routes this to
WindowLauncher.open).Status submenu – live state (formatted by
tray.status) refreshed every 5 seconds.Quit – triggers the graceful-shutdown protocol (the launcher routes this to
QuitCoordinator.quit).
The icon image is a small in-memory PIL bitmap. We don’t ship a real
icon file at this phase; the asset hookup lives with PyInstaller’s
--add-data config in §15.1. The runtime image is generated from
_default_icon_image() – a 64x64 navy square with a centered “E”
glyph – which keeps the runtime self-contained and avoids relying on
file-system paths during PyInstaller bundling.
Tests pass an injected pystray module (or a stand-in) via the
pystray_module parameter so they can build the menu graph without
the real backend.
Functions
|
Build the pystray icon with the §4.1 menu. |
Return a small PIL.Image used as the tray icon bitmap. |
- exlab_wizard.tray.icon.build_icon(*, on_open, on_quit, status_provider, pystray_module=None, icon_image=None, icon_name='exlab-wizard', title='ExLab-Wizard', on_check_update=None)[source]#
Build the pystray icon with the §4.1 menu.
status_provideris invoked every time pystray re-renders the menu (pystray supports lazily-evaluated text via callable labels) so the operator sees live status without a separate refresh notification.When
on_check_updateis supplied (Design Spec §15.6 / §15.8 item 3) a “Check for updates…” item is inserted between the separator and Quit, giving the order Open, Status, —, Check for updates…, Quit. When it is None the menu is exactly as before.
- exlab_wizard.tray.icon.default_icon_image()[source]#
Return a small PIL.Image used as the tray icon bitmap.
Imported lazily so the rest of the module is import-safe even when Pillow is not yet installed (ie. minimal CI runs). On failure returns a one-byte
bytesobject the caller may pass straight to pystray; pystray accepts file-like objects too.- Return type: