diff options
| author | historia <historiavg@proton.me> | 2026-08-25 20:48:51 -0400 |
|---|---|---|
| committer | historia <historiavg@proton.me> | 2026-08-25 20:48:51 -0400 |
| commit | d453d88d1d40c5e54af07ceb89c8c18d09cfdb0e (patch) | |
| tree | aaf99573d0380c57174ca1ec5437e09e26fece37 /app/ui | |
| parent | f3f7bb98e4bc969a17fba71294177819fbbbd070 (diff) | |
| download | tts-audiobook-generator-d453d88d1d40c5e54af07ceb89c8c18d09cfdb0e.tar.gz | |
feat: default save and exit server setting
Diffstat (limited to 'app/ui')
| -rw-r--r-- | app/ui/hub.py | 9 | ||||
| -rw-r--r-- | app/ui/runview.py | 6 |
2 files changed, 9 insertions, 6 deletions
diff --git a/app/ui/hub.py b/app/ui/hub.py index 1eef63b..cad9a9d 100644 --- a/app/ui/hub.py +++ b/app/ui/hub.py @@ -366,7 +366,7 @@ class _Hub: if not ok: return tui.Wizard.BACK if self._run_conversion(cmd[1], cmd[2]): - # "Stop server and exit after generating" was on: returning + # "Stop server and exit" was on: returning # None ends the wizard stack (the whole TUI). return None return tui.Wizard.BACK @@ -850,8 +850,8 @@ def _common_fields() -> list: "kind": "bool", "value": False, "visible": lambda fs: _field_value(fs, "output_format") != "m4b"}, {"key": "debug", "label": "Debug", "kind": "bool", "value": False}, - {"key": "stop_and_exit", "label": "Stop server and exit after " - "generating", "kind": "bool", "value": True}, + {"key": "stop_and_exit", "label": "Stop server and exit", + "kind": "bool", "value": config.STOP_SERVER_AND_EXIT}, ] @@ -1203,6 +1203,8 @@ def _settings_fields() -> list: "value": config.LANGUAGE, "validate": _validate_language}, {"key": "chunk_size", "label": "Chunk size (words)", "kind": "text", "value": str(config.CHUNK_SIZE), "validate": _validate_chunk_size}, + {"key": "stop_and_exit", "label": "Default stop server and exit", + "kind": "bool", "value": config.STOP_SERVER_AND_EXIT}, {"key": "unload_models", "label": "Unload models", "kind": "bool", "value": config.AUDIOCPP_UNLOAD_MODELS, "note": "audio.cpp: Unload previously-loaded models before converting to prevent VRAM exhaustion."}, @@ -1330,6 +1332,7 @@ def _apply_settings(values: dict) -> None: "AUDIO_BITRATE": bitrate, "LANGUAGE": normalize_language(values["language"]), "CHUNK_SIZE": chunk_size, + "STOP_SERVER_AND_EXIT": bool(values["stop_and_exit"]), "AUDIOCPP_UNLOAD_MODELS": bool(values["unload_models"]), "QWEN_API_URL": common.url_with_port( config.QWEN_API_URL, ports["qwen_custom_port"]), diff --git a/app/ui/runview.py b/app/ui/runview.py index eb385f0..60c43b0 100644 --- a/app/ui/runview.py +++ b/app/ui/runview.py @@ -19,7 +19,7 @@ The screen is fed by two threads the widget spawns: Esc and 'q' do the same thing everywhere: a confirmation to cancel processing, then (when this run started the server) a confirmation to shut it down. On the finished screen the behavior follows the convert form's -"Stop server and exit after generating" toggle: ON stops the server +"Stop server and exit" toggle: ON stops the server automatically, quits the whole TUI, and prints the results summary to the real terminal after curses closes; OFF waits for a key press and returns to the hub menu with the server still running. Errors (the server exits @@ -308,7 +308,7 @@ class RunView: """Run the view until the user leaves the terminal screen. Returns True only when the run should end with the whole TUI - quitting — the "Stop server and exit after generating" path, which + quitting — the "Stop server and exit" path, which stops the server automatically and records the results as a post-TUI notice. Every other exit (a key press on the summary screen, the Esc cancel flow) lands back on the hub menu. @@ -449,7 +449,7 @@ class RunView: self.render() def _auto_stop_and_exit(self) -> bool: - """The "Stop server and exit after generating" path. + """The "Stop server and exit" path. No prompts and no key waits: stop the managed server this run started (if any), record the results summary as a post-TUI notice |
