Return a list of acceptable QT APIs, in decreasing order of preference.
()
| 90 | mpqt) |
| 91 | |
| 92 | def get_options(): |
| 93 | """Return a list of acceptable QT APIs, in decreasing order of preference.""" |
| 94 | #already imported Qt somewhere. Use that |
| 95 | loaded = loaded_api() |
| 96 | if loaded is not None: |
| 97 | return [loaded] |
| 98 | |
| 99 | mpl = sys.modules.get("matplotlib", None) |
| 100 | |
| 101 | if mpl is not None and tuple(mpl.__version__.split(".")) < ("1", "0", "2"): |
| 102 | # 1.0.1 only supports PyQt4 v1 |
| 103 | return [QT_API_PYQT_DEFAULT] |
| 104 | |
| 105 | qt_api = os.environ.get('QT_API', None) |
| 106 | if qt_api is None: |
| 107 | #no ETS variable. Ask mpl, then use default fallback path |
| 108 | return matplotlib_options(mpl) or [ |
| 109 | QT_API_PYQT_DEFAULT, |
| 110 | QT_API_PYQT6, |
| 111 | QT_API_PYSIDE6, |
| 112 | QT_API_PYQT5, |
| 113 | QT_API_PYSIDE2, |
| 114 | ] |
| 115 | elif qt_api not in _qt_apis: |
| 116 | raise RuntimeError("Invalid Qt API %r, valid values are: %r" % |
| 117 | (qt_api, ', '.join(_qt_apis))) |
| 118 | else: |
| 119 | return [qt_api] |
| 120 | |
| 121 | |
| 122 | api_opts = get_options() |
no test coverage detected
searching dependent graphs…