The overlay could not report a hub's own slow work: it paints only on an empty stack, so over a screen kept up with stay() it draws nothing, and it is not a screen at all, so it takes no keys either. A visited hub stays armed the whole time it waits, which means every press during a slow device write still reaches it - letters into its live filter, Esc resolving a round nobody is waiting for yet, handed back the instant the work lands. BusyDialog is BusyScreen drawn as a box over what it interrupts: modal, so the press dies on the card instead. Nesting keeps the outermost one, so a batch of writes is one wait rather than a box per write, and its caption can change to say which step it is on. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
65 lines
2.0 KiB
Python
65 lines
2.0 KiB
Python
"""A small, centralized, reusable full-screen text-UI library.
|
|
|
|
Built on prompt_toolkit (for the terminal, input, and resize handling) and Rich (for all
|
|
content rendering), this package gives the interactive app a consistent, bounded, layered
|
|
UI: screens never overflow the terminal, long content scrolls, going deeper stacks dialogs
|
|
over a dimmed parent, and Esc always dismisses the current layer.
|
|
|
|
Navigation is a strict stack: one push per screen entered, one pop per Esc, and the screen
|
|
object survives the whole visit so its cursor, sort and filter are still there when a
|
|
sub-screen closes (:meth:`~meshterm.ui.tui.session.TuiSession.stay`). The one shortcut past
|
|
it is ^W, which unwinds every frame at once by raising
|
|
:class:`~meshterm.ui.tui.screen.PopToMenu` through them.
|
|
|
|
Public API:
|
|
- :class:`~meshterm.ui.tui.session.TuiSession` — the running session and prompt helpers.
|
|
- :class:`~meshterm.ui.tui.select.Choice` / :class:`~meshterm.ui.tui.select.Separator`
|
|
— items for ``session.select``.
|
|
- Screen classes for advanced/custom layers.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
from .overlay import BusyOverlay
|
|
from .progress import ProgressScreen
|
|
from .prompt import (
|
|
CHANNEL_BYTE_LIMIT,
|
|
DM_BYTE_LIMIT,
|
|
AutocompleteScreen,
|
|
ConfirmScreen,
|
|
ReconnectDialog,
|
|
TextScreen,
|
|
TypedConfirmDialog,
|
|
byte_counter,
|
|
)
|
|
from .screen import CANCEL, BusyDialog, BusyScreen, PopToMenu, Screen, ScrollScreen
|
|
from .select import Choice, DeleteRequest, SelectScreen, Separator
|
|
from .session import TuiSession, Visit
|
|
from .spinner import Spinner
|
|
|
|
__all__ = [
|
|
"TuiSession",
|
|
"Screen",
|
|
"ScrollScreen",
|
|
"BusyDialog",
|
|
"BusyScreen",
|
|
"SelectScreen",
|
|
"Choice",
|
|
"DeleteRequest",
|
|
"Separator",
|
|
"TextScreen",
|
|
"ConfirmScreen",
|
|
"AutocompleteScreen",
|
|
"ReconnectDialog",
|
|
"TypedConfirmDialog",
|
|
"ProgressScreen",
|
|
"Spinner",
|
|
"BusyOverlay",
|
|
"CANCEL",
|
|
"PopToMenu",
|
|
"Visit",
|
|
"DM_BYTE_LIMIT",
|
|
"CHANNEL_BYTE_LIMIT",
|
|
"byte_counter",
|
|
]
|