aboutsummaryrefslogtreecommitdiff
path: root/app/backends/faster.py
diff options
context:
space:
mode:
Diffstat (limited to 'app/backends/faster.py')
-rwxr-xr-xapp/backends/faster.py49
1 files changed, 10 insertions, 39 deletions
diff --git a/app/backends/faster.py b/app/backends/faster.py
index cec59a6..6e2735c 100755
--- a/app/backends/faster.py
+++ b/app/backends/faster.py
@@ -39,6 +39,7 @@ from backends import (
format_launch_hint,
probe,
servers,
+ setup,
)
from backends.common import (
APP_DIR,
@@ -447,40 +448,21 @@ def _print_launch_hint(voices_path: Path, port: int) -> None:
def setup_screen(stdscr) -> int:
"""Run the setup wizard on an existing curses screen (the hub's).
- The hub drives this as one screen of its own ``tui.Wizard`` stack, so
- Esc on the wizard's first screen simply returns here and the hub pops
- back to the menu that launched it. The setup tail (install/clone/
- transcribe/write) runs inside the TUI task view on this same screen, so
- the hub's curses session stays intact and the user sees per-step status
- instead of being dropped to the console. Returns 0 on completion, 1 when
- the user aborted.
+ See backends.setup.screen_flow for the shared flow. Returns 0 on
+ completion, 1 when the user aborted.
"""
- args = build_parser().parse_args([])
- settings = _wizard(stdscr, args)
- if settings is None:
- return 1
- return taskview.run_steps(stdscr, "Setting up faster-qwen3-tts",
- _execute_steps(settings))
+ return setup.screen_flow(stdscr, wizard=_wizard,
+ steps_of=_execute_steps,
+ title="Setting up faster-qwen3-tts",
+ parser_factory=build_parser)
def run_tui(args: Optional[argparse.Namespace] = None) -> int:
"""Run the faster setup wizard end-to-end."""
- import curses
if args is None:
args = build_parser().parse_args([])
- try:
- settings = curses.wrapper(_wizard, args)
- except tui.WizardCancelled:
- print("\n[INFO] Cancelled; nothing was written")
- return 1
- try:
- curses.curs_set(1)
- except curses.error:
- pass
- if settings is None:
- print("[INFO] Aborted")
- return 1
- return _execute(settings)
+ return setup.tui_flow(_wizard, _execute, args=args,
+ aborted_message="[INFO] Aborted")
def _collect_from_flags(args: argparse.Namespace,
@@ -646,7 +628,7 @@ def main() -> int:
parser = build_parser()
args = parser.parse_args()
- if _interactive():
+ if setup.interactive():
return run_tui(args)
settings = _collect_from_flags(args, parser)
@@ -655,16 +637,5 @@ def main() -> int:
return _execute(settings)
-def _interactive() -> bool:
- try:
- import curses # noqa: F401
- except ImportError:
- return False
- try:
- return sys.stdin.isatty() and sys.stdout.isatty()
- except (AttributeError, ValueError):
- return False
-
-
if __name__ == "__main__":
sys.exit(main())