Title: Undeprecate Cursor event handlers by ksunden · Pull Request #25129 · matplotlib/matplotlib · GitHub
Open Graph Title: Undeprecate Cursor event handlers by ksunden · Pull Request #25129 · matplotlib/matplotlib
X Title: Undeprecate Cursor event handlers by ksunden · Pull Request #25129 · matplotlib/matplotlib
Description: Revert "Fix deprecations of *Cursor widget event handlers" Revert: Deprecate access to Cursor/MultiCursor event handlers. Add simulated mouse events to cursor demos remove calls to set_visible(False) Closes #25107 PR Summary The event handlers were deprecated for mpl 3.7 in #19763 (with correction for the deprecation notices in #24750) This has not been released as a final matplotlib version (only the rc). However, one of examples demonstrated subclassing these classes specifically to override these methods. The callbacks registered internally were for the privitized version of the functions, thus the overrides did nothing. Given that it is suggested in our docs, we determiened in #25107 that we should undeprecate these methods. The original PR kept the calls to set_visible(False) in the un-prefixed versions of clear for Cursor and MultiCursor. Because clear is registered as a callback on a draw event, this was causing the cursor to disappear on the nbagg backend. clear is not actually run in our test suite, as observed on codecov. In ad hoc testing, removing seemed to have limited impact on the qt backend (seemed to function as expected). The problem from #19763 was reintroduced for the nbagg backend if the set_visible(False) was included. So I removed those lines entirely for the undeprecation. This feels odd, as I may have expected the clear function to explicitly turn off the cursor visibility. But as far as I can tell, it works like I'd expect. I suspect in the narrow case of a user calling clear directly (as opposed to relying on the internal callbacks) it may not actually remove the lines and thus be unexpected behavior. But I have no examples of doing such, and in most cases if the cursor was showing to begin with, the mouse is over the axes, and will cause the cursor to show up as soon as it moves anyway, I'd think. Anywho, while working on these, figured I'd also add a simulted mouse event to the examples so that the docs show what they actually do (if not interactively still) a bit more. I did so using _process() on the MouseEvent because that is what is done in our tests for simulating mouse events. I could have made the mouse event and passed it directly to the callback method, I think, which would have avoided using an _ method in our example. @anntzer suggested perhaps removing the widgets/annotated_cursor example all together because event_handlers/cursor_demo does effectively the same thing but in less code. @tacaswell voted in favor of keeping both for the time being (though did check that they are cross linked to each other). PR Checklist Documentation and Tests Has pytest style unit tests (and pytest passes) Documentation is sphinx and numpydoc compliant (the docs should build without error). New plotting related features are documented with examples. Release Notes New features are marked with a .. versionadded:: directive in the docstring and documented in doc/users/next_whats_new/ API changes are marked with a .. versionchanged:: directive in the docstring and documented in doc/api/next_api_changes/ Release notes conform with instructions in next_whats_new/README.rst or next_api_changes/README.rst
Open Graph Description: Revert "Fix deprecations of *Cursor widget event handlers" Revert: Deprecate access to Cursor/MultiCursor event handlers. Add simulated mouse events to cursor demos remove calls to set_vi...
X Description: Revert "Fix deprecations of *Cursor widget event handlers" Revert: Deprecate access to Cursor/MultiCursor event handlers. Add simulated mouse events to cursor demos remove calls t...
Opengraph URL: https://github.com/matplotlib/matplotlib/pull/25129
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:ebaf24b9-061b-a089-3970-b196d80b319a |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | DF96:300776:637866:84965D:6A518C0C |
| html-safe-nonce | 499dbcabe1591d1fdedd5c681e196e2e7607bd8c97955144a88a0f6524d8da31 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJERjk2OjMwMDc3Njo2Mzc4NjY6ODQ5NjVEOjZBNTE4QzBDIiwidmlzaXRvcl9pZCI6Ijc0OTczNDQ2MDY0NTI5NDM4ODQiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 6b2d30876a4ca8fc65809239497025a9666cedd7c8852d5bd1d834417916dd19 |
| hovercard-subject-tag | pull_request:1225803534 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/matplotlib/matplotlib/pull/25129/files |
| twitter:image | https://avatars.githubusercontent.com/u/2501846?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/2501846?s=400&v=4 |
| og:image:alt | Revert "Fix deprecations of *Cursor widget event handlers" Revert: Deprecate access to Cursor/MultiCursor event handlers. Add simulated mouse events to cursor demos remove calls to set_vi... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | b9a586c06a05a7a86fc7e3f4dbd03e42f6869085879aa184aa6369456dbd50fb |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/matplotlib/matplotlib git https://github.com/matplotlib/matplotlib.git |
| octolytics-dimension-user_id | 215947 |
| octolytics-dimension-user_login | matplotlib |
| octolytics-dimension-repository_id | 1385122 |
| octolytics-dimension-repository_nwo | matplotlib/matplotlib |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1385122 |
| octolytics-dimension-repository_network_root_nwo | matplotlib/matplotlib |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 7aed05249554b889eb33d002851a973eebcc7e91 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width