##// END OF EJS Templates
FIX: improve IPython's integration with Matplotlib's Qt backends...
Thomas A Caswell -
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"]
@@ -317,9 +317,15 b' def find_gui_and_backend(gui=None, gui_select=None):'
317
317
318 import matplotlib
318 import matplotlib
319
319
320 has_unified_qt_backend = matplotlib.__version__[:3] >= '3.5'
321
322 backends_ = dict(backends)
323 if not has_unified_qt_backend:
324 backends_['qt'] = 'qt5agg'
325
320 if gui and gui != 'auto':
326 if gui and gui != 'auto':
321 # select backend based on requested gui
327 # select backend based on requested gui
322 backend = backends[gui]
328 backend = backends_[gui]
323 if gui == 'agg':
329 if gui == 'agg':
324 gui = None
330 gui = None
325 else:
331 else:
@@ -336,7 +342,7 b' def find_gui_and_backend(gui=None, gui_select=None):'
336 # ones allowed.
342 # ones allowed.
337 if gui_select and gui != gui_select:
343 if gui_select and gui != gui_select:
338 gui = gui_select
344 gui = gui_select
339 backend = backends[gui]
345 backend = backends_[gui]
340
346
341 return gui, backend
347 return gui, backend
342
348
General Comments 0
You need to be logged in to leave comments. Login now