MCPcopy Index your code
hub / github.com/dialect-app/dialect / setup

Method setup

dialect/window.py:207–248  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

205 self.add_action(translation_action)
206
207 def setup(self):
208 self.set_default_icon_name(APP_ID)
209
210 # Set devel style
211 if PROFILE == "Devel":
212 self.add_css_class("devel")
213
214 # Theme Switcher
215 theme_switcher = ThemeSwitcher()
216 menu: Gtk.PopoverMenu = self.menu_btn.props.popover # type: ignore
217 menu.add_child(theme_switcher, "theme")
218
219 # Save settings on close
220 self.connect("unrealize", self.save_settings)
221
222 self.setup_selectors()
223 self.setup_translation()
224 self.setup_spell_checking()
225 self.set_help_overlay(DialectShortcutsWindow())
226
227 # Load translator
228 self.load_translator()
229 # Load text to speech
230 self.load_tts()
231
232 # Listen to active providers changes
233 Settings.get().connect("provider-changed", self._on_active_provider_changed)
234
235 # Bind text views font size
236 self.src_text.bind_property("font-size", self.dest_text, "font-size", GObject.BindingFlags.BIDIRECTIONAL)
237
238 # Set initial saved text view font size
239 if Settings.get().custom_default_font_size:
240 font_size = Settings.get().default_font_size
241 self.set_font_size(font_size)
242
243 # Set src textview mod key requirement
244 self.src_text.activate_mod = not bool(Settings.get().translate_accel_value)
245 Settings.get().connect(
246 "changed::translate-accel",
247 lambda s, _k: self.src_text.set_property("activate_mod", not bool(s.translate_accel_value)),
248 )
249
250 def setup_spell_checking(self):
251 # Enable spell-checking

Callers 1

__init__Method · 0.95

Calls 9

setup_selectorsMethod · 0.95
setup_translationMethod · 0.95
setup_spell_checkingMethod · 0.95
load_translatorMethod · 0.95
load_ttsMethod · 0.95
set_font_sizeMethod · 0.95
ThemeSwitcherClass · 0.90
getMethod · 0.45

Tested by

no test coverage detected