| 41 | |
| 42 | #Constraints placed on an imported matplotlib |
| 43 | def matplotlib_options(mpl): |
| 44 | if mpl is None: |
| 45 | return |
| 46 | backend = mpl.rcParams.get('backend', None) |
| 47 | if backend == 'Qt4Agg': |
| 48 | mpqt = mpl.rcParams.get('backend.qt4', None) |
| 49 | if mpqt is None: |
| 50 | return None |
| 51 | if mpqt.lower() == 'pyside': |
| 52 | return [QT_API_PYSIDE] |
| 53 | elif mpqt.lower() == 'pyqt4': |
| 54 | return [QT_API_PYQT_DEFAULT] |
| 55 | elif mpqt.lower() == 'pyqt4v2': |
| 56 | return [QT_API_PYQT] |
| 57 | raise ImportError("unhandled value for backend.qt4 from matplotlib: %r" % |
| 58 | mpqt) |
| 59 | elif backend == 'Qt5Agg': |
| 60 | mpqt = mpl.rcParams.get('backend.qt5', None) |
| 61 | if mpqt is None: |
| 62 | return None |
| 63 | if mpqt.lower() == 'pyqt5': |
| 64 | return [QT_API_PYQT5] |
| 65 | raise ImportError("unhandled value for backend.qt5 from matplotlib: %r" % |
| 66 | mpqt) |
| 67 | |
| 68 | def get_options(): |
| 69 | """Return a list of acceptable QT APIs, in decreasing order of |