feat(gui): add advanced settings UI with expandable sections and scroll support#20
Merged
feat(gui): add advanced settings UI with expandable sections and scroll support#20
Conversation
- 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"
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
Files Changed
gui/app.pygui/config.pygui/env_manager.pygui/widgets.pygui/utils.pygui/i18n.pygui/tray.pyconfig/selectors.pytests/gui/test_config.pytests/gui/test_env_manager.pyTesting Instructions
Related Issues (OPTIONAL)
This PR addresses GUI improvements based on user feedback and the new AI Studio UI requirements.