mirror of
https://github.com/wassname/scikit-image.git
synced 2026-06-29 08:31:54 +08:00
Separate qt version check from has_qt flag
This commit is contained in:
@@ -1,10 +1,13 @@
|
||||
_qt_version = None
|
||||
has_qt = True
|
||||
|
||||
try:
|
||||
from matplotlib.backends.qt_compat import QtGui, QtCore, QtWidgets, QT_RC_MAJOR_VERSION as has_qt
|
||||
from matplotlib.backends.qt_compat import QtGui, QtCore, QtWidgets, QT_RC_MAJOR_VERSION as _qt_version
|
||||
except ImportError:
|
||||
try:
|
||||
from matplotlib.backends.qt4_compat import QtGui, QtCore
|
||||
QtWidgets = QtGui
|
||||
has_qt = 4
|
||||
_qt_version = 4
|
||||
except ImportError:
|
||||
# Mock objects
|
||||
class QtGui_cls(object):
|
||||
@@ -27,14 +30,13 @@ except ImportError:
|
||||
|
||||
has_qt = False
|
||||
|
||||
if has_qt == 5:
|
||||
if _qt_version == 5:
|
||||
from matplotlib.backends.backend_qt5 import FigureManagerQT
|
||||
from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg
|
||||
elif has_qt == 4:
|
||||
elif _qt_version == 4:
|
||||
from matplotlib.backends.backend_qt4 import FigureManagerQT
|
||||
from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg
|
||||
else:
|
||||
assert not has_qt, 'Unsupported Qt version {0}'.format(has_qt)
|
||||
FigureManagerQT = object
|
||||
FigureCanvasQTAgg = object
|
||||
|
||||
|
||||
Reference in New Issue
Block a user