Show More
@@ -35,9 +35,12 b' import os' | |||||
35 | import sys |
|
35 | import sys | |
36 |
|
36 | |||
37 | from IPython.utils.version import check_version |
|
37 | from IPython.utils.version import check_version | |
38 | from IPython.external.qt_loaders import (load_qt, QT_API_PYSIDE, |
|
38 | from IPython.external.qt_loaders import (load_qt, loaded_api, QT_API_PYSIDE, | |
39 |
QT_API_PYQT, QT_API_PYQT |
|
39 | QT_API_PYQT, QT_API_PYQT5, | |
40 |
|
|
40 | QT_API_PYQTv1, QT_API_PYQT_DEFAULT) | |
|
41 | ||||
|
42 | _qt_apis = (QT_API_PYSIDE, QT_API_PYQT, QT_API_PYQT5, QT_API_PYQTv1, | |||
|
43 | QT_API_PYQT_DEFAULT) | |||
41 |
|
44 | |||
42 | #Constraints placed on an imported matplotlib |
|
45 | #Constraints placed on an imported matplotlib | |
43 | def matplotlib_options(mpl): |
|
46 | def matplotlib_options(mpl): | |
@@ -68,16 +71,15 b' def get_options():' | |||||
68 | #1.0.1 only supports PyQt4 v1 |
|
71 | #1.0.1 only supports PyQt4 v1 | |
69 | return [QT_API_PYQT_DEFAULT] |
|
72 | return [QT_API_PYQT_DEFAULT] | |
70 |
|
73 | |||
71 |
|
|
74 | qt_api = os.environ.get('QT_API', None) | |
|
75 | if qt_api is None: | |||
72 | #no ETS variable. Ask mpl, then use either |
|
76 | #no ETS variable. Ask mpl, then use either | |
73 | return matplotlib_options(mpl) or [QT_API_PYQT_DEFAULT, QT_API_PYSIDE] |
|
77 | return matplotlib_options(mpl) or [QT_API_PYQT_DEFAULT, QT_API_PYSIDE] | |
74 |
|
78 | elif qt_api not in _qt_apis: | ||
75 | #ETS variable present. Will fallback to external.qt |
|
79 | raise RuntimeError("Invalid Qt API %r, valid values are: %r" % | |
76 | return None |
|
80 | (qt_api, ' ,'.join(_qt_apis))) | |
|
81 | else: | |||
|
82 | return [qt_api] | |||
77 |
|
83 | |||
78 | api_opts = get_options() |
|
84 | api_opts = get_options() | |
79 | if api_opts is not None: |
|
85 | QtCore, QtGui, QtSvg, QT_API = load_qt(api_opts) | |
80 | QtCore, QtGui, QtSvg, QT_API = load_qt(api_opts) |
|
|||
81 |
|
||||
82 | else: # use ETS variable |
|
|||
83 | from IPython.external.qt import QtCore, QtGui, QtSvg, QT_API |
|
General Comments 0
You need to be logged in to leave comments.
Login now