exlab_wizard.window#
Window application package. Backend Spec §4.3.2.
Public API:
run_window()– open a pywebview window at the handshake’s port.build_window_url()– compose the loopback URL.ServerHandshake– the validatedserver.jsonpayload.
We deliberately avoid re-exporting the main() function at the
package root to keep exlab_wizard.window.main resolving to the
submodule (the launcher imports the submodule, not the function).
- class exlab_wizard.window.ServerHandshake(*, port, pid, started_at)[source]#
Bases:
objectResolved
server.jsoncontents:port/pid/started_at.- pid#
- port#
- started_at#
- exlab_wizard.window.build_window_url(handshake)[source]#
Return the URL the window points at.
Always loopback (Backend §4.1: “binds to
127.0.0.1only”); the handshake’s port is mandatory.- Parameters:
handshake (
ServerHandshake)- Return type:
- exlab_wizard.window.is_debug_enabled()[source]#
True when
EXLAB_DEBUGis set to a truthy string. Backend §15.3.2.- Return type:
- exlab_wizard.window.is_pid_alive(pid)[source]#
Cross-platform “is this PID a live process?” check.
Implementation: POSIX
os.kill(pid, 0)raisesProcessLookupErrorif the PID is dead andPermissionErrorif it’s alive but owned by a different uid (counts as alive for our purposes – if the operator started a previous tray that is now owned by another user, we still don’t want to hijack it). Windows usesOpenProcessviactypes; we deliberately keep the implementation small and inline because it has no other call sites.
- exlab_wizard.window.read_server_handshake(state_dir)[source]#
Read and validate
<state_dir>/server.json.Returns the handshake on success,
Noneif the file is missing or malformed. Validation is intentionally minimal – if the file exists, the PID is alive, and the port parses, we proceed; deeper health checks happen on the first HTTP call inside pywebview.- Parameters:
state_dir (
Path)- Return type:
- exlab_wizard.window.run_window(handshake, *, create_window=None, start=None)[source]#
Open a single pywebview window pointed at the handshake’s port.
create_windowandstartare dependency-injection hooks for tests; production code defers towebview.create_windowandwebview.start. Returns 0 on clean exit.
Modules
|
|
pywebview-driven native window. |