A machine with a debug probe, a programmer and a USB adapter soldered into it shows all three on every start, in front of the one radio the user actually came for. h drops the highlighted device from the list and remembers it in the device registry; ⇧H brings every hidden one back. Both keys are named in the footer only where they would act - h on a device row, ⇧H only while something is hidden - which is the rule Del remove already followed. Hiding is a listing choice and nothing else: a hidden device is still remembered, still resolvable by --port, and shows itself again the moment it is connected to. A row that is simply gone would let the list misrepresent the machine, so a muted line says how many are hidden and which key returns them - and that line is also where ⇧H survives on a console whose splash border is 47 cells. The mechanics are shared rather than local: a non-filterable list can declare bare-key shortcuts (a filtering one cannot - every letter there belongs to the query) and name them per highlighted row, and a chromeless splash whose hint outgrows its box now drops atoms in front of Esc rather than being cut off at the end, where Esc is. Two things the narrow console showed while this was being fitted: the splash header was a hand-built string that wrapped at 53 columns, and the DEVICE lane sized itself to the longest name - which for a USB adapter is its forty-character product string, pushing HARDWARE off the edge entirely. The header goes through column_header, and the name lane now yields to keep HARDWARE on screen. What is left of a long model string scrolls: ←→ read the highlighted row's tail to its end, with the lanes in front of it pinned. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
66 lines
2.0 KiB
Python
66 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, KeyRequest, SelectScreen, Separator
|
|
from .session import TuiSession, Visit
|
|
from .spinner import Spinner
|
|
|
|
__all__ = [
|
|
"TuiSession",
|
|
"Screen",
|
|
"ScrollScreen",
|
|
"BusyDialog",
|
|
"BusyScreen",
|
|
"SelectScreen",
|
|
"Choice",
|
|
"DeleteRequest",
|
|
"KeyRequest",
|
|
"Separator",
|
|
"TextScreen",
|
|
"ConfirmScreen",
|
|
"AutocompleteScreen",
|
|
"ReconnectDialog",
|
|
"TypedConfirmDialog",
|
|
"ProgressScreen",
|
|
"Spinner",
|
|
"BusyOverlay",
|
|
"CANCEL",
|
|
"PopToMenu",
|
|
"Visit",
|
|
"DM_BYTE_LIMIT",
|
|
"CHANNEL_BYTE_LIMIT",
|
|
"byte_counter",
|
|
]
|