##// END OF EJS Templates
Remove %pastebin command - wasn't meant to be in master.
Remove %pastebin command - wasn't meant to be in master.

File last commit:

r3364:48ca8275
r3490:eeb2163c
Show More
qt.py
32 lines | 948 B | text/x-python | PythonLexer
Evan Patterson
Paved the way for PySide support....
r3304 """ A Qt API selector that can be used to switch between PyQt and PySide.
"""
import os
epatters
Clean up in Qt API switcher.
r3306 # Available APIs.
QT_API_PYQT = 'pyqt'
QT_API_PYSIDE = 'pyside'
Evan Patterson
Paved the way for PySide support....
r3304 # Use PyQt by default until PySide is stable.
epatters
Clean up in Qt API switcher.
r3306 QT_API = os.environ.get('QT_API', QT_API_PYQT)
Evan Patterson
Paved the way for PySide support....
r3304
epatters
Clean up in Qt API switcher.
r3306 if QT_API == QT_API_PYQT:
epatters
Fixed PySide incompatibility with QVariant....
r3364 # For PySide compatibility, use the new-style string API that automatically
# converts QStrings to Unicode Python strings. Also, automatically unpack
# QVariants to their underlying objects.
Evan Patterson
Paved the way for PySide support....
r3304 import sip
sip.setapi('QString', 2)
epatters
Fixed PySide incompatibility with QVariant....
r3364 sip.setapi('QVariant', 2)
Evan Patterson
Paved the way for PySide support....
r3304
from PyQt4 import QtCore, QtGui, QtSvg
# Alias PyQt-specific functions for PySide compatibility.
QtCore.Signal = QtCore.pyqtSignal
QtCore.Slot = QtCore.pyqtSlot
epatters
Clean up in Qt API switcher.
r3306 elif QT_API == QT_API_PYSIDE:
Evan Patterson
Paved the way for PySide support....
r3304 from PySide import QtCore, QtGui, QtSvg
epatters
Clean up in Qt API switcher.
r3306
else:
epatters
Improved error message for Qt API switcher.
r3334 raise RuntimeError('Invalid Qt API %r, valid values are: %r or %r' %
(QT_API, QT_API_PYQT, QT_API_PYSIDE))