MCPcopy Create free account
hub / github.com/CJackHwang/AIstudioProxyAPI / __init__

Method __init__

gui/widgets.py:341–376  ·  view source on GitHub ↗

Initialize the settings panel. Args: master: Parent widget env_manager: EnvManager instance on_save: Callback when settings are saved on_change: Callback when dirty state changes (receives is_dirty)

(
        self,
        master: Any,
        env_manager: Any,
        on_save: Optional[Callable[[], None]] = None,
        on_change: Optional[Callable[[bool], None]] = None,
        **kwargs,
    )

Source from the content-addressed store, hash-verified

339 """
340
341 def __init__(
342 self,
343 master: Any,
344 env_manager: Any,
345 on_save: Optional[Callable[[], None]] = None,
346 on_change: Optional[Callable[[bool], None]] = None,
347 **kwargs,
348 ):
349 """
350 Initialize the settings panel.
351
352 Args:
353 master: Parent widget
354 env_manager: EnvManager instance
355 on_save: Callback when settings are saved
356 on_change: Callback when dirty state changes (receives is_dirty)
357 """
358 # Set default colors for proper theming
359 kwargs.setdefault("fg_color", COLORS["bg_dark"])
360 kwargs.setdefault("scrollbar_fg_color", COLORS["bg_medium"])
361 kwargs.setdefault("scrollbar_button_color", COLORS["border"])
362 kwargs.setdefault("scrollbar_button_hover_color", COLORS["accent"])
363 super().__init__(master, **kwargs)
364
365 self._env_manager = env_manager
366 self._on_save = on_save
367 self._on_change = on_change
368 self._setting_rows: Dict[str, CTkSettingRow] = {}
369 self._category_frames: Dict[str, CTkCollapsibleFrame] = {}
370 self._is_dirty = False
371
372 # Build the UI
373 self._build_settings_ui()
374
375 # Enable mouse wheel scrolling
376 self._bind_scroll_events()
377
378 def _build_settings_ui(self) -> None:
379 """Build the settings UI with collapsible categories."""

Callers

nothing calls this directly

Calls 3

_build_settings_uiMethod · 0.95
_bind_scroll_eventsMethod · 0.95
__init__Method · 0.45

Tested by

no test coverage detected