Skip to content

feat(gui): add advanced settings UI with expandable sections and scroll support#20

Merged
MasuRii merged 10 commits intomainfrom
feature/advanced-settings-ui
Jan 21, 2026
Merged

feat(gui): add advanced settings UI with expandable sections and scroll support#20
MasuRii merged 10 commits intomainfrom
feature/advanced-settings-ui

Conversation

@MasuRii
Copy link
Owner

@MasuRii MasuRii commented Jan 21, 2026

Summary

This PR introduces an advanced settings UI with expandable sections, mouse wheel and trackpad scroll support, and improved dark mode handling. It also adds the EnvManager for .env file management and comprehensive unit tests.

Changes

  • Added expandable advanced settings panel in the Settings tab with collapsible sections
  • Implemented mouse wheel and trackpad scroll support for Settings tab (fixes scroll conflicts)
  • Updated temperature and top_p slider selectors for new AI Studio UI
  • Added EnvManager class for .env file management with encryption support
  • Enhanced dark mode colors and fixed color tuple handling
  • Added custom widgets for collapsible settings sections
  • Added comprehensive unit tests for GUI configuration and environment management
  • Suppressed unnecessary tray warnings

Files Changed

File Type Impact
gui/app.py Modified Main application with advanced settings integration
gui/config.py Added GUI configuration management
gui/env_manager.py Added .env file management with encryption
gui/widgets.py Added Custom widgets for collapsible settings
gui/utils.py Modified Color utilities with dark mode support
gui/i18n.py Added Internationalization support
gui/tray.py Modified Tray icon improvements
config/selectors.py Modified Updated selectors for new AI Studio UI
tests/gui/test_config.py Added Configuration unit tests
tests/gui/test_env_manager.py Added EnvManager unit tests

Testing Instructions

  1. Open the application and navigate to the Settings tab
  2. Verify expandable advanced settings sections work correctly
  3. Test scroll support with mouse wheel and trackpad
  4. Verify dark mode colors display correctly
  5. Test .env file management via EnvManager

Related Issues (OPTIONAL)

This PR addresses GUI improvements based on user feedback and the new AI Studio UI requirements.

- Create EnvManager class to read/write .env file settings
- Support type conversion (bool, int, float, choice, string)
- Define schema with 40+ settings across 9 categories
- Implement dirty state tracking for unsaved changes
- Add hot reload callbacks for runtime updates
- Support applying settings to os.environ
- Preserve comments and file structure when saving
- Implement singleton pattern with get_env_manager()
- Create CTkCollapsibleFrame for expandable/collapsible sections
- Create CTkSettingRow with auto-generated input based on type
  - Switch for boolean settings
  - Entry for int/float/string settings
  - ComboBox for choice settings
- Create CTkEnvSettingsPanel as scrollable container for all settings
- Support modified indicator on changed values
- Integrate with EnvManager for save/reload/reset operations
config.py:
- Add ENV_FILE and ENV_EXAMPLE_FILE paths
- Add CATEGORY_ICONS for settings categories

i18n.py:
- Add 50+ bilingual translations for advanced settings UI
- Include category names, action buttons, status messages
- Add tooltips for common settings
- Add log messages for settings operations
app.py:
- Initialize EnvManager for advanced settings
- Add advanced_settings_expanded state variable
- Refactor Settings tab to use scrollable container
- Add collapsible Advanced Settings section (hidden by default)
- Implement toggle button for show/hide advanced settings
- Add action buttons: Apply, Hot Reload, Reload, Reset
- Handle edge cases when proxy is running
- Prompt to save unsaved changes before collapse
- Persist expanded/collapsed state

__init__.py:
- Update module docstring with new architecture
- Add 27 comprehensive tests for EnvManager functionality
- Test initialization and file loading
- Test get/set with type conversion (int, bool, float, string, choice)
- Test dirty state tracking and modified keys detection
- Test save/reload/reset operations
- Test hot reload callbacks and os.environ application
- Test category handling and schema info
- Test singleton pattern
tray.py:
- Silence verbose warning messages when system tray is unavailable
- Fix color extraction from COLORS tuples using new get_current_color()
- Remove print statements for cleaner startup

config.py:
- Add get_color(key, mode) helper to extract color from (light, dark) tuple
- Add get_current_color(key) helper that uses current CTk appearance mode
- These utilities ensure proper color handling in non-CTk contexts (pystray)
utils.py:
- Add bind_mousewheel() utility function for cross-platform scroll binding
- Add scroll event methods to CTkScrollableList
- Support Linux (Button-4/5), Windows (MouseWheel), macOS (trackpad delta)

widgets.py:
- Add _bind_scroll_events() method to CTkEnvSettingsPanel
- Recursively bind scroll events to all child widgets
- Fix scroll not working in collapsible frames

app.py:
- Add _bind_settings_scroll_events() for main settings scrollable frame
- Add _on_mousewheel() and _on_scroll() handlers
- Store reference to settings_scroll for proper event binding
- Test get_color() returns correct mode-specific colors
- Test get_color() handles plain string colors (text_on_color)
- Test get_color() returns default for unknown keys
- Test get_current_color() function exists and is callable
- Fix scroll binding timing: bind AFTER all widgets are created
- Fix nested scrollable frame conflict: skip CTkScrollableFrame children during parent scroll binding
- Add event propagation blocking (return 'break') in CTkEnvSettingsPanel scroll handlers
- Replace fg_color='transparent' with explicit COLORS['bg_dark'] for proper dark mode support
- Add scrollbar colors to settings_scroll and CTkEnvSettingsPanel
- Add corner_radius to advanced_settings_frame
…ew AI Studio UI

- Update TEMPERATURE_INPUT_SELECTOR to use aria-valuemax="2" and slider-number-input class
- Update TOP_P_INPUT_SELECTOR to use aria-valuemax="1" and slider-number-input class
- AI Studio changed slider inputs from type="number" max="X" to type="text" aria-valuemax="X"
@MasuRii MasuRii merged commit 23f0e20 into main Jan 21, 2026
2 of 6 checks passed
@MasuRii MasuRii deleted the feature/advanced-settings-ui branch January 21, 2026 16:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant