diff options
| author | historia <historiavg@proton.me> | 2026-08-26 18:18:21 -0400 |
|---|---|---|
| committer | historia <historiavg@proton.me> | 2026-08-26 18:18:21 -0400 |
| commit | 544486a374cd5cae7acce1302648d8dad079db48 (patch) | |
| tree | 5987cdb6790844252ec655465eacea8ae526e3a8 /app/ui | |
| parent | 6ccb6d443d2fb871b43d96ea61a95bc3e6a92355 (diff) | |
| download | tts-audiobook-generator-544486a374cd5cae7acce1302648d8dad079db48.tar.gz | |
fix: default directory when choosing voices in tui
Diffstat (limited to 'app/ui')
| -rw-r--r-- | app/ui/hub.py | 20 | ||||
| -rw-r--r-- | app/ui/tui.py | 11 |
2 files changed, 23 insertions, 8 deletions
diff --git a/app/ui/hub.py b/app/ui/hub.py index b41b369..6a82c83 100644 --- a/app/ui/hub.py +++ b/app/ui/hub.py @@ -150,9 +150,10 @@ class _Hub: no binary) or download its missing models (only once built, so build > configure > download — Build and Download never appear together) — heads the menu with a yellow ``[recommended]`` tag, - separated from the rest by a blank line. The remaining options are - populated from the detected statuses: configure each installed - backend, install (backends with nothing on disk), and uninstall. + separated from the rest by a blank line. remaining actions are populated from the detected statuses: + configure each configurable backend (qwen asks nothing to + configure, so it has no entry), install (backends with nothing on + disk), and uninstall. Selecting one pushes the next screen; Esc pops back to the main menu. The Build action downloads any missing models alongside the build (a split view), so it heals a configured-but-unbuilt backend @@ -197,7 +198,7 @@ class _Hub: options.append(tui.MENU_SEPARATOR) options += [(f"Configure {info.label}", ("configure", info.key)) - for info in installed] + for info in installed if _configurable(info)] if any(_installable(info, by_key) for info in REGISTRY): options.append(("Install Backend", "install")) if any(_uninstallable(info, by_key) for info in REGISTRY): @@ -573,6 +574,17 @@ def _server_action_step(spec, action: str): return taskview.TaskStep(title, work), log_path +def _configurable(info) -> bool: + """True when INFO has a setup wizard worth running to reconfigure. + + qwen-tts is excluded: its wizard asks no questions (ports live in the + Settings screen, the speaker is chosen per run on Generate audiobooks), + so a "Configure" entry could only ever flash "already installed". + Installing it stays possible via Install Backend. + """ + return info.key != "qwen" + + def _installable(info, by_key: dict) -> bool: """True when INFO has nothing on disk yet — an install-entry candidate. diff --git a/app/ui/tui.py b/app/ui/tui.py index cc21c0b..d91274b 100644 --- a/app/ui/tui.py +++ b/app/ui/tui.py @@ -1245,7 +1245,8 @@ def checkbox_tree(scr, title: str, families: List[dict], footer: Optional[str] = None, expand_all: bool = False, back_value: object = None, - checked: Optional[set] = None) -> List[Tuple[int, str]]: + checked: Optional[set] = None, + start_on_buttons: 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:: @@ -1272,8 +1273,10 @@ def checkbox_tree(scr, title: str, families: List[dict], family starts expanded. CHECKED (a set of (family_index, option_key) pairs) pre-checks those options instead, expanding every family that holds a checked option and placing the cursor on the first such - family — the "modify an existing config" entry point. A - "[recommended]" tag is shown only when a family has more than one + 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. + 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 'q') aborts the wizard unless BACK_VALUE is given (not None), in @@ -1312,7 +1315,7 @@ def checkbox_tree(scr, title: str, families: List[dict], first_checked = min((index for index, _option_key in checked), default=None) cursor = 0 - on_buttons = False + on_buttons = start_on_buttons btn_index = 0 while True: nodes = visible_nodes() |
