Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Undeprecate Cursor event handlers#25129

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
anntzer merged 6 commits intomatplotlib:mainfromksunden:undeprecate_cursor
Feb 6, 2023

Conversation

ksunden
Copy link
Member

  • 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 toset_visible(False) in the un-prefixed versions ofclear forCursor andMultiCursor.
Because clear is registered as a callback on adraw event, this was causing the cursor to disappear on the nbagg backend.

clear is not actually run in our test suite, as observed oncodecov.

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 theset_visible(False) was included.

So I removed those lines entirely for the undeprecation.
This feels odd, as I may have expected theclear 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 callingclear 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 theMouseEvent 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 (andpytest passes)
  • Documentation is sphinx and numpydoc compliant (the docs shouldbuild 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 indoc/users/next_whats_new/
  • API changes are marked with a.. versionchanged:: directive in the docstring and documented indoc/api/next_api_changes/
  • Release notes conform with instructions innext_whats_new/README.rst ornext_api_changes/README.rst

@tacaswelltacaswell added this to thev3.7.0 milestoneFeb 2, 2023
Copy link
Member

@tacaswelltacaswell left a comment

Choose a reason for hiding this comment

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

I am convinced by the observation that as soon as the mouse is moved into the axes the cursor will be made visible again and already becomes invisible if the mouse moves out.

While there is a risk of breakage here, I think that it is less this way than with what is on main now.

Co-authored-by: Thomas A Caswell <tcaswell@gmail.com>
@tacaswell
Copy link
Member

The current state works for me runningpython examples/widgets/annotated_cursor.py

@ksundenksunden added the Release criticalFor bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions. labelFeb 3, 2023
@anntzeranntzer merged commitce21d72 intomatplotlib:mainFeb 6, 2023
meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull requestFeb 6, 2023
ksunden pushed a commit to meeseeksmachine/matplotlib that referenced this pull requestFeb 6, 2023
Trying to run the example prior to the PR would result in exceptionsbeing thrown on mouse moves.Manual backport ofmatplotlib#25106 rolled into backport ofmatplotlib#25129 (backport prmatplotlib#25160)
ksunden added a commit that referenced this pull requestFeb 7, 2023
…129-on-v3.7.xBackport PR#25129 on branch v3.7.x (Undeprecate Cursor event handlers)
@ksundenksunden mentioned this pull requestFeb 20, 2023
6 tasks
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@tacaswelltacaswelltacaswell approved these changes

@anntzeranntzeranntzer approved these changes

Assignees
No one assigned
Labels
Release criticalFor bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.
Projects
None yet
Milestone
v3.7.0
Development

Successfully merging this pull request may close these issues.

[Doc]: annotated_cursor example seems broken
3 participants
@ksunden@tacaswell@anntzer

[8]ページ先頭

©2009-2025 Movatter.jp