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