Skip to content

Use CallbackRegistry in Widgets and some related cleanup #18226

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

Merged
merged 4 commits into from
Aug 18, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions doc/api/next_api_changes/behavior/18226-ES.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Widgets use ``CallbackRegistry`` to save callbacks
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

`.Widget`\s with event observers now use a `.CallbackRegistry` for storing
callbacks. This is consistent with canvas event callbacks, and fixes some bugs
in widget callback handling.

Due to this change, callback methods are now stored as weak references, which
means you must keep a reference to the associated object. Otherwise it may be
garbage collected.
12 changes: 12 additions & 0 deletions doc/api/next_api_changes/deprecations/18226-ES.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Widget class internals
~~~~~~~~~~~~~~~~~~~~~~

Several `.widgets.Widget` class internals have been privatized and deprecated:
Copy link
Member

Choose a reason for hiding this comment

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

Do we think that there was anyone directly adding things to the observers dictionary?

Copy link
Member Author

Choose a reason for hiding this comment

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

Then they should have updated cnt so that followup additions would have the right number. I would expect them to get an error from that, and hopefully figure it out.


* ``AxesWidget.cids``
* ``Button.cnt`` and ``Button.observers``
* ``CheckButtons.cnt`` and ``CheckButtons.observers``
* ``RadioButtons.cnt`` and ``RadioButtons.observers``
* ``Slider.cnt`` and ``Slider.observers``
* ``TextBox.cnt``, ``TextBox.change_observers`` and
``TextBox.submit_observers``
Loading