Skip to content

fix: synchronize loaded MDA channel group#551

Merged
tlambert03 merged 8 commits into
pymmcore-plus:mainfrom
gcharvin:codex/mr-channel-group-load
Apr 8, 2026
Merged

fix: synchronize loaded MDA channel group#551
tlambert03 merged 8 commits into
pymmcore-plus:mainfrom
gcharvin:codex/mr-channel-group-load

Conversation

@gcharvin

@gcharvin gcharvin commented Apr 7, 2026

Copy link
Copy Markdown
Contributor

Summary

When loading MDA channels, synchronize the selected channel group before setting the channel table row values.

This ensures the config/preset column is rebuilt with the correct preset choices before row data are applied. If the loaded sequence references a channel group that is not available in the current Micro-Manager configuration, the widget now emits a Python warning instead of silently showing mismatched presets.

Background

This came from loading saved MDA settings on a TiEclipse configuration where the channel group/preset did not restore correctly at application startup/load time.

Validation

  • python -m ruff check src/pymmcore_widgets/useq_widgets/_channels.py tests/test_channel_widget.py tests/test_channel_group_widget.py
  • QT_QPA_PLATFORM=offscreen python -m pytest tests/test_channel_widget.py tests/test_channel_group_widget.py -q: 4 passed
  • python -m compileall -q src/pymmcore_widgets/useq_widgets/_channels.py

@codecov

codecov Bot commented Apr 7, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.43%. Comparing base (8c8f76e) to head (ea3f63c).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #551      +/-   ##
==========================================
+ Coverage   87.42%   87.43%   +0.01%     
==========================================
  Files         115      115              
  Lines       14081    14093      +12     
==========================================
+ Hits        12310    12322      +12     
  Misses       1771     1771              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@gcharvin gcharvin changed the title Fix loaded MDA channel group synchronization fix: synchronize loaded MDA channel group Apr 7, 2026
Comment on lines +159 to +161
self._group_combo.setStyleSheet(
"QComboBox { border: 1px solid #c2410c; background: #fff7ed; }"
)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are currently trying to purge the whole widgets codebase of all hard-coded styles like this (I know we have them scattered about, but it's an antipattern that is making it harder for us to successfully apply global dark/light themes and styles, which is an active work in progress).

Also: it really would be useful to have screenshots provided with all PRs that make visual changes so I can see what the intention is without having to pull, spin it up, and figure out how to trigger the change)


side note: this would be the sort of information that we should absolutely have in an agents.txt document so that it's not just in our heads and llm agents can actively take it into consideration

@gcharvin

gcharvin commented Apr 7, 2026 via email

Copy link
Copy Markdown
Contributor Author


# ------------------- Private API -------------------

def _set_loaded_group_warning(self, group: str | None) -> None:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, now that I ran this example I have a better sense for what it's fixing. Thank you!

And I see what the tooltip is doing know. However, I think I want to remove this _set_loaded_group_warning path altogether in favor of a direct python warnings.warn() on line 143. I know that that doesn't immediately surface in the GUI (it will show in the console, which the user may not be monitoring). but in the real, composed pymmcore-gui app, we can globally monitor warnings, and show a notification toast. This way we can avoid having little ad-hoc UI changes in each widget. Will that work for you?

@gcharvin

gcharvin commented Apr 7, 2026 via email

Copy link
Copy Markdown
Contributor Author

@tlambert03 tlambert03 enabled auto-merge (squash) April 7, 2026 18:07
auto-merge was automatically disabled April 8, 2026 05:30

Head branch was pushed to by a user without write access

@tlambert03 tlambert03 merged commit 034b7eb into pymmcore-plus:main Apr 8, 2026
25 checks passed
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.

2 participants