##// END OF EJS Templates
Fixed bug in creating error dialog for failed HTML export.
Fixed bug in creating error dialog for failed HTML export.

File last commit:

r3334:7eb92cb8
r3363:9bd09eab
Show More
qt.py
30 lines | 840 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:
Evan Patterson
Paved the way for PySide support....
r3304 # For PySide compatibility, use the new string API that automatically
epatters
Clean up in Qt API switcher.
r3306 # converts QStrings to Unicode Python strings.
Evan Patterson
Paved the way for PySide support....
r3304 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
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))