##// END OF EJS Templates
Fix/mpl integration (#14128)...
Matthias Bussonnier -
r28375:175d52c8 merge
parent child Browse files
Show More
@@ -23,7 +23,7 b' backends = {'
23 "qt4": "Qt4Agg",
23 "qt4": "Qt4Agg",
24 "qt5": "Qt5Agg",
24 "qt5": "Qt5Agg",
25 "qt6": "QtAgg",
25 "qt6": "QtAgg",
26 "qt": "Qt5Agg",
26 "qt": "QtAgg",
27 "osx": "MacOSX",
27 "osx": "MacOSX",
28 "nbagg": "nbAgg",
28 "nbagg": "nbAgg",
29 "webagg": "WebAgg",
29 "webagg": "WebAgg",
@@ -53,8 +53,8 b' backend2gui["CocoaAgg"] = "osx"'
53 # supports either Qt5 or Qt6 and the IPython qt event loop support Qt4, Qt5,
53 # supports either Qt5 or Qt6 and the IPython qt event loop support Qt4, Qt5,
54 # and Qt6.
54 # and Qt6.
55 backend2gui["QtAgg"] = "qt"
55 backend2gui["QtAgg"] = "qt"
56 backend2gui["Qt4Agg"] = "qt"
56 backend2gui["Qt4Agg"] = "qt4"
57 backend2gui["Qt5Agg"] = "qt"
57 backend2gui["Qt5Agg"] = "qt5"
58
58
59 # And some backends that don't need GUI integration
59 # And some backends that don't need GUI integration
60 del backend2gui["nbAgg"]
60 del backend2gui["nbAgg"]
@@ -208,10 +208,12 b' def mpl_runner(safe_execfile):'
208
208
209 #print '*** Matplotlib runner ***' # dbg
209 #print '*** Matplotlib runner ***' # dbg
210 # turn off rendering until end of script
210 # turn off rendering until end of script
211 is_interactive = matplotlib.rcParams['interactive']
211 with matplotlib.rc_context({"interactive": False}):
212 matplotlib.interactive(False)
212 safe_execfile(fname, *where, **kw)
213 safe_execfile(fname,*where,**kw)
213
214 matplotlib.interactive(is_interactive)
214 if matplotlib.is_interactive():
215 plt.show()
216
215 # make rendering call now, if the user tried to do it
217 # make rendering call now, if the user tried to do it
216 if plt.draw_if_interactive.called:
218 if plt.draw_if_interactive.called:
217 plt.draw()
219 plt.draw()
@@ -317,9 +319,15 b' def find_gui_and_backend(gui=None, gui_select=None):'
317
319
318 import matplotlib
320 import matplotlib
319
321
322 has_unified_qt_backend = getattr(matplotlib, "__version_info__", (0, 0)) >= (3, 5)
323
324 backends_ = dict(backends)
325 if not has_unified_qt_backend:
326 backends_["qt"] = "qt5agg"
327
320 if gui and gui != 'auto':
328 if gui and gui != 'auto':
321 # select backend based on requested gui
329 # select backend based on requested gui
322 backend = backends[gui]
330 backend = backends_[gui]
323 if gui == 'agg':
331 if gui == 'agg':
324 gui = None
332 gui = None
325 else:
333 else:
@@ -336,7 +344,7 b' def find_gui_and_backend(gui=None, gui_select=None):'
336 # ones allowed.
344 # ones allowed.
337 if gui_select and gui != gui_select:
345 if gui_select and gui != gui_select:
338 gui = gui_select
346 gui = gui_select
339 backend = backends[gui]
347 backend = backends_[gui]
340
348
341 return gui, backend
349 return gui, backend
342
350
@@ -173,8 +173,8 b' class TestPylabSwitch(object):'
173 # Save rcParams since they get modified
173 # Save rcParams since they get modified
174 self._saved_rcParams = matplotlib.rcParams
174 self._saved_rcParams = matplotlib.rcParams
175 self._saved_rcParamsOrig = matplotlib.rcParamsOrig
175 self._saved_rcParamsOrig = matplotlib.rcParamsOrig
176 matplotlib.rcParams = dict(backend='Qt4Agg')
176 matplotlib.rcParams = dict(backend="QtAgg")
177 matplotlib.rcParamsOrig = dict(backend='Qt4Agg')
177 matplotlib.rcParamsOrig = dict(backend="QtAgg")
178
178
179 # Mock out functions
179 # Mock out functions
180 self._save_am = pt.activate_matplotlib
180 self._save_am = pt.activate_matplotlib
General Comments 0
You need to be logged in to leave comments. Login now