-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
rect.size.width = rectWindow.size.width - rect.origin.x; | ||
[messagebox setFrame: rect]; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
9ac5d51
to
e14107f
Compare
e14107f
to
70a8e32
Compare
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. Switch to string passing since we are guaranteed UTF-8 with Python 3 now.
70a8e32
to
662642c
Compare
@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!
import matplotlib.pyplot as plt
fig, (ax1, ax2) = plt.subplots(ncols=2)
ax1.imshow([[0, 1], [2, 3]])
ax2.contourf([[0, 1], [2, 3]])
plt.show() |
There was a problem hiding this 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, so don't allow the App to push a new cursor update when the window gets updated. This would happen when a TextView would get resized and update the frame.
662642c
to
5dcdcb8
Compare
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
pytest
passes).flake8-docstrings
and runflake8 --docstring-convention=all
).Documentation
doc/users/next_whats_new/
(follow instructions in README.rst there).doc/api/next_api_changes/
(follow instructions in README.rst there).