FIX: don't import macosx to check if eventloop running#12603
Merged
Conversation
anntzer
reviewed
Oct 23, 2018
| pass | ||
| else: | ||
| if _macosx.event_loop_is_running(): | ||
| if ('_macosx' in sys.modules) and (_macosx.event_loop_is_running()): |
Contributor
There was a problem hiding this comment.
You need to get the module under the correct name ("matplotlib.backends._macosx" in sys.modules) and then fetch it out of sys.modules (sys.modules["matplotlib.backends._macosx"].event_loop_is_running()) (can be split over multiple lines as for the other modules above) but other than that, it looks like a reasonable solution.
anntzer
approved these changes
Oct 23, 2018
anntzer
left a comment
Contributor
There was a problem hiding this comment.
Dunno whether it helps with the bouncing rocket but it can't hurt, and is consistent with the other checks.
Member
Author
|
The icon still bounces if you select or fallback to MacOSX. But at least it no longer always bounces, which is what it does in 3.0.0 for the framework pythons. |
meeseeksmachine
pushed a commit
to meeseeksmachine/matplotlib
that referenced
this pull request
Oct 23, 2018
…entloop running
tacaswell
added a commit
that referenced
this pull request
Oct 23, 2018
…603-on-v3.0.x Backport PR #12603 on branch v3.0.x (FIX: don't import macosx to check if eventloop running)
This was referenced Oct 24, 2018
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Summary
Alternative to #12557
Crossref #11850,
@anntzer, isn't this right? If the user has started the macosx event loop, they must have already imported macosx?
OTOH I am not sure how to make a Mac GUI to test that this test now does the right thing if the user has made a GUI. If someone has a easy GUI to test, that'd help...
Framework build:
From python prompt:
Goes to MacOSX backend, bounces dock icon, but keeps focus on terminal
No icon until a draw command is given. (Goes to QT5)
non-Framework
falls back to qt5AGG
Gives import error.
So.... I think this all works as expected. The windows connection gets made earlier than we'd like (
NSApp = [NSApplication sharedApplication];inverify_framework()), but there is no way around that.This also no longer uses the deprecated code.
PR Checklist