-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Live mode button widget #148
Conversation
This is a really good start! But I think we can go farther in the decoupling if we can stomach adding a new core signal. I think my ideal would be:
This works out if all listeners call I think that that's more or less analogous to what your doing with the snap button. This is also y preference because it feels like a cleaner separation of concerns. The live button is just responsible for toggling a single state on core - not managing timers and emitting data. Ideally the only place other components receive data from is the core. Alternatively, we can push the timer logic into the button as you've done now. But in that case I think we should:
|
Co-authored-by: Ian Hunt-Isaak <ianhuntisaak@gmail.com>
some tests are failing because of the new signals not yet added to |
Codecov Report
@@ Coverage Diff @@
## main #148 +/- ##
==========================================
+ Coverage 82.68% 83.23% +0.54%
==========================================
Files 27 28 +1
Lines 2385 2433 +48
==========================================
+ Hits 1972 2025 +53
+ Misses 413 408 -5
Continue to review full report at Codecov.
|
# test from direct mmcore signals | ||
with qtbot.waitSignal(global_mmcore.events.startContinuousSequenceAcquisition): | ||
global_mmcore.startContinuousSequenceAcquisition(0) | ||
assert live_btn.text() == "Stop" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think you want this assert (and those on ln 34,35,40,41,45,46) to be outside of the waitSignal context. Though it may work as is it's likely to be just because it happens nearly instantaneously. but if the goal is to make the wait for the signal occur before you make the assertions, then the assertions should be after the context.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me, couple minor comments on the tests. @ianhi, I think this generally follows the pattern you were also endorsing. Good with this?
missed this but yes it does! nice stuff |
Creating a new general purpose two-state (on-off)
Live
modeQPushButton
widget.It works with new
startContinuousSequenceAcquisition
andstopSequenceAcquisition
events signals added topymmcore-plus
in PR https://github.com/tlambert03/pymmcore-plus/pull/115.When the button is toggled on, a continuous Sequence Acquisition is started (using a new
pymmcore-plus
startContinuous Sequence Acquisition
method) and astarting
signal is emitted. Inmain_window
the signal is connected to the_toggle_live
function where the new frames are added to thenapari viewer
through aQTimer
.When the button is toggled off, the Sequence Acquisition is stopped (using a new
pymmcore-plus
stop Sequence Acquisition
method). The connected 'stop' signal connected tomain_window
will stop updating thenapari viewer
and resets theQTimer
.