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

Commitd85811d

Browse files
authored
Merge pull request#12603 from jklymak/fix-dont-import-macosx
FIX: don't import macosx to check if eventloop running
2 parents0b9a3e7 +bc7059e commitd85811d

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

‎lib/matplotlib/backends/__init__.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,8 @@ def _get_running_interactive_framework():
4747
ifframe.f_code==tkinter.mainloop.__code__:
4848
return"tk"
4949
frame=frame.f_back
50-
try:
51-
frommatplotlib.backendsimport_macosx
52-
exceptImportError:
53-
pass
54-
else:
55-
if_macosx.event_loop_is_running():
50+
if'matplotlib.backends._macosx'insys.modules:
51+
ifsys.modules["matplotlib.backends._macosx"].event_loop_is_running():
5652
return"macosx"
5753
ifsys.platform.startswith("linux")andnotos.environ.get("DISPLAY"):
5854
return"headless"

‎src/_macosx.m

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2580,9 +2580,21 @@ static bool verify_framework(void)
25802580
ProcessSerialNumber psn;
25812581
/* These methods are deprecated, but they don't require the app to
25822582
have started*/
2583+
#ifdef COMPILING_FOR_10_6
2584+
NSApp = [NSApplicationsharedApplication];
2585+
NSApplicationActivationPolicy activationPolicy = [NSAppactivationPolicy];
2586+
switch (activationPolicy) {
2587+
case NSApplicationActivationPolicyRegular:
2588+
case NSApplicationActivationPolicyAccessory:
2589+
returntrue;
2590+
case NSApplicationActivationPolicyProhibited:
2591+
break;
2592+
}
2593+
#else
25832594
if (CGMainDisplayID()!=0
25842595
&&GetCurrentProcess(&psn)==noErr
25852596
&&SetFrontProcess(&psn)==noErr)returntrue;
2597+
#endif
25862598
PyErr_SetString(PyExc_ImportError,
25872599
"Python is not installed as a framework. The Mac OS X backend will"
25882600
"not be able to function correctly if Python is not installed as a"

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp