File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 7070 # compatible use the env variable.
7171 QT_API = ETS [QT_API_ENV ][0 ]
7272
73+ _fallback_to_qt4 = False
7374if QT_API is None :
7475 # No ETS environment or incompatible so use rcParams.
7576 if rcParams ['backend' ] == 'Qt5Agg' :
8182 # bindings is imported, but we still got here because a Qt
8283 # related file was imported. This is allowed, fall back to Qt5
8384 # using which ever binding the rparams ask for.
84-
85+ _fallback_to_qt4 = True
8586 QT_API = rcParams ['backend.qt5' ]
8687
8788# We will define an appropriate wrapper for the differing versions
127128 from PyQt5 import QtCore , QtGui , QtWidgets
128129 _getSaveFileName = QtWidgets .QFileDialog .getSaveFileName
129130 except ImportError :
130- # fell through, tried PyQt5, failed fall back to PyQt4
131- QT_API = rcParams ['backend.qt4' ]
132- QT_RC_MAJOR_VERSION = 4
131+ if _fallback_to_qt4 :
132+ # fell through, tried PyQt5, failed fall back to PyQt4
133+ QT_API = rcParams ['backend.qt4' ]
134+ QT_RC_MAJOR_VERSION = 4
135+ else :
136+ raise
133137
134138 # needs to be if so we can re-test the value of QT_API which may
135139 # have been changed in the above if block
You can’t perform that action at this time.
0 commit comments