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

Move set_cursor from the toolbar to FigureCanvas.#20620

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
timhoffm merged 3 commits intomatplotlib:masterfromQuLogic:canvas-cursor
Jul 24, 2021

Conversation

QuLogic
Copy link
Member

@QuLogicQuLogic commentedJul 9, 2021
edited
Loading

PR Summary

While the toolbar does need to track what it wants to set the cursor to based on the active tool, actually setting it is an act on the canvas (or sometimes the window, but this is toolkit dependent, so we won't worry about that.)

It also means we don't need redundantset_cursor definitions on both toolbar/toolmanager(not yet committed.)

PR Checklist

  • Has pytest style unit tests (andpytest passes).
  • IsFlake 8 compliant (runflake8 on changed files to check).
  • New features are documented, with examples if plot related.
  • Documentation is sphinx and numpydoc compliant (the docs shouldbuild without error).
  • Conforms to Matplotlib style conventions (installflake8-docstrings and runflake8 --docstring-convention=all).
  • New features have an entry indoc/users/next_whats_new/ (follow instructions in README.rst there).
  • API changes documented indoc/api/next_api_changes/ (follow instructions in README.rst there).

@QuLogicQuLogic marked this pull request as ready for reviewJuly 10, 2021 02:30
@QuLogicQuLogic added this to thev3.5.0 milestoneJul 10, 2021
@anntzer
Copy link
Contributor

(Not directly related, but I guess you could also do the same with draw_rubberband/remove_rubberband, which is already tightly coupled with the draw loop?)

Copy link
Member

@timhoffmtimhoffm left a comment
edited
Loading

Choose a reason for hiding this comment

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

Side note:
We should move away fromcursors and switch to directly using the enumCursors everywhere. Possbibly also deprecatecursors, Not sure if we can already issue warnings on module variables. If not, still announce the deprecation, and extend the duration by 1 or 2 extra releases. When people have to touchset_cursor anyway, they should switch to the enum while they are at it. This need not (possibly should not) be part of this PR for simplicity, but it should be a follow-up

Comment on lines 259 to 266
_api.warn_deprecated("3.5",
message="Overriding ToolSetCursor with "
f"{tool_cls.__qualname__} was only "
"necessary to provide the .set_cursor() "
"method, which is deprecated since "
"%(since)s and will be removed "
"%(removal)s")

Copy link
Member

Choose a reason for hiding this comment

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

I don't quite follow this. From a user perspective, under which conditions is the warning emitted, and what action should they take if they see this message?

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

None, in Matplotlib. It's for third-party backends, of which I'm not sure any even implement tool manager. I'll tweak the message to say so.

@QuLogic
Copy link
MemberAuthor

Possbibly also deprecatecursors, Not sure if we can already issue warnings on module variables.

There's module-level__getattr__ in 3.7, but I was hoping@anntzer would have written some magic to wrap it all up.

timhoffm reacted with laugh emoji

@anntzer
Copy link
Contributor

anntzer commentedJul 12, 2021
edited
Loading

I think#10735 is what you are looking for :-) (or some variants thereof, I can open a new PR if there's interest)

Copy link
Contributor

@anntzeranntzer left a comment

Choose a reason for hiding this comment

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

modulo rebase

Copy link
Member

@timhoffmtimhoffm left a comment

Choose a reason for hiding this comment

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

Modulo one comment on a deprecation.

While the toolbar does need to track what it wants to set the cursor tobased on the active tool, actually setting it is an act on the canvas(or sometimes the window, but this is toolkit dependent, so we won'tworry about that.)
Which is now replaced by `FigureCanvasBase.set_cursor`.
@timhoffmtimhoffm merged commit01a1c49 intomatplotlib:masterJul 24, 2021
@QuLogicQuLogic deleted the canvas-cursor branchJuly 24, 2021 08:15
@greglucas
Copy link
Contributor

@QuLogic, I just tested themacosx cursors a bit. It didn't have anything to do with this PR. Master is the same behavior as 3.4.2.

Somehow it has to do with the plotted mappable on the axes...

importmatplotlib.pyplotaspltfig,ax=plt.subplots()ax.contourf([[0,1], [2,3]])# cursor changes to the grab/zoom image# ax.imshow([[0, 1], [2, 3]])  # cursor does not changeplt.show()

It works properly for contourf, but not for imshow/pcolormesh. The cursor works as expected for all mappables withqt5agg.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@anntzeranntzeranntzer approved these changes

@timhoffmtimhoffmtimhoffm approved these changes

Assignees
No one assigned
Projects
None yet
Milestone
v3.5.0
Development

Successfully merging this pull request may close these issues.

4 participants
@QuLogic@anntzer@greglucas@timhoffm

[8]ページ先頭

©2009-2025 Movatter.jp