Skip to content

Implement standardized native dialog opt-in and unified file logic#255

Open
google-labs-jules[bot] wants to merge 1 commit into
developfrom
jules/feat/native-dialog-opt-in-js0-b56159f5-66e6-4b53-b74d-d11aa211ae40
Open

Implement standardized native dialog opt-in and unified file logic#255
google-labs-jules[bot] wants to merge 1 commit into
developfrom
jules/feat/native-dialog-opt-in-js0-b56159f5-66e6-4b53-b74d-d11aa211ae40

Conversation

@google-labs-jules

Copy link
Copy Markdown

Context & Rationale

Researchers on macOS currently face a suboptimal experience where file dialogs do not support platform-standard features like the Favorites sidebar or Tag filtering. This is caused by a known conflict between the IPython event loop and native Qt dialogs, which can cause panels to close prematurely in certain configurations.

This PR introduces a unified utility for handling file dialogs and provides an experimental opt-in for native OS dialogs. By making this feature strictly opt-in, we satisfy the needs of power users who require a native macOS experience while maintaining stability for the general user base.

Key Changes

1. Unified Dialog Logic

  • Refactored _select_file in src/eegprep/functions/guifunc/qt.py to utilize the _file_dialog_kwargs helper.
  • Consolidated all menu-driven file selection logic to ensure "Open Data" and "Save As" actions behave consistently across the application.

2. Global Configuration & Persistence

  • Added option_native_dialogs to the EEGOptions dataclass in src/eegprep/functions/adminfunc/eeg_options.py.
  • Set the default value to 0 (disabled) to ensure application stability on first launch. This setting is persisted in the user's global configuration.

3. Settings UI Enhancement

  • Upgraded the preferences window in src/eegprep/functions/guifunc/menu_actions.py from a simple message box to a comprehensive QDialog.
  • Implemented an Experimental Features section in the settings UI containing a "Use Native OS Dialogs" toggle.

Design Decisions

  • Stable-by-Default: To prevent system regressions, the application remains on non-native Qt dialogs unless the user explicitly opts in. This protects against the known IPython pulsed event loop issues.
  • Dynamic Dispatching: Menu action handlers now query EEG_OPTIONS directly when spawning file panels. This allows users to toggle the native dialog setting and see the change reflected immediately without restarting the application.
  • Scope Limitation: This change specifically targets file selection panels (Open/Save). Modal alerts and other UI elements remain unchanged to minimize the surface area for potential event loop conflicts.

Success Metrics & Validation

  • Verified that the "Native Dialogs" toggle persists between application restarts.
  • Confirmed that when the toggle is disabled, the application uses the reliable (non-native) Qt dialog style.
  • Validated that toggling the preference does not interfere with the IPython console's ability to process input.

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.

0 participants