Load preferences from the saved file and apply them to the window.
(self)
| 82 | pass |
| 83 | |
| 84 | def _load_preferences(self): |
| 85 | """Load preferences from the saved file and apply them to the window.""" |
| 86 | try: |
| 87 | from .preferences_dialog import PreferencesDialog |
| 88 | |
| 89 | temp_dialog = PreferencesDialog(self) |
| 90 | prefs = temp_dialog.get_preferences() |
| 91 | temp_dialog.destroy() |
| 92 | |
| 93 | if prefs.get("editor_font_size"): |
| 94 | self._editor_font_size = int(prefs["editor_font_size"]) |
| 95 | if "prefer_dark_theme" in prefs: |
| 96 | self._prefer_dark_theme = bool(prefs["prefer_dark_theme"]) |
| 97 | if "raw_wrap_lines" in prefs: |
| 98 | self._raw_wrap_lines = bool(prefs["raw_wrap_lines"]) |
| 99 | |
| 100 | if hasattr(self, "_prefer_dark_theme") and self._prefer_dark_theme: |
| 101 | try: |
| 102 | from gi.repository import Adw |
| 103 | |
| 104 | style_manager = Adw.StyleManager.get_default() |
| 105 | style_manager.set_color_scheme(Adw.ColorScheme.FORCE_DARK) |
| 106 | except Exception: |
| 107 | pass |
| 108 | |
| 109 | except Exception: |
| 110 | self._editor_font_size = 12 |
| 111 | self._prefer_dark_theme = False |
| 112 | self._raw_wrap_lines = False |
| 113 | |
| 114 | def show_toast(self, message: str): |
| 115 | """Show a transient toast using Adw.ToastOverlay.""" |
no test coverage detected