clearance_screen
clearance_screen
¶
In-TUI clearance screen for live D-Bus shield verdict handling.
Provides a ClearanceScreen backed by terok_clearance.CallbackNotifier
plugged into terok_clearance.EventSubscriber. The subscriber handles the
full signal-to-verdict cycle; the callback notifier bridges D-Bus events
into Textual messages so the screen can render blocked connections and
route operator Allow/Deny actions back through D-Bus.
The screen listens on the whole session bus — all containers' events are shown, with the container name displayed prominently on every row.
Dual use:
- Embedded — pushed as a screen inside
terok-tui. - Standalone —
terok clearancelaunchesClearanceApp, a minimal Textual app containing only this screen.
ClearanceScreen()
¶
Bases: Screen[None]
Full-page screen for live D-Bus shield clearance verdicts.
Initialise clearance screen state.
Source code in src/terok/tui/clearance_screen.py
BINDINGS = [_modal_binding('escape', 'dismiss_screen', 'Back'), _modal_binding('q', 'dismiss_screen', 'Back'), _modal_binding('a', 'allow_selected', 'Allow'), _modal_binding('x', 'deny_selected', 'Deny')]
class-attribute
instance-attribute
¶
CSS = '\n ClearanceScreen {\n layout: vertical;\n background: $background;\n }\n #clearance-header {\n height: 1;\n background: $primary;\n color: $text;\n padding: 0 1;\n }\n #pending-list {\n height: auto;\n max-height: 40%;\n border: round $primary;\n border-title-align: right;\n background: $surface;\n }\n #event-log {\n height: 1fr;\n }\n '
class-attribute
instance-attribute
¶
compose()
¶
Build header, pending list, event log.
The footer is not composed here: when this screen is pushed
inside the host terok-tui app its parent Footer already
renders the active screen's bindings, and doubling up would
produce two footer bars. The standalone ClearanceApp
composes its own Footer so the bindings still show.
Source code in src/terok/tui/clearance_screen.py
on_mount()
async
¶
Connect to the clearance hub and start the event subscriber.
Source code in src/terok/tui/clearance_screen.py
on_app_focus(_event)
¶
Cut short any reconnect back-off when the operator refocuses.
on_unmount()
async
¶
Stop the subscriber and release resources.
Source code in src/terok/tui/clearance_screen.py
on__notification_posted(message)
¶
Handle notifications from the CallbackNotifier.
Source code in src/terok/tui/clearance_screen.py
on__lifecycle_posted(message)
¶
Render container-lifecycle events in the scrolling log.
Source code in src/terok/tui/clearance_screen.py
action_allow_selected()
¶
action_deny_selected()
¶
ClearanceApp
¶
Bases: App
Minimal Textual app containing only the ClearanceScreen.
The app-level Footer auto-renders the pushed screen's bindings, so
operators see a Allow x Deny Esc Back without us maintaining a
hand-written hint string. The command palette (^p) is disabled —
this tool's surface is four verdict keys, and a palette prompt would
just confuse.