##// END OF EJS Templates
Clean up in Qt API switcher.
epatters -
Show More
@@ -1,22 +1,29 b''
1 1 """ A Qt API selector that can be used to switch between PyQt and PySide.
2 2 """
3 3
4 4 import os
5 5
6 # Available APIs.
7 QT_API_PYQT = 'pyqt'
8 QT_API_PYSIDE = 'pyside'
9
6 10 # Use PyQt by default until PySide is stable.
7 qt_api = os.environ.get('QT_API', 'pyqt')
11 QT_API = os.environ.get('QT_API', QT_API_PYQT)
8 12
9 if qt_api == 'pyqt':
13 if QT_API == QT_API_PYQT:
10 14 # For PySide compatibility, use the new string API that automatically
11 # converts QStrings to unicode Python strings.
15 # converts QStrings to Unicode Python strings.
12 16 import sip
13 17 sip.setapi('QString', 2)
14 18
15 19 from PyQt4 import QtCore, QtGui, QtSvg
16 20
17 21 # Alias PyQt-specific functions for PySide compatibility.
18 22 QtCore.Signal = QtCore.pyqtSignal
19 23 QtCore.Slot = QtCore.pyqtSlot
20 24
21 else:
25 elif QT_API == QT_API_PYSIDE:
22 26 from PySide import QtCore, QtGui, QtSvg
27
28 else:
29 raise RuntimeError('Invalid Qt API "%s"' % QT_API)
General Comments 0
You need to be logged in to leave comments. Login now