Ticket #38303: IPython_external_qt.py.diff
File IPython_external_qt.py.diff, 1.6 KB (added by eborisch (Eric A. Borisch), 12 years ago) |
---|
-
IPython/external/qt.py
old new 7 7 """ 8 8 9 9 import os 10 import distutils.version as DV 11 VER_LT = lambda a,b: DV.LooseVersion(a) < DV.LooseVersion(b) 10 12 11 13 # Available APIs. 12 14 QT_API_PYQT = 'pyqt' … … 25 27 if QT_API is None: 26 28 try: 27 29 import PySide 28 if PySide.__version__ < '1.0.3':30 if VER_LT(PySide.__version__, '1.0.3'): 29 31 # old PySide, fallback on PyQt 30 32 raise ImportError 31 33 from PySide import QtCore, QtGui, QtSvg … … 35 37 prepare_pyqt4() 36 38 import PyQt4 37 39 from PyQt4 import QtCore, QtGui, QtSvg 38 if QtCore.PYQT_VERSION_STR < '4.7':40 if VER_LT(QtCore.PYQT_VERSION_STR, '4.7'): 39 41 # PyQt 4.6 has issues with null strings returning as None 40 42 raise ImportError 41 43 QT_API = QT_API_PYQT … … 49 51 # Now peform the imports. 50 52 if QT_API == QT_API_PYQT: 51 53 from PyQt4 import QtCore, QtGui, QtSvg 52 if QtCore.PYQT_VERSION_STR < '4.7':54 if VER_LT(QtCore.PYQT_VERSION_STR, '4.7'): 53 55 raise ImportError("IPython requires PyQt4 >= 4.7, found %s"%QtCore.PYQT_VERSION_STR) 54 56 55 57 # Alias PyQt-specific functions for PySide compatibility. … … 58 60 59 61 elif QT_API == QT_API_PYSIDE: 60 62 import PySide 61 if PySide.__version__ < '1.0.3':63 if VER_LT(PySide.__version__, '1.0.3'): 62 64 raise ImportError("IPython requires PySide >= 1.0.3, found %s"%PySide.__version__) 63 65 from PySide import QtCore, QtGui, QtSvg 64 66