File tree 2 files changed +14
-6
lines changed
2 files changed +14
-6
lines changed Original file line number Diff line number Diff line change @@ -47,12 +47,8 @@ def _get_running_interactive_framework():
47
47
if frame .f_code == tkinter .mainloop .__code__ :
48
48
return "tk"
49
49
frame = frame .f_back
50
- try :
51
- from matplotlib .backends import _macosx
52
- except ImportError :
53
- pass
54
- else :
55
- if _macosx .event_loop_is_running ():
50
+ if 'matplotlib.backends._macosx' in sys .modules :
51
+ if sys .modules ["matplotlib.backends._macosx" ].event_loop_is_running ():
56
52
return "macosx"
57
53
if sys .platform .startswith ("linux" ) and not os .environ .get ("DISPLAY" ):
58
54
return "headless"
Original file line number Diff line number Diff line change @@ -2580,9 +2580,21 @@ static bool verify_framework(void)
2580
2580
ProcessSerialNumber psn;
2581
2581
/* These methods are deprecated, but they don't require the app to
2582
2582
have started */
2583
+ #ifdef COMPILING_FOR_10_6
2584
+ NSApp = [NSApplication sharedApplication ];
2585
+ NSApplicationActivationPolicy activationPolicy = [NSApp activationPolicy ];
2586
+ switch (activationPolicy) {
2587
+ case NSApplicationActivationPolicyRegular:
2588
+ case NSApplicationActivationPolicyAccessory:
2589
+ return true ;
2590
+ case NSApplicationActivationPolicyProhibited:
2591
+ break ;
2592
+ }
2593
+ #else
2583
2594
if (CGMainDisplayID ()!=0
2584
2595
&& GetCurrentProcess (&psn)==noErr
2585
2596
&& SetFrontProcess (&psn)==noErr ) return true ;
2597
+ #endif
2586
2598
PyErr_SetString (PyExc_ImportError,
2587
2599
" Python is not installed as a framework. The Mac OS X backend will "
2588
2600
" not be able to function correctly if Python is not installed as a "
You can’t perform that action at this time.
0 commit comments