-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
ENH: Add the ability to block callback signals #20816
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
Conversation
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 this could be really useful for debugging interactive stuff, so tentatively 👍
a9680e7
to
ad95b35
Compare
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.
minor nits, but liking the new docs :)
ad95b35
to
dd4385d
Compare
What do you think about naming this |
dd4385d
to
1cf6384
Compare
@timhoffm, apparently there is a preferred convention and your suggestion lines up with that :) |
Also, and I might be confused about the functionality here, but would it be possible for the what's new example to be slight less toy/use like one of the auto registrated callbacks or something? |
CallbackRegistry objects now have a context manager .block() method that can be used to temporarily block callback signals from being processed.
1cf6384
to
d9fef33
Compare
I came up with another toy-like example, but with interactivity on the figure canvas and disabling key-press events. Did you have another example/area in mind to apply this? It looks like the widgets keep their callbacks private in |
Using fig.canvas.callbacks is perfect - I was unsure whether the functionality extended to the fig callbacks and this clears it right up & I think would be a common use case 😄 |
PR Summary
CallbackRegistry objects gain a context manager
.block()
method that can be used to temporarily block callback signals from being processed.Closes #20802
Would help with disabling norm update signals in #19553
PR Checklist
pytest
passes).flake8
on changed files to check).flake8-docstrings
and runflake8 --docstring-convention=all
).doc/users/next_whats_new/
(follow instructions in README.rst there).doc/api/next_api_changes/
(follow instructions in README.rst there).