Skip to content

feat: Schreibstil-Presets ins Tray-Dropdown integrieren (Paket F) - #13

Merged
TimInTech merged 2 commits into
mainfrom
feat/paket-f-preset-submenu
Jun 20, 2026
Merged

feat: Schreibstil-Presets ins Tray-Dropdown integrieren (Paket F)#13
TimInTech merged 2 commits into
mainfrom
feat/paket-f-preset-submenu

Conversation

@TimInTech

Copy link
Copy Markdown
Owner

Ü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 Pipeline config → _build_llm_service → rewrite ist unverändert. Settings-Dialog und Tray-Menü bleiben synchron.

Änderungen

app/blitztext_linux.py

  • Neues Submenu „✨ Schreibstil-Vorlage" mit exklusiver QActionGroup (checkable Radio-Items), gespeist aus WRITING_PRESET_KEYS, platziert unter action_improver.
  • Handler _on_writing_preset_selected(key): No-Op-Guard bei gleichem Preset → config.writing_preset setzen → config.save()LLMService neu bauen → update_menu_availability().
  • Gemeinsamer Helper _refresh_preset_menu() hält Häkchen und config.writing_preset synchron (Init und nach Settings-Save), inkl. Fallback auf standard bei verwaistem Config-Wert.
  • update_menu_availability(): Submenu wird an LLMService.is_available() gekoppelt deaktiviert (Vorlage wirkt nur auf Blitztext+).

tests/test_tray_preset_menu.py (neu, GUI-gated über WHISPER_GUI_TESTS=1)

  • Auswahl persistiert Preset + baut Service neu
  • No-Op bei gleichem Preset (kein Disk-Write)
  • Menü spiegelt Config (Häkchen)
  • Fallback auf standard bei unbekanntem Wert
  • Settings-Save gleicht Häkchen an
  • Submenu deaktiviert/aktiviert je nach is_available()

Commits

  • e19278e — Basis: Submenu + Handler + Sync-Helper + 5 Tests
  • e759dd0 — Verfügbarkeitskopplung (Submenu deaktivieren ohne LLM) + 2 Tests

Testplan

  • QT_QPA_PLATFORM=offscreen WHISPER_GUI_TESTS=1 pytest tests/test_tray_preset_menu.py → 7 passed
  • Volle Suite pytest tests/229 passed
  • py_compile OK
  • CI grün (nach Push)
  • Manuell: Preset im Tray wechseln, Blitztext+ nutzt neuen Stil; bei fehlendem LLM-Key ist das Submenu ausgegraut

🤖 Generated with Claude Code

TimInTech and others added 2 commits June 20, 2026 02:07
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
@TimInTech
TimInTech merged commit a154965 into main Jun 20, 2026
7 checks passed
@TimInTech
TimInTech deleted the feat/paket-f-preset-submenu branch June 20, 2026 00:18

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread app/blitztext_linux.py
if key == self.config.writing_preset:
return
self.config.writing_preset = key
self.config.save()

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant