Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork8.1k
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
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Uh oh!
There was an error while loading.Please reload this page.
| NSRect rect = [messageboxframe]; | ||
| // Entire region to the right of the buttons | ||
| rect.size.width = rectWindow.size.width - rect.origin.x; | ||
| [messageboxsetFrame: 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 toe14107fComparegreglucas commentedMay 1, 2022
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 commentedMay 15, 2022
@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!
importmatplotlib.pyplotaspltfig, (ax1,ax2)=plt.subplots(ncols=2)ax1.imshow([[0,1], [2,3]])ax2.contourf([[0,1], [2,3]])plt.show() |
jklymak left a comment
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.
Uh oh!
There was an error while loading.Please reload this page.
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.
Uh oh!
There was an error while loading.Please reload this page.
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
pytestpasses).flake8-docstringsand 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).