MCPcopy Create free account
hub / github.com/BuddySirJava/SSH-Studio / _load_preferences

Method _load_preferences

src/ui/main_window.py:84–112  ·  view source on GitHub ↗

Load preferences from the saved file and apply them to the window.

(self)

Source from the content-addressed store, hash-verified

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

Callers 1

__init__Method · 0.95

Calls 2

get_preferencesMethod · 0.95
PreferencesDialogClass · 0.85

Tested by

no test coverage detected