Return a list of acceptable QT APIs, in decreasing order of preference
()
| 66 | mpqt) |
| 67 | |
| 68 | def get_options(): |
| 69 | """Return a list of acceptable QT APIs, in decreasing order of |
| 70 | preference |
| 71 | """ |
| 72 | #already imported Qt somewhere. Use that |
| 73 | loaded = loaded_api() |
| 74 | if loaded is not None: |
| 75 | return [loaded] |
| 76 | |
| 77 | mpl = sys.modules.get('matplotlib', None) |
| 78 | |
| 79 | if mpl is not None and not check_version(mpl.__version__, '1.0.2'): |
| 80 | #1.0.1 only supports PyQt4 v1 |
| 81 | return [QT_API_PYQT_DEFAULT] |
| 82 | |
| 83 | qt_api = os.environ.get('QT_API', None) |
| 84 | if qt_api is None: |
| 85 | #no ETS variable. Ask mpl, then use default fallback path |
| 86 | return matplotlib_options(mpl) or [QT_API_PYQT_DEFAULT, QT_API_PYSIDE, |
| 87 | QT_API_PYQT5, QT_API_PYSIDE2] |
| 88 | elif qt_api not in _qt_apis: |
| 89 | raise RuntimeError("Invalid Qt API %r, valid values are: %r" % |
| 90 | (qt_api, ', '.join(_qt_apis))) |
| 91 | else: |
| 92 | return [qt_api] |
| 93 | |
| 94 | api_opts = get_options() |
| 95 | QtCore, QtGui, QtSvg, QT_API = load_qt(api_opts) |
no test coverage detected