##// END OF EJS Templates
Merge pull request #2757 from juliantaylor/incomplete-pyside...
Bradley M. Froehle -
r9084:de2743b1 merge
parent child Browse files
Show More
@@ -23,11 +23,20 b' def prepare_pyqt4():'
23 # Select Qt binding, using the QT_API environment variable if available.
23 # Select Qt binding, using the QT_API environment variable if available.
24 QT_API = os.environ.get('QT_API')
24 QT_API = os.environ.get('QT_API')
25 if QT_API is None:
25 if QT_API is None:
26 pyside_found = False
26 try:
27 try:
27 import PySide
28 import PySide
28 if PySide.__version__ < '1.0.3':
29 if PySide.__version__ < '1.0.3':
29 # old PySide, fallback on PyQt
30 # old PySide, fallback on PyQt
30 raise ImportError
31 raise ImportError
32 # we can't import an incomplete pyside and pyqt4
33 # this will cause a crash in sip (#1431)
34 # check for complete presence before importing
35 import imp
36 imp.find_module("QtCore", PySide.__path__)
37 imp.find_module("QtGui", PySide.__path__)
38 imp.find_module("QtSvg", PySide.__path__)
39 pyside_found = True
31 from PySide import QtCore, QtGui, QtSvg
40 from PySide import QtCore, QtGui, QtSvg
32 QT_API = QT_API_PYSIDE
41 QT_API = QT_API_PYSIDE
33 except ImportError:
42 except ImportError:
@@ -35,6 +44,11 b' if QT_API is None:'
35 prepare_pyqt4()
44 prepare_pyqt4()
36 import PyQt4
45 import PyQt4
37 from PyQt4 import QtCore, QtGui, QtSvg
46 from PyQt4 import QtCore, QtGui, QtSvg
47 if pyside_found:
48 print "WARNING: PySide installation incomplete and PyQt4 " \
49 "present.\nThis will likely crash, please install " \
50 "PySide completely, remove PySide or PyQt4 or set " \
51 "the QT_API environment variable to pyqt or pyside"
38 if QtCore.PYQT_VERSION_STR < '4.7':
52 if QtCore.PYQT_VERSION_STR < '4.7':
39 # PyQt 4.6 has issues with null strings returning as None
53 # PyQt 4.6 has issues with null strings returning as None
40 raise ImportError
54 raise ImportError
General Comments 0
You need to be logged in to leave comments. Login now