1186 remove channel settings widgets if not necessary#1190
Conversation
Expose filter wheel hardware types via ConfigurationController.filter_wheel_types and pass them into the channels view. Add ChannelCreator.is_synthetic_filter_wheel and use it to skip creating labels and pulldown widgets for synthetic filter wheels (types 'synthetic' or 'syntheticfilterwheel'). Update view.populate_frame/create_labels signatures to accept filter_wheel_types. Fix filterwheel pulldown validation in ChannelSettingController to check each filter wheel per channel (correct indexing for multiple wheels). These changes hide synthetic filter wheels from the channels UI and ensure selections are validated correctly.
Initialize ChannelSettingController state earlier (mode, in_initialization, event_id, channel_setting_dict) so these attributes exist before calling rebuild_view. Trigger rebuild_view() from ChannelsTabController when showing the main window to ensure the channel view matches the active configuration. Add ChannelCreator.reset_frame() and call it at construction to destroy existing child widgets and clear internal widget/variable lists before recreating them. Also apply minor signature/formatting tweaks. These changes prevent stale widgets/attributes and keep the UI in sync with configuration updates.
Record which filter wheel entries belong to each microscope during configuration verification and save a filter_wheel_visibility list in each microscope config. Add ConfigurationController.filter_wheel_visibility to expose a safe boolean list with sensible fallbacks. Pass visibility through ChannelSettingController to the ChannelCreator view and add should_hide_filter_wheel logic so non-native (or synthetic) wheels are omitted from the UI. This keeps shared/placeholder sequence alignment while allowing the GUI to hide wheels that don't belong to a given microscope.
There was a problem hiding this comment.
Pull request overview
This pull request implements dynamic channel settings UI rebuild and filter-wheel visibility management to support microscope switching scenarios. The changes enable the channel settings interface to properly adapt when switching between microscopes with different filter wheel configurations, including handling mixed setups with both real and synthetic filter wheels.
Changes:
- Added dynamic rebuild capability for channel widgets to reflect active microscope configuration changes
- Implemented filter-wheel visibility tracking to hide non-native and synthetic filter wheels per microscope
- Fixed a bug in filter wheel default value population logic that was iterating incorrectly
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/navigate/config/config.py | Tracks filter wheel IDs per microscope and computes visibility before sequence alignment to handle multi-microscope setups |
| src/navigate/controller/configuration_controller.py | Adds filter_wheel_types and filter_wheel_visibility properties to expose filter wheel metadata |
| src/navigate/controller/sub_controllers/channels_settings.py | Implements rebuild_view() method for dynamic widget reconstruction and fixes filter wheel iteration bug in populate_empty_values() |
| src/navigate/controller/sub_controllers/channels_tab.py | Calls rebuild_view() during initialization to ensure widgets match active configuration |
| src/navigate/view/main_window_content/channels_tab.py | Adds reset_frame() for cleanup, updates populate_frame() and create_labels() to conditionally hide filter wheels, implements hiding logic in helper methods |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| def is_synthetic_filter_wheel( | ||
| filter_wheel_idx: int, filter_wheel_types: list | ||
| ) -> bool: | ||
| """Return whether a filter wheel type should be hidden in the GUI.""" |
There was a problem hiding this comment.
The docstring is misleading. It states "Return whether a filter wheel type should be hidden in the GUI" but this method only checks if the filter wheel is synthetic, not whether it should be hidden. The actual hiding decision is made by the should_hide_filter_wheel method which considers both synthetic status and visibility. Consider updating the docstring to: "Return whether a filter wheel is a synthetic filter wheel type."
| """Return whether a filter wheel type should be hidden in the GUI.""" | |
| """Return whether a filter wheel is a synthetic filter wheel type.""" |
Normalize combobox "values" handling in ChannelSettingController and add related tests. - src/navigate/controller/sub_controllers/channels_settings.py: call initialize() in constructor; add static _get_dropdown_values to normalize dropdown values (handles tuple, list, string, empty, etc.); use it in populate_empty_values and dropdown index lookups to avoid errors when values are empty or provided as different types. - Tests: add/extend tests to cover the new behavior: - test/controller/sub_controllers/test_channels_settings.py: assert dropdown normalization and behavior when dropdowns are empty. - test/config/test_config.py: add test to verify filter_wheel_visibility is set correctly by verify_configuration. - test/controller/test_configuration_controller.py: new tests for ConfigurationController filter wheel types/visibility handling. - test/view/main_window_content/tabs/channels/test_channel_creator.py: new tests for ChannelCreator helper methods. These changes fix brittle assumptions about combobox "values" formats and add tests to prevent regressions.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## develop #1190 +/- ##
===========================================
+ Coverage 54.43% 63.54% +9.10%
===========================================
Files 191 189 -2
Lines 24795 25965 +1170
===========================================
+ Hits 13497 16499 +3002
+ Misses 11298 9466 -1832
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Co-Authored-By: Annie Wang <6161065+annie-xd-wang@users.noreply.github.com>
Implemented channel-settings UI rebuild and filter-wheel visibility fixes for microscope switching.
• Added dynamic rebuild of channel widgets when microscope/resolution changes, so channel UI structure now follows the active microscope config instead of only updating values.
• Updated channel frame population to be rebuild-safe by clearing previous widgets before repopulating.
• Added handling to hide synthetic filter-wheel dropdowns and labels (Synthetic / SyntheticFilterWheel, case-insensitive).
• Fixed filter-wheel default-value population logic to iterate correctly across all channels and all filter wheels.
• Addressed mixed microscope setups (one synthetic, one real): config verification now records per-microscope filter_wheel_visibility before global filter-wheel sequence alignment.
• Added ConfigurationController.filter_wheel_visibility and passed it into channel UI creation.
• Channel UI now hides filter-wheel columns if the wheel is either synthetic or not native to the active microscope, preventing real wheel columns from persisting on synthetic microscopes after switching.