aboutsummaryrefslogtreecommitdiff
path: root/app/backends/__init__.py
diff options
context:
space:
mode:
authorhistoria <historiavg@proton.me>2026-08-24 20:17:11 -0400
committerhistoria <historiavg@proton.me>2026-08-24 20:17:11 -0400
commitcf24fa74188cee498eeb7b94422371c952278d4a (patch)
tree302244a8b09b9173fbde542874cfa549f26be7a2 /app/backends/__init__.py
parent0522e73b68291af62e43c387ab8f9b8ffa2cab47 (diff)
downloadtts-audiobook-generator-cf24fa74188cee498eeb7b94422371c952278d4a.tar.gz
fix: stepping back steps in tui
Diffstat (limited to 'app/backends/__init__.py')
-rw-r--r--app/backends/__init__.py24
1 files changed, 16 insertions, 8 deletions
diff --git a/app/backends/__init__.py b/app/backends/__init__.py
index 3dff306..ef713ba 100644
--- a/app/backends/__init__.py
+++ b/app/backends/__init__.py
@@ -16,9 +16,12 @@ importing them. ``backends.envs`` is imported during that bootstrap, so
importing this package must stay cheap and dependency-free.
Adding a backend: create ``backends/<name>.py`` exposing
-``detect() -> BackendStatus``, ``run_tui() -> int`` and
-``uninstall() -> int``, then append a ``BackendInfo`` in ``_build_registry``
-below. ``audiobook.py`` and the hub pick it up automatically.
+``detect() -> BackendStatus``, ``setup_screen(stdscr) -> int`` (the setup
+wizard run on the hub's own screen) and ``uninstall() -> int``, then append
+a ``BackendInfo`` in ``_build_registry`` below. ``audiobook.py`` and the hub
+pick it up automatically. A backend's standalone CLI keeps its own
+``run_tui()`` entry (its own curses session), which is not part of the
+registry.
"""
import shlex
@@ -131,11 +134,16 @@ def format_launch_hint(servers: List[ServerSpec]) -> str:
@dataclass
class BackendInfo:
- """One registry entry: identity, detector, setup wizard, uninstaller."""
+ """One registry entry: identity, detector, setup wizard, uninstaller.
+
+ SETUP_SCREEN runs the setup wizard on an already-open curses screen
+ (the hub's), returning 0 on completion and non-zero when aborted; the
+ hub calls it as one screen of its own ``tui.Wizard`` stack.
+ """
key: str
label: str
detect: Callable[[], BackendStatus]
- setup_tui: Callable[[], int]
+ setup_screen: Callable[[object], int]
uninstall: Callable[[], int] = lambda: 0
@@ -153,21 +161,21 @@ def _build_registry() -> None:
key="audiocpp",
label="audio.cpp",
detect=audiocpp.detect,
- setup_tui=audiocpp.run_tui,
+ setup_screen=audiocpp.setup_screen,
uninstall=audiocpp.uninstall,
))
REGISTRY.append(BackendInfo(
key="qwen",
label="qwen-tts",
detect=qwen.detect,
- setup_tui=qwen.run_tui,
+ setup_screen=qwen.setup_screen,
uninstall=qwen.uninstall,
))
REGISTRY.append(BackendInfo(
key="faster",
label="faster-qwen3-tts",
detect=faster.detect,
- setup_tui=faster.run_tui,
+ setup_screen=faster.setup_screen,
uninstall=faster.uninstall,
))
for info in REGISTRY: