Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
version check Qt bindings in external.qt
require PySide >= 1.0.3 or PyQt4 >= 4.7 closes gh-724
- Loading branch information
Showing
1 changed file
with
13 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
|
@@ -25,14 +25,21 @@ def prepare_pyqt4(): | ||
if QT_API is None: | if QT_API is None: | ||
try: | try: | ||
import PySide | import PySide | ||
if PySide.__version__ < '1.0.3': | |||
# old PySide, fallback on PyQt | |||
raise ImportError | |||
QT_API = QT_API_PYSIDE | QT_API = QT_API_PYSIDE | ||
except ImportError: | except ImportError: | ||
try: | try: | ||
prepare_pyqt4() | prepare_pyqt4() | ||
import PyQt4 | import PyQt4 | ||
from PyQt4 import QtCore | |||
if QtCore.PYQT_VERSION_STR < '4.7': | |||
# PyQt 4.6 has issues with null strings returning as None | |||
raise ImportError | |||
QT_API = QT_API_PYQT | QT_API = QT_API_PYQT | ||
except ImportError: | except ImportError: | ||
raise ImportError('Cannot import PySide or PyQt4') | raise ImportError('Cannot import PySide >= 1.0.3 or PyQt4 >= 4.7') | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
rajeeja
via email
|
|||
|
|
||
elif QT_API == QT_API_PYQT: | elif QT_API == QT_API_PYQT: | ||
# Note: This must be called *before* PyQt4 is imported. | # Note: This must be called *before* PyQt4 is imported. | ||
|
@@ -41,12 +48,17 @@ def prepare_pyqt4(): | ||
# Now peform the imports. | # Now peform the imports. | ||
if QT_API == QT_API_PYQT: | if QT_API == QT_API_PYQT: | ||
from PyQt4 import QtCore, QtGui, QtSvg | from PyQt4 import QtCore, QtGui, QtSvg | ||
if QtCore.PYQT_VERSION_STR < '4.7': | |||
raise ImportError("IPython requires PyQt4 >= 4.7, found %s"%QtCore.PYQT_VERSION_STR) | |||
|
|
||
# Alias PyQt-specific functions for PySide compatibility. | # Alias PyQt-specific functions for PySide compatibility. | ||
QtCore.Signal = QtCore.pyqtSignal | QtCore.Signal = QtCore.pyqtSignal | ||
QtCore.Slot = QtCore.pyqtSlot | QtCore.Slot = QtCore.pyqtSlot | ||
|
|
||
elif QT_API == QT_API_PYSIDE: | elif QT_API == QT_API_PYSIDE: | ||
import PySide | |||
if PySide.__version__ < '1.0.3': | |||
raise ImportError("IPython requires PySide >= 1.0.3, found %s"%PySide.__version__) | |||
from PySide import QtCore, QtGui, QtSvg | from PySide import QtCore, QtGui, QtSvg | ||
|
|
||
else: | else: | ||
|
@rajeeja: Hi, welcome to IPython. The best thing for this sort of problem is to join the ipython-user mailing list and ask for help there - that way more people will see your question. http://mail.scipy.org/mailman/listinfo/ipython-user