##// END OF EJS Templates
Paved the way for PySide support....
Paved the way for PySide support. Created a Qt API switcher that imports PyQt4 or PySide as appropriate. If PyQt4 is loaded, the new-style QString API is used. This facillates both Python 3 and PySide compatibility.

File last commit:

r3304:3cc304dd
r3304:3cc304dd
Show More
qt.py
22 lines | 599 B | text/x-python | PythonLexer
""" A Qt API selector that can be used to switch between PyQt and PySide.
"""
import os
# Use PyQt by default until PySide is stable.
qt_api = os.environ.get('QT_API', 'pyqt')
if qt_api == 'pyqt':
# For PySide compatibility, use the new string API that automatically
# converts QStrings to unicode Python strings.
import sip
sip.setapi('QString', 2)
from PyQt4 import QtCore, QtGui, QtSvg
# Alias PyQt-specific functions for PySide compatibility.
QtCore.Signal = QtCore.pyqtSignal
QtCore.Slot = QtCore.pyqtSlot
else:
from PySide import QtCore, QtGui, QtSvg