feat: Schreibstil-Presets ins Tray-Dropdown integrieren (Paket F) - #13
Conversation
Ergaenzt das in e19278e eingefuehrte Tray-Submenu "Schreibstil-Vorlage" um die Verfuegbarkeitskopplung: update_menu_availability deaktiviert das Submenu zusammen mit den LLM-Workflows (Blitztext+/$%&!/:)), da die Schreibstil-Vorlage nur den Text-Verbesserer beeinflusst. - app/blitztext_linux.py: menu_preset.setEnabled(available). - tests/test_tray_preset_menu.py: +2 Faelle (disabled/enabled je nach is_available), jetzt 7 Tests; volle Suite 229 gruen. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019c7crwbrY9q5pUeZxAEMBg
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e759dd019c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if key == self.config.writing_preset: | ||
| return | ||
| self.config.writing_preset = key | ||
| self.config.save() |
There was a problem hiding this comment.
Handle tray preset save failures
When the config directory is unwritable or the atomic write fails, Config.save() raises from this QAction slot after the QAction has already become checked but before the LLM service is rebuilt. In that environment the tray can show a newly selected preset that was neither persisted nor applied, with only an uncaught Qt-slot exception instead of the error handling used by the settings dialog; catch the save error and refresh/revert the menu state or notify the user.
Useful? React with 👍 / 👎.
Überblick
Macht die sieben Schreibstil-Vorlagen direkt im Tray-Kontextmenü (dem „Haupt-Dropdown") auswählbar, ohne die Einstellungen öffnen zu müssen. Die Auswahl gilt für Blitztext+ (Text-Verbesserer).
Single Source of Truth bleibt
config.writing_preset; die bestehende Pipelineconfig → _build_llm_service → rewriteist unverändert. Settings-Dialog und Tray-Menü bleiben synchron.Änderungen
app/blitztext_linux.pyQActionGroup(checkable Radio-Items), gespeist ausWRITING_PRESET_KEYS, platziert unteraction_improver._on_writing_preset_selected(key): No-Op-Guard bei gleichem Preset →config.writing_presetsetzen →config.save()→LLMServiceneu bauen →update_menu_availability()._refresh_preset_menu()hält Häkchen undconfig.writing_presetsynchron (Init und nach Settings-Save), inkl. Fallback aufstandardbei verwaistem Config-Wert.update_menu_availability(): Submenu wird anLLMService.is_available()gekoppelt deaktiviert (Vorlage wirkt nur auf Blitztext+).tests/test_tray_preset_menu.py(neu, GUI-gated überWHISPER_GUI_TESTS=1)standardbei unbekanntem Wertis_available()Commits
e19278e— Basis: Submenu + Handler + Sync-Helper + 5 Testse759dd0— Verfügbarkeitskopplung (Submenu deaktivieren ohne LLM) + 2 TestsTestplan
QT_QPA_PLATFORM=offscreen WHISPER_GUI_TESTS=1 pytest tests/test_tray_preset_menu.py→ 7 passedpytest tests/→ 229 passedpy_compileOK🤖 Generated with Claude Code