fix: state device widget init signal block#557
Merged
tlambert03 merged 2 commits intoMay 15, 2026
Merged
Conversation
The initial setCurrentText fired currentIndexChanged -> _on_combo_changed -> mmc.setState() for the already-current state. On Nikon TI scopes that re-applies the objective turret preset on widget init: Z drops, PFS disables, the turret "rotates" to its current position, Z raises. Hardware moves before the user touches anything. Block signals around the initial sync, matching the pattern already used in _refresh_choices and _on_sys_cfg_loaded.
_set_as_default() calls _set_as_default_btn.setChecked(True) without signals_blocked, which fires the toggled signal -> _on_radiobutton_toggled -> mmc.setProperty(CORE, XY_STAGE/Focus, self._device). On construction, if the device is already the default stage in core, the widget writes the same value back to core, firing a propertyChanged ripple. No hardware motion, but the same init-side- effect anti-pattern as the StateDeviceWidget fix. Block signals around the setChecked calls, matching the pattern used elsewhere in the same widget (_on_radiobutton_toggled, _on_prop_changed).
Member
|
thanks! |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #557 +/- ##
==========================================
- Coverage 87.43% 87.42% -0.02%
==========================================
Files 115 115
Lines 14093 14095 +2
==========================================
Hits 12322 12322
- Misses 1771 1773 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
Issue: The initial
setCurrentTextfiredcurrentIndexChanged->_on_combo_changed->mmc.setState()for the already-current state. On Nikon TI scopes that re-applies the objective turret preset on widget init, the turret "rotates" to its current position, and PFS gets disabled.Fix: Block signals around the initial sync, matching the pattern already used in
_refresh_choicesand_on_sys_cfg_loaded.Tested: With Nikon TI when opening napari-micromanager, the PFS stays enabled and turret doesn't "move".
Also added the same signal blocker to
_device_widget.pyfor completeness. (No device settings changed there, but extra loop of setting default stage device)