aboutsummaryrefslogtreecommitdiff
path: root/app/ui/tui.py
diff options
context:
space:
mode:
authorhistoria <historiavg@proton.me>2026-08-24 03:22:29 -0400
committerhistoria <historiavg@proton.me>2026-08-24 03:22:29 -0400
commit471798cf5e967b2d1bceb02d12a47fe9ad1cbed1 (patch)
treeb974708bb60424fa5d39825e54813ed133bccc42 /app/ui/tui.py
parent8e54a42db2690e0ac7f09fd400b29ad2fb2c9c5a (diff)
downloadtts-audiobook-generator-471798cf5e967b2d1bceb02d12a47fe9ad1cbed1.tar.gz
feat: tui ffmpeg check
Diffstat (limited to 'app/ui/tui.py')
-rw-r--r--app/ui/tui.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/app/ui/tui.py b/app/ui/tui.py
index 9047f36..c3d79f6 100644
--- a/app/ui/tui.py
+++ b/app/ui/tui.py
@@ -611,7 +611,8 @@ def menu(scr, title: str, options: Sequence[tuple], default_index: int = 0,
help_lines: Optional[Sequence[str]] = None,
back_value: object = None,
table_title: Optional[str] = None,
- table_rows: Optional[Sequence[tuple]] = None):
+ table_rows: Optional[Sequence[tuple]] = None,
+ notice_lines: Optional[Sequence[Tuple[str, str]]] = None):
"""Show OPTIONS as (label, value) pairs; return the chosen value.
The cursor starts on DEFAULT_INDEX; Enter returns the highlighted
@@ -628,6 +629,11 @@ def menu(scr, title: str, options: Sequence[tuple], default_index: int = 0,
hub to show each backend's state (unavailable / installed / running)
in matching columns with color.
+ NOTICE_LINES render above the table (and after HELP_LINES): each
+ entry is (text, kind) where KIND is a theme key, so the hub can warn
+ in red (e.g. "Warning: ffmpeg not installed!") without polluting the
+ status table.
+
Esc (or 'q') aborts the wizard unless BACK_VALUE is given (not None),
in which case Esc returns it so the caller can fall back a screen.
"""
@@ -642,6 +648,12 @@ def menu(scr, title: str, options: Sequence[tuple], default_index: int = 0,
frame.mark(line, frame.theme["dim"])
if help_lines:
frame.mark("")
+ if notice_lines:
+ for text, kind in notice_lines:
+ frame.mark(text,
+ frame.theme.get(kind, frame.theme["body"]),
+ align="left")
+ frame.mark("")
if table_rows:
if table_title:
frame.mark(table_title, frame.theme["dim"], align="left")