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

MNT: Clean up macosx backend set_message#21755

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
jklymak merged 2 commits intomatplotlib:mainfromgreglucas:macosx-message-box
May 26, 2022

Conversation

@greglucas
Copy link
Contributor

@greglucasgreglucas commentedNov 25, 2021
edited
Loading

PR Summary

Remove some unnecessary calculations and add some comments. Switch
to string passing since we are guaranteed UTF-8 with Python 3 now.

Set text alignment to the right, which matches the qt5agg backend.

Closes#20797

PR Checklist

Tests and Styling

  • [N/A] Has pytest style unit tests (andpytest passes).
  • IsFlake 8 compliant (installflake8-docstrings and runflake8 --docstring-convention=all).

Documentation

  • [N/A] New features are documented, with examples if plot related.
  • [N/A] New features have an entry indoc/users/next_whats_new/ (follow instructions in README.rst there).
  • [N/A] API changes documented indoc/api/next_api_changes/ (follow instructions in README.rst there).
  • [N/A] Documentation is sphinx and numpydoc compliant (the docs shouldbuild without error).

@greglucasgreglucas added this to thev3.6.0 milestoneNov 25, 2021
NSRect rect = [messageboxframe];
// Entire region to the right of the buttons
rect.size.width = rectWindow.size.width - rect.origin.x;
[messageboxsetFrame: rect];
Copy link
Member

Choose a reason for hiding this comment

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

The text will wrap depending on width, which is why this width must be set before asking for the height. That is, unless text wrapping is off? But then I guess we would not care about setting the height, so it seems that removing this line will break things.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Good catch, updated. This is needed if we want to center the text vertically properly based on window resizes.

@greglucas
Copy link
ContributorAuthor

OK, I was able to dig into the cursor updates, and I think the root of the issue is that there is a cursor update event being fired from within the objc code, but we really want to keep control of the cursor changes on the MPL side. So, if we disable the cursorRect that removes the event and fixes the cursor issues we were seeing in#20797, see the final commit:70a8e32

Remove some unnecessary calculations and add some comments. Switchto string passing since we are guaranteed UTF-8 with Python 3 now.
@greglucas
Copy link
ContributorAuthor

@dstansby, pinging you for a review since you mentioned you had a mac to test this out with. Anyone else with a mac is welcome to test this too!

  • When hovering over the image and the contour you should see the message text centered vertically and right-aligned. It should adjust to one/two lines seamlessly.
  • When pressing the zoom or pan button. The image should now update the cursor properly when hovering over the image (contour / imshow should behave the same now). Previously, the imshow cursor did not update to the open/closed hand on pan.
importmatplotlib.pyplotaspltfig, (ax1,ax2)=plt.subplots(ncols=2)ax1.imshow([[0,1], [2,3]])ax2.contourf([[0,1], [2,3]])plt.show()

@dstansbydstansby self-requested a reviewMay 15, 2022 16:08
Copy link
Member

@jklymakjklymak left a comment

Choose a reason for hiding this comment

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

This works as advertised. I didn't dig too deeply into the code as I'm not versant in ObjectiveC.

We want to keep control of the cursor updates from within MPL, sodon't allow the App to push a new cursor update when the windowgets updated. This would happen when a TextView would get resizedand update the frame.
@jklymakjklymak merged commitbcef5d6 intomatplotlib:mainMay 26, 2022
@greglucasgreglucas deleted the macosx-message-box branchMay 26, 2022 13:32
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@jklymakjklymakjklymak approved these changes

@QuLogicQuLogicQuLogic approved these changes

@dstansbydstansbyAwaiting requested review from dstansby

Assignees

No one assigned

Projects

None yet

Milestone

v3.6.0

Development

Successfully merging this pull request may close these issues.

macosx cursors break with images

3 participants

@greglucas@QuLogic@jklymak

[8]ページ先頭

©2009-2025 Movatter.jp