Introduce a UI surface abstraction (ctx.ui) that tools use for all input and output instead of touching questionary or the console directly. Two backends implement it: PlainUi for scripted CLI runs (prints immediately, byte-for-byte unchanged) and TuiUi for the interactive menu (bounded, scrollable result windows over a full-screen TuiSession). The new meshtools/ui/tui package reimplements the slice of questionary the app used — validated text input, confirm, autocomplete, and selectable lists — plus framing, progress, and screen management. Swap the dependency from questionary to prompt_toolkit. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
36 lines
1.2 KiB
Python
36 lines
1.2 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.
|
|
|
|
Public API:
|
|
- :class:`~meshtools.ui.tui.session.TuiSession` — the running session and prompt helpers.
|
|
- :class:`~meshtools.ui.tui.select.Choice` / :class:`~meshtools.ui.tui.select.Separator`
|
|
— items for ``session.select``.
|
|
- Screen classes for advanced/custom layers.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
from .progress import ProgressScreen
|
|
from .prompt import AutocompleteScreen, ConfirmScreen, TextScreen
|
|
from .screen import CANCEL, Screen, ScrollScreen
|
|
from .select import Choice, SelectScreen, Separator
|
|
from .session import TuiSession
|
|
|
|
__all__ = [
|
|
"TuiSession",
|
|
"Screen",
|
|
"ScrollScreen",
|
|
"SelectScreen",
|
|
"Choice",
|
|
"Separator",
|
|
"TextScreen",
|
|
"ConfirmScreen",
|
|
"AutocompleteScreen",
|
|
"ProgressScreen",
|
|
"CANCEL",
|
|
]
|