aboutsummaryrefslogtreecommitdiff
path: root/app/ui/tui.py
diff options
context:
space:
mode:
authorhistoria <historiavg@proton.me>2026-09-02 01:26:09 -0400
committerhistoria <historiavg@proton.me>2026-09-02 01:26:09 -0400
commit8579517a35ef1865fc9b428899d73d52dcb27a14 (patch)
treedba52f8d99cfe4014e0b787367de99f238e5a0db /app/ui/tui.py
parent391f50da7a085bec75155c0eb9b47910266058cc (diff)
downloadtts-audiobook-generator-8579517a35ef1865fc9b428899d73d52dcb27a14.tar.gz
feat: sglang backend support
Diffstat (limited to 'app/ui/tui.py')
-rw-r--r--app/ui/tui.py14
1 files changed, 11 insertions, 3 deletions
diff --git a/app/ui/tui.py b/app/ui/tui.py
index 60a77dc..7d104a4 100644
--- a/app/ui/tui.py
+++ b/app/ui/tui.py
@@ -1459,7 +1459,8 @@ def checkbox_tree(scr, title: str, families: List[dict],
expand_all: bool = False,
back_value: object = None,
checked: Optional[set] = None,
- start_on_buttons: bool = False) -> List[Tuple[int, str]]:
+ start_on_buttons: bool = False,
+ allow_empty: bool = False) -> List[Tuple[int, str]]:
"""Pick model families and packages from an expandable tree.
FAMILIES is a list of dicts (one per family) shaped like::
@@ -1489,6 +1490,10 @@ def checkbox_tree(scr, title: str, families: List[dict],
family — the "modify an existing config" entry point.
START_ON_BUTTONS puts the initial focus on Confirm, so Enter accepts
the tree as it stands (the seeded modify selection) immediately.
+ ALLOW_EMPTY lets Confirm accept a selection with nothing checked
+ (returning []) — for pickers where unchecking means removing, a
+ fully-unchecked tree is a meaningful answer; the default keeps the
+ "Check at least one model package" flash.
A "[recommended]" tag is shown only when a family has more than one
option — a single option needs no tag.
Family and option rows are left-justified like a DOS list. Esc (or
@@ -1575,7 +1580,10 @@ def checkbox_tree(scr, title: str, families: List[dict],
frame.status = None
else:
node = nodes[cursor]
- frame.status = (families[node[1]].get("detail", ""), "info")
+ detail = families[node[1]].get("detail", "")
+ # A family without a detail draws no status line at all
+ # (an empty string would still occupy the row).
+ frame.status = (detail, "info") if detail else None
frame.draw()
curses = frame.curses
key = frame.get_key(cancel_keys=())
@@ -1595,7 +1603,7 @@ def checkbox_tree(scr, title: str, families: List[dict],
elif key in (10, 13):
if btn_index == 0: # Confirm
selection = accept()
- if selection:
+ if selection or allow_empty:
return selection
frame.flash("Check at least one model package", "err")
else: # Back