aboutsummaryrefslogtreecommitdiff
path: root/app/ui
diff options
context:
space:
mode:
Diffstat (limited to 'app/ui')
-rw-r--r--app/ui/hub.py73
1 files changed, 29 insertions, 44 deletions
diff --git a/app/ui/hub.py b/app/ui/hub.py
index 67680db..f9151f8 100644
--- a/app/ui/hub.py
+++ b/app/ui/hub.py
@@ -226,7 +226,8 @@ class _Hub:
if any(_updatable(info, by_key) for info in REGISTRY):
options.append(("Update Backends", "update"))
if selfupdate.is_git_checkout():
- options.append(("Update Generator", "update_self"))
+ options.append(("Update tts-audiobook-generator",
+ "update_self"))
if any(_uninstallable(info, by_key) for info in REGISTRY):
options.append(("Uninstall Backend", "uninstall"))
@@ -234,8 +235,8 @@ class _Hub:
self.stdscr, "Configure Backends", options,
back_value=tui.Wizard.BACK,
help_lines=["Install, update, configure, or remove a TTS "
- "backend. 'Update Generator' refreshes this "
- "tool's own checkout instead."],
+ "backend. 'Update tts-audiobook-generator' "
+ "refreshes this tool's own checkout instead."],
table_rows=_status_rows(statuses),
notice_lines=_notice_lines())
if choice is tui.Wizard.BACK:
@@ -687,12 +688,12 @@ def _download_models_action(stdscr) -> None:
Computes the missing models; when they map to install commands it runs
the downloads in the task view (with real byte progress and cancellation)
- instead of dropping to the console — a successful run returns silently
- (the view already shows [OK] and waits for a key), and only a cancelled
- or failed run flashes. When the checkout/server.json is missing, nothing
- is missing, or the models do not map to an install command, it flashes
- an explanatory notice (the latter explaining how to install each model
- by hand).
+ instead of dropping to the console — the view shows the outcome and
+ waits for a key, so a successful or cancelled run returns silently and
+ only a failed run flashes. When the checkout/server.json is missing,
+ nothing is missing, or the models do not map to an install command, it
+ flashes an explanatory notice (the latter explaining how to install
+ each model by hand).
"""
checkout = audiocpp_backend.find_local_checkout()
if checkout is None:
@@ -723,10 +724,7 @@ def _download_models_action(stdscr) -> None:
rc = taskview.run_steps(stdscr, "Download models",
[taskview.TaskStep("Download missing models",
run)])
- if rc == 130:
- tui.flash(stdscr, "Model download cancelled — re-run it any time.",
- "warn")
- elif rc:
+ if rc not in (0, 130):
tui.flash(stdscr, "Some model downloads failed. Re-run 'Download "
"Missing Models' or install them by hand (see the log).",
"err")
@@ -741,9 +739,9 @@ def _update_backends_action(stdscr) -> None:
git fetch + hard reset for the checkouts, with audio.cpp's binary
rebuilt when its checkout moved. A failing backend's step is marked
[FAIL] and the remaining backends still update (the run's exit code
- is the first failure). A successful run returns silently (the view
- already shows [OK] and waits for a key); only a cancelled or failed
- run flashes. The status table re-detects when the menu re-shows.
+ is the first failure). Successful and cancelled runs return silently
+ (the view already shows the outcome and waits for a key); only a
+ failed run flashes. The status table re-detects when the menu re-shows.
"""
statuses = detect_all()
by_key = {st.key: st for st in statuses}
@@ -760,17 +758,14 @@ def _update_backends_action(stdscr) -> None:
steps = [taskview.TaskStep(f"Update {info.label}", make_work(info))
for info in targets]
rc = taskview.run_steps(stdscr, "Update Backends", steps)
- if rc == 130:
- tui.flash(stdscr, "Update cancelled — re-run 'Update Backends' "
- "any time.", "warn")
- elif rc:
+ if rc not in (0, 130):
tui.flash(stdscr, "Some updates did not complete (failed or "
"cancelled) — see the log above. Re-run 'Update "
"Backends' to retry.", "err")
def _update_self_action(stdscr) -> None:
- """Run the "Update Generator" action inside the TUI.
+ """Run the "Update tts-audiobook-generator" action inside the TUI.
Moves the generator's own git checkout to the remote's default-branch
HEAD (fetch + hard reset — the same flow the backend checkouts use).
@@ -781,17 +776,17 @@ def _update_self_action(stdscr) -> None:
and written back afterwards (a kept file whose upstream version
changed is reported for a manual merge). A dirty checkout confirms
first (declining, Esc included, aborts before anything runs); the run
- itself streams in the task view like the other inline actions. After:
- a successful run flashes the moved commit range (or "already up to
- date") plus the restart reminder — the fresh code loads on relaunch,
- where requirements re-install runs automatically — while cancel and
- failure flash their usual warn/err. The menu re-shows either way.
+ itself streams in the task view like the other inline actions, whose
+ outcome summary the user dismisses with a key — so a successful run
+ (including a no-op "already up to date" one) flashes nothing, and the
+ restart reminder is part of the run's own console output (update_generator
+ emits it after the reset). Only a failed run flashes; the menu re-shows
+ either way.
"""
if not selfupdate.is_git_checkout():
tui.flash(stdscr, "This install is not a git checkout — update by "
"re-cloning the repository.", "err")
return
- before = selfupdate.current_commit()
modified = selfupdate.modified_tracked_files()
if modified:
body = ["These locally modified files are kept as they are:",
@@ -799,30 +794,20 @@ def _update_self_action(stdscr) -> None:
body += modified[:6]
if len(modified) > 6:
body.append(f"...and {len(modified) - 6} more")
- if tui.confirm(stdscr, "Update the generator?", body=body,
- default=False, cancel_value=False) is not True:
+ if tui.confirm(stdscr, "Update tts-audiobook-generator?",
+ body=body, default=False,
+ cancel_value=False) is not True:
return
def work(emit, cancel):
return selfupdate.update_generator(emit=emit, cancel=cancel)
rc = taskview.run_steps(
- stdscr, "Update Generator",
+ stdscr, "Update tts-audiobook-generator",
[taskview.TaskStep("Fetch and reset the checkout", work)])
- after = selfupdate.current_commit()
- if rc == 130:
- tui.flash(stdscr, "Update cancelled — re-run 'Update Generator' "
- "any time.", "warn")
- elif rc:
- tui.flash(stdscr, "The generator update did not complete — see the "
- "log above and retry.", "err")
- elif before is not None and before == after:
- tui.flash(stdscr, f"The generator is already up to date ({before}).",
- "ok")
- else:
- tui.flash(stdscr, f"Generator updated {before or '?'} → {after}. "
- "Restart to apply — requirements re-install runs "
- "automatically on next launch.", "ok")
+ if rc not in (0, 130):
+ tui.flash(stdscr, "The tts-audiobook-generator update did not "
+ "complete — see the log above and retry.", "err")
def _status_mark(status: Optional[BackendStatus]) -> Tuple[str, str, str]: