diff options
Diffstat (limited to 'app/backends/__init__.py')
| -rw-r--r-- | app/backends/__init__.py | 24 |
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: |
