Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f43a30d

Browse files
committed
MNT: simplify fallback Qt behavior
A check was added change the fall-back behavior if the backend was not set to PyQt{4,5}, but mpl was being embedded in a larger Qt application. The previous commit handles the cases where Qt bindings are already imported earlier in the module so the check here can be removed.
1 parent 7f5ae1f commit f43a30d

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

lib/matplotlib/backends/qt_compat.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -77,15 +77,12 @@
7777
elif rcParams['backend'] == 'Qt4Agg':
7878
QT_API = rcParams['backend.qt4']
7979
else:
80-
# A different backend was specified, but we still got here because a Qt
81-
# related file was imported. This is allowed, so lets try and guess
82-
# what we should be using.
83-
if "PyQt4" in sys.modules or "PySide" in sys.modules:
84-
# PyQt4 or PySide is actually used.
85-
QT_API = rcParams['backend.qt4']
86-
else:
87-
# This is a fallback: PyQt5
88-
QT_API = rcParams['backend.qt5']
80+
# A non-Qt backend was specified, no version of the Qt
81+
# bindings is imported, but we still got here because a Qt
82+
# related file was imported. This is allowed, fall back to Qt5
83+
# using which ever binding the rparams ask for.
84+
85+
QT_API = rcParams['backend.qt5']
8986

9087
# We will define an appropriate wrapper for the differing versions
9188
# of file dialog.

0 commit comments

Comments
 (0)