3838from app .transcribe import transcribe , TranscribeError
3939from app .paste_service import PasteService , PasteServiceError
4040from app .history_panel import HistoryPanel
41+ from app .compose_window import ComposeWindow
4142from app .tts_window import TtsWindow
4243from app .main_window import MainWindow
4344from app .i18n import LANGUAGES , LANGUAGE_DISPLAY_NAMES , set_language , t
@@ -615,6 +616,7 @@ def __init__(self, app: QApplication) -> None:
615616 # Diktat-/Verlauf-/TTS-Zustand
616617 self ._dictation_mode = False
617618 self ._history_panel : Optional [HistoryPanel ] = None
619+ self ._compose_window : Optional [ComposeWindow ] = None
618620 self ._tts_window : Optional [TtsWindow ] = None
619621 self ._main_window : Optional [MainWindow ] = None
620622
@@ -676,6 +678,9 @@ def setup_tray(self) -> None:
676678 self .action_show_window = QAction (f"🪟 { t ('tray.show_window' )} " , self )
677679 self .action_show_window .triggered .connect (self .show_main_window )
678680 self .menu .addAction (self .action_show_window )
681+ self .action_compose = QAction (f"✍ { t ('tray.compose' )} " , self )
682+ self .action_compose .triggered .connect (lambda _checked = False : self .show_compose_window ())
683+ self .menu .addAction (self .action_compose )
679684 self .menu .addSeparator ()
680685
681686 # Actions für die fünf Workflows
@@ -787,6 +792,8 @@ def _refresh_i18n_texts(self) -> None:
787792 self .app .setApplicationName (t ("app.name" ))
788793 if hasattr (self , "action_show_window" ):
789794 self .action_show_window .setText (f"🪟 { t ('tray.show_window' )} " )
795+ if hasattr (self , "action_compose" ):
796+ self .action_compose .setText (f"✍ { t ('tray.compose' )} " )
790797 if hasattr (self , "action_transcription" ):
791798 self .action_transcription .setText (f"{ t ('workflow.transcription.name' )} \t Meta+H" )
792799 if hasattr (self , "action_local" ):
@@ -805,6 +812,9 @@ def _refresh_i18n_texts(self) -> None:
805812 self ._refresh_preset_menu ()
806813 if self ._main_window is not None :
807814 self ._main_window .setWindowTitle (t ("app.name" ))
815+ compose_window = getattr (self , "_compose_window" , None )
816+ if compose_window is not None :
817+ compose_window .retranslate_ui ()
808818 self .update_tray_state ()
809819
810820 def _refresh_preset_menu (self ) -> None :
@@ -1091,6 +1101,25 @@ def show_tts_window(self) -> None:
10911101 self ._tts_window .raise_ ()
10921102 self ._tts_window .activateWindow ()
10931103
1104+ def _ensure_compose_window (self ) -> ComposeWindow :
1105+ if self ._compose_window is None :
1106+ window = ComposeWindow (self .llm_service , self .paste_service )
1107+ try :
1108+ from app import theme
1109+ window .setWindowIcon (theme .create_app_icon ())
1110+ except Exception : # pragma: no cover - rein kosmetisch
1111+ pass
1112+ self ._compose_window = window
1113+ return self ._compose_window
1114+
1115+ def show_compose_window (self , text : str = "" ) -> None :
1116+ window = self ._ensure_compose_window ()
1117+ if text :
1118+ window .set_input_text (text )
1119+ window .show ()
1120+ window .raise_ ()
1121+ window .activateWindow ()
1122+
10941123 def _on_tts_closed (self , _result : int ) -> None :
10951124 self ._tts_window = None
10961125
@@ -1203,6 +1232,8 @@ def quit_app(self) -> None:
12031232 if self ._history_panel is not None :
12041233 self ._history_panel .close ()
12051234 self ._history_panel = None
1235+ if self ._compose_window is not None :
1236+ self ._compose_window .close ()
12061237 if self ._main_window is not None :
12071238 self ._main_window .hide ()
12081239 self ._main_window = None
0 commit comments