-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
FIX: don't import macosx to check if eventloop running #12603
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
lib/matplotlib/backends/__init__.py
Outdated
pass | ||
else: | ||
if _macosx.event_loop_is_running(): | ||
if ('_macosx' in sys.modules) and (_macosx.event_loop_is_running()): |
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.
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.
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.
Dunno whether it helps with the bouncing rocket but it can't hurt, and is consistent with the other checks.
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. |
…entloop running
…603-on-v3.0.x Backport PR #12603 on branch v3.0.x (FIX: don't import macosx to check if eventloop running)
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