from PyQt4.QtGui import QDialog, QVBoxLayout, QGridLayout, \ QLabel, QComboBox, QHBoxLayout, QRadioButton, \ QPushButton, QApplication, QColorDialog, QMainWindow, \ QWidget, QTreeWidgetItem, QButtonGroup, QTreeWidget, \ QSplitter, QTabWidget, QMenuBar, QMessageBox, QSpacerItem, \ QLineEdit, QHeaderView, QSpinBox, QTextBrowser, \ QMenu, QAction, QTabBar, QStackedWidget, QFileDialog, \ QScrollArea, QProgressBar, QStyleOptionSlider, QGroupBox, \ QAbstractItemView, QSizePolicy, QFrame, QStyle, QScrollBar, QToolBar, \ QDialogButtonBox, QToolButton, QCheckBox, QLayout from PyQt4.QtGui import QFont, QIcon, QFontMetrics, QPen, QColor, QPainter, \ QPixmap, QBrush, QPainterPath , QDesktopServices from PyQt4.QtCore import QObject, QTimer, QProcess, QEvent, QSize, \ QLine, QRect, QPoint, QRectF, QUrl, QCoreApplication, \ pyqtSignal from PyQt4.QtGui import QPrinter, QPrintDialog, qApp from PyQt4.QtCore import QT_VERSION_STR def getQApp(): return qApp g_rc.qt_imported = True g_rc.qt_variant = 'PyQt4' g_rc.qt_version = map(int, QT_VERSION_STR.split(".")) except: pass
QTreeView, QTreeWidget, QTreeWidgetItem, QTreeWidgetItemIterator, QValidator, QVBoxLayout, QWidget, ) from PyQt4.uic import loadUi def getQApp(): return qApp qt_imported = True qt_variant = "PyQt4" qt_version_no = list(map(int, QT_VERSION_STR.split("."))) _ver = PYQT_VERSION_STR.split(".") ver = _ver + ["0"] * (3 - len(_ver)) pyqt_version_no = list(map(int, ver))[:3] except BaseException: pass try: from PyQt4.QtWebKit import QWebPage except ImportError: pass # # PySide # if (qt_variant == "PySide") or (qt_variant is None and not qt_imported):
customWidgets={'Line': QtGui.QFrame}) sys.modules["PySide.uic"] = uic matplotlib.rcParams['backend.qt4'] = 'PySide' Qt_version = QtCore.__version_info__ else: try: from PyQt4 import QtGui, QtCore, uic, QtWebKit from PyQt4.QtCore import SIGNAL, pyqtSignal as Signal except ImportError: has_Qt = False from PyQt4.QtCore import QT_VERSION_STR from PyQt4.Qt import PYQT_VERSION_STR from sip import SIP_VERSION_STR Qt_version = tuple(int(i) for i in QT_VERSION_STR.split(".")[:3]) SIP_version = tuple(int(i) for i in SIP_VERSION_STR.split(".")[:3]) PyQt_version = tuple(int(i) for i in PYQT_VERSION_STR.split(".")[:3]) if has_Qt: matplotlib.rcParams['backend'] = 'Qt4Agg' import matplotlib.pyplot matplotlib.pyplot.switch_backend('Qt4Agg') # Dear reader, I apologize for something that ugly ! # Any cleaner version would be appreciated # matplotlib.use('Qt4Agg') from matplotlib.backends import backend_qt4 as backend from matplotlib import pyplot from matplotlib import pylab else:
customWidgets={'Line': QtGui.QFrame}) sys.modules["PySide.uic"] = uic matplotlib.rcParams['backend.qt4'] = 'PySide' Qt_version = QtCore.__version_info__ else: try: from PyQt4 import QtGui, QtCore, uic, QtWebKit from PyQt4.QtCore import SIGNAL, pyqtSignal as Signal except ImportError: has_Qt = False else: from PyQt4.QtCore import QT_VERSION_STR from PyQt4.Qt import PYQT_VERSION_STR from sip import SIP_VERSION_STR Qt_version = tuple(int(i) for i in QT_VERSION_STR.split(".")[:3]) SIP_version = tuple(int(i) for i in SIP_VERSION_STR.split(".")[:3]) PyQt_version = tuple(int(i) for i in PYQT_VERSION_STR.split(".")[:3]) if has_Qt: matplotlib.rcParams['backend'] = 'Qt4Agg' import matplotlib.pyplot matplotlib.pyplot.switch_backend('Qt4Agg') # Dear reader, I apologize for something that ugly ! # Any cleaner version would be appreciated # matplotlib.use('Qt4Agg') from matplotlib.backends import backend_qt4 as backend from matplotlib import pyplot from matplotlib import pylab else: