Skip to content

console_output_screen

console_output_screen

Palette-reachable list of all dispatched-action console logs.

The Console output command surfaces every ConsoleLogEntry from the session — running and finished alike — so output that would once have scrolled past in a suspended terminal stays reachable inside the TUI (issue #473). Selecting an entry opens its WorkerLogScreen view.

The list is a snapshot taken when the screen opens; reopen it to pick up newly dispatched actions. Entries are in-memory only — forgotten when the app closes.

ConsoleOutputScreen(registry)

Bases: ModalScreen[None]

Modal list of the session's ConsoleLogEntry objects.

Pushed from the Console output command-palette entry. Picking a row opens that entry's WorkerLogScreen on top — closing it returns here.

Snapshot registry's entries (most-recent first) for display.

Source code in src/terok/tui/console_output_screen.py
def __init__(self, registry: ConsoleLogRegistry) -> None:
    """Snapshot *registry*'s entries (most-recent first) for display."""
    super().__init__()
    self._entries: list[ConsoleLogEntry] = registry.entries

BINDINGS = [Binding('escape', 'dismiss', 'Close')] class-attribute instance-attribute

CSS = '\n ConsoleOutputScreen {\n align: center middle;\n }\n\n #console-output-dialog {\n width: 80%;\n height: 70%;\n border: heavy $primary;\n border-title-align: right;\n background: $surface;\n padding: 1 2;\n }\n\n #console-output-list {\n height: 1fr;\n border: round $primary-darken-2;\n margin-bottom: 1;\n }\n\n #console-output-empty {\n height: 1fr;\n color: $text-muted;\n content-align: center middle;\n }\n\n .console-output-command {\n color: $text-muted;\n }\n\n #console-output-buttons {\n height: 3;\n align-horizontal: right;\n }\n ' class-attribute instance-attribute

compose()

Lay out the entry list (or an empty-state label) and a Close button.

Source code in src/terok/tui/console_output_screen.py
def compose(self) -> ComposeResult:
    """Lay out the entry list (or an empty-state label) and a Close button."""
    dialog = Vertical(id="console-output-dialog")
    dialog.border_title = "Console output"
    with dialog:
        if self._entries:
            yield ListView(
                *(self._row(entry) for entry in self._entries),
                id="console-output-list",
            )
        else:
            yield Label(
                "No console output yet — dispatched actions (image builds, "
                "gate / vault operations, container starts) appear here.",
                id="console-output-empty",
            )
        with Horizontal(id="console-output-buttons"):
            yield Button("Close", id="console-output-close", variant="default")

on_list_view_selected(event)

Open the picked entry's WorkerLogScreen view.

Source code in src/terok/tui/console_output_screen.py
def on_list_view_selected(self, event: ListView.Selected) -> None:
    """Open the picked entry's [`WorkerLogScreen`][terok.tui.worker_log_screen.WorkerLogScreen] view."""
    index = event.list_view.index
    if index is not None and 0 <= index < len(self._entries):
        self.app.push_screen(WorkerLogScreen(self._entries[index]))

on_button_pressed(event)

Close the screen on the Close button.

Source code in src/terok/tui/console_output_screen.py
def on_button_pressed(self, event: Button.Pressed) -> None:
    """Close the screen on the Close button."""
    if event.button.id == "console-output-close":
        self.dismiss()