From ff3c3c3842790cc9eb06f1241d6da77f828859c1 2011-02-09 23:28:07 From: epatters Date: 2011-02-09 23:28:07 Subject: [PATCH] Clean up in Qt API switcher. --- diff --git a/IPython/external/qt.py b/IPython/external/qt.py index fa69821..8e99dbf 100644 --- a/IPython/external/qt.py +++ b/IPython/external/qt.py @@ -3,12 +3,16 @@ import os +# Available APIs. +QT_API_PYQT = 'pyqt' +QT_API_PYSIDE = 'pyside' + # Use PyQt by default until PySide is stable. -qt_api = os.environ.get('QT_API', 'pyqt') +QT_API = os.environ.get('QT_API', QT_API_PYQT) -if qt_api == 'pyqt': +if QT_API == QT_API_PYQT: # For PySide compatibility, use the new string API that automatically - # converts QStrings to unicode Python strings. + # converts QStrings to Unicode Python strings. import sip sip.setapi('QString', 2) @@ -18,5 +22,8 @@ if qt_api == 'pyqt': QtCore.Signal = QtCore.pyqtSignal QtCore.Slot = QtCore.pyqtSlot -else: +elif QT_API == QT_API_PYSIDE: from PySide import QtCore, QtGui, QtSvg + +else: + raise RuntimeError('Invalid Qt API "%s"' % QT_API)