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

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
tacaswell merged 2 commits intomatplotlib:masterfromjklymak:fix-dont-import-macosx
Oct 23, 2018

Conversation

jklymak
Copy link
Member

@jklymakjklymak commentedOct 23, 2018
edited
Loading

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:

import matplotlib.pyplot as plt

Goes to MacOSX backend, bounces dock icon, but keeps focus on terminal

import matplotlib; matplotlib.use('qt5agg'); import matplotlib.pyplot as plt

No icon until a draw command is given. (Goes to QT5)

non-Framework

import matplotlib.pyplot as plt

falls back to qt5AGG

import matplotlib; matplotlib.use('macosx'); import matplotlib.pyplot as plt

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

  • Has Pytest style unit tests
  • Code isFlake 8 compliant
  • New features are documented, with examples if plot related
  • Documentation is sphinx and numpydoc compliant
  • Added an entry to doc/users/next_whats_new/ if major new feature (follow instructions in README.rst there)
  • Documented in doc/api/api_changes.rst if API changed in a backward-incompatible way

pass
else:
if _macosx.event_loop_is_running():
if ('_macosx' in sys.modules) and (_macosx.event_loop_is_running()):
Copy link
Contributor

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 ofsys.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.

jklymak reacted with thumbs up emoji
Copy link
Contributor

@anntzeranntzer left a 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.

@jklymak
Copy link
MemberAuthor

The icon still bouncesif 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.

@tacaswelltacaswell added this to thev3.0.x milestoneOct 23, 2018
@tacaswelltacaswell merged commitd85811d intomatplotlib:masterOct 23, 2018
meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull requestOct 23, 2018
@jklymakjklymak deleted the fix-dont-import-macosx branchOctober 23, 2018 23:11
tacaswell added a commit that referenced this pull requestOct 23, 2018
…603-on-v3.0.xBackport PR#12603 on branch v3.0.x (FIX: don't import macosx to check if eventloop running)
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@anntzeranntzeranntzer approved these changes

Assignees
No one assigned
Projects
None yet
Milestone
v3.0.1
Development

Successfully merging this pull request may close these issues.

3 participants
@jklymak@anntzer@tacaswell

[8]ページ先頭

©2009-2025 Movatter.jp