| 43 | |
| 44 | @Gtk.Template(resource_path=f"{RES_PATH}/window.ui") |
| 45 | class DialectWindow(Adw.ApplicationWindow): |
| 46 | __gtype_name__ = "DialectWindow" |
| 47 | |
| 48 | # Properties |
| 49 | translator_loading: bool = GObject.Property(type=bool, default=True) # type: ignore |
| 50 | selection_translation_queued: bool = GObject.Property(type=bool, default=False) # type: ignore |
| 51 | |
| 52 | # Child widgets |
| 53 | menu_btn: Gtk.MenuButton = Gtk.Template.Child() # type: ignore |
| 54 | main_stack: Gtk.Stack = Gtk.Template.Child() # type: ignore |
| 55 | error_page: Adw.StatusPage = Gtk.Template.Child() # type: ignore |
| 56 | translator_box: Gtk.Box = Gtk.Template.Child() # type: ignore |
| 57 | key_page: Adw.StatusPage = Gtk.Template.Child() # type: ignore |
| 58 | rmv_key_btn: Gtk.Button = Gtk.Template.Child() # type: ignore |
| 59 | |
| 60 | langs_button_box: Gtk.Box = Gtk.Template.Child() # type: ignore |
| 61 | switch_btn: Gtk.Button = Gtk.Template.Child() # type: ignore |
| 62 | src_lang_selector: LangSelector = Gtk.Template.Child() # type: ignore |
| 63 | dest_lang_selector: LangSelector = Gtk.Template.Child() # type: ignore |
| 64 | |
| 65 | return_btn: Gtk.Button = Gtk.Template.Child() # type: ignore |
| 66 | forward_btn: Gtk.Button = Gtk.Template.Child() # type: ignore |
| 67 | |
| 68 | src_pron_revealer: Gtk.Revealer = Gtk.Template.Child() # type: ignore |
| 69 | src_pron_label: Gtk.Label = Gtk.Template.Child() # type: ignore |
| 70 | mistakes: Gtk.Revealer = Gtk.Template.Child() # type: ignore |
| 71 | mistakes_label: Gtk.Label = Gtk.Template.Child() # type: ignore |
| 72 | char_counter: Gtk.Label = Gtk.Template.Child() # type: ignore |
| 73 | src_text: TextView = Gtk.Template.Child() # type: ignore |
| 74 | clear_btn: Gtk.Button = Gtk.Template.Child() # type: ignore |
| 75 | paste_btn: Gtk.Button = Gtk.Template.Child() # type: ignore |
| 76 | src_speech_btn: SpeechButton = Gtk.Template.Child() # type: ignore |
| 77 | translate_btn: Gtk.Button = Gtk.Template.Child() # type: ignore |
| 78 | |
| 79 | dest_box: Gtk.Box = Gtk.Template.Child() # type: ignore |
| 80 | dest_pron_revealer: Gtk.Revealer = Gtk.Template.Child() # type: ignore |
| 81 | dest_pron_label: Gtk.Label = Gtk.Template.Child() # type: ignore |
| 82 | dest_text: TextView = Gtk.Template.Child() # type: ignore |
| 83 | dest_toolbar_stack: Gtk.Stack = Gtk.Template.Child() # type: ignore |
| 84 | trans_spinner: Adw.Spinner = Gtk.Template.Child() # type: ignore |
| 85 | trans_warning: Gtk.Image = Gtk.Template.Child() # type: ignore |
| 86 | edit_btn: Gtk.Button = Gtk.Template.Child() # type: ignore |
| 87 | copy_btn: Gtk.Button = Gtk.Template.Child() # type: ignore |
| 88 | dest_speech_btn: SpeechButton = Gtk.Template.Child() # type: ignore |
| 89 | |
| 90 | toast: Adw.Toast | None = None # for notification management |
| 91 | toast_overlay: Adw.ToastOverlay = Gtk.Template.Child() # type: ignore |
| 92 | |
| 93 | win_key_ctrlr: Gtk.EventControllerKey = Gtk.Template.Child() # type: ignore |
| 94 | |
| 95 | # Providers objects |
| 96 | provider: dict[str, BaseProvider | None] = {"trans": None, "tts": None} |
| 97 | |
| 98 | # Text to speech |
| 99 | speech_provider_failed = False # tts provider loading failed |
| 100 | current_speech: _OngoingSpeech | None = None |
| 101 | speech_loading = False # tts loading status |
| 102 | |