diff --git a/GraphicsScene/GraphicsScene.py b/GraphicsScene/GraphicsScene.py index 03436a97..6ac5c5e2 100644 --- a/GraphicsScene/GraphicsScene.py +++ b/GraphicsScene/GraphicsScene.py @@ -1,4 +1,5 @@ from pyqtgraph.Qt import QtCore, QtGui + from pyqtgraph.python2_3 import sortList #try: #from PyQt4 import QtOpenGL diff --git a/GraphicsScene/exportDialog.py b/GraphicsScene/exportDialog.py index 227926c1..dafcd501 100644 --- a/GraphicsScene/exportDialog.py +++ b/GraphicsScene/exportDialog.py @@ -1,8 +1,12 @@ -from . import exportDialogTemplate -from pyqtgraph.Qt import QtCore, QtGui +from pyqtgraph.Qt import QtCore, QtGui, USE_PYSIDE import pyqtgraph as pg import pyqtgraph.exporters as exporters +if USE_PYSIDE: + from . import exportDialogTemplate_pyside as exportDialogTemplate +else: + from . import exportDialogTemplate_pyqt as exportDialogTemplate + class ExportDialog(QtGui.QWidget): def __init__(self, scene): diff --git a/GraphicsScene/exportDialogTemplate.py b/GraphicsScene/exportDialogTemplate_pyqt.py similarity index 94% rename from GraphicsScene/exportDialogTemplate.py rename to GraphicsScene/exportDialogTemplate_pyqt.py index 60f18d0d..20609b51 100644 --- a/GraphicsScene/exportDialogTemplate.py +++ b/GraphicsScene/exportDialogTemplate_pyqt.py @@ -1,9 +1,9 @@ # -*- coding: utf-8 -*- -# Form implementation generated from reading ui file 'exportDialogTemplate.ui' +# Form implementation generated from reading ui file './GraphicsScene/exportDialogTemplate.ui' # -# Created: Thu Mar 22 13:13:06 2012 -# by: PyQt4 UI code generator 4.8.5 +# Created: Sun Sep 9 14:41:31 2012 +# by: PyQt4 UI code generator 4.9.1 # # WARNING! All changes made in this file will be lost! @@ -18,12 +18,10 @@ class Ui_Form(object): def setupUi(self, Form): Form.setObjectName(_fromUtf8("Form")) Form.resize(241, 367) - Form.setWindowTitle(QtGui.QApplication.translate("Form", "Export", None, QtGui.QApplication.UnicodeUTF8)) self.gridLayout = QtGui.QGridLayout(Form) self.gridLayout.setSpacing(0) self.gridLayout.setObjectName(_fromUtf8("gridLayout")) self.label = QtGui.QLabel(Form) - self.label.setText(QtGui.QApplication.translate("Form", "Item to export:", None, QtGui.QApplication.UnicodeUTF8)) self.label.setObjectName(_fromUtf8("label")) self.gridLayout.addWidget(self.label, 0, 0, 1, 3) self.itemTree = QtGui.QTreeWidget(Form) @@ -32,18 +30,15 @@ class Ui_Form(object): self.itemTree.header().setVisible(False) self.gridLayout.addWidget(self.itemTree, 1, 0, 1, 3) self.label_2 = QtGui.QLabel(Form) - self.label_2.setText(QtGui.QApplication.translate("Form", "Export format", None, QtGui.QApplication.UnicodeUTF8)) self.label_2.setObjectName(_fromUtf8("label_2")) self.gridLayout.addWidget(self.label_2, 2, 0, 1, 3) self.formatList = QtGui.QListWidget(Form) self.formatList.setObjectName(_fromUtf8("formatList")) self.gridLayout.addWidget(self.formatList, 3, 0, 1, 3) self.exportBtn = QtGui.QPushButton(Form) - self.exportBtn.setText(QtGui.QApplication.translate("Form", "Export", None, QtGui.QApplication.UnicodeUTF8)) self.exportBtn.setObjectName(_fromUtf8("exportBtn")) self.gridLayout.addWidget(self.exportBtn, 6, 1, 1, 1) self.closeBtn = QtGui.QPushButton(Form) - self.closeBtn.setText(QtGui.QApplication.translate("Form", "Close", None, QtGui.QApplication.UnicodeUTF8)) self.closeBtn.setObjectName(_fromUtf8("closeBtn")) self.gridLayout.addWidget(self.closeBtn, 6, 2, 1, 1) self.paramTree = ParameterTree(Form) @@ -52,7 +47,6 @@ class Ui_Form(object): self.paramTree.header().setVisible(False) self.gridLayout.addWidget(self.paramTree, 5, 0, 1, 3) self.label_3 = QtGui.QLabel(Form) - self.label_3.setText(QtGui.QApplication.translate("Form", "Export options", None, QtGui.QApplication.UnicodeUTF8)) self.label_3.setObjectName(_fromUtf8("label_3")) self.gridLayout.addWidget(self.label_3, 4, 0, 1, 3) @@ -60,6 +54,11 @@ class Ui_Form(object): QtCore.QMetaObject.connectSlotsByName(Form) def retranslateUi(self, Form): - pass + Form.setWindowTitle(QtGui.QApplication.translate("Form", "Export", None, QtGui.QApplication.UnicodeUTF8)) + self.label.setText(QtGui.QApplication.translate("Form", "Item to export:", None, QtGui.QApplication.UnicodeUTF8)) + self.label_2.setText(QtGui.QApplication.translate("Form", "Export format", None, QtGui.QApplication.UnicodeUTF8)) + self.exportBtn.setText(QtGui.QApplication.translate("Form", "Export", None, QtGui.QApplication.UnicodeUTF8)) + self.closeBtn.setText(QtGui.QApplication.translate("Form", "Close", None, QtGui.QApplication.UnicodeUTF8)) + self.label_3.setText(QtGui.QApplication.translate("Form", "Export options", None, QtGui.QApplication.UnicodeUTF8)) from pyqtgraph.parametertree import ParameterTree diff --git a/GraphicsScene/exportDialogTemplate_pyside.py b/GraphicsScene/exportDialogTemplate_pyside.py new file mode 100644 index 00000000..4ffc0b9a --- /dev/null +++ b/GraphicsScene/exportDialogTemplate_pyside.py @@ -0,0 +1,59 @@ +# -*- coding: utf-8 -*- + +# Form implementation generated from reading ui file './GraphicsScene/exportDialogTemplate.ui' +# +# Created: Sun Sep 9 14:41:31 2012 +# by: pyside-uic 0.2.13 running on PySide 1.1.0 +# +# WARNING! All changes made in this file will be lost! + +from PySide import QtCore, QtGui + +class Ui_Form(object): + def setupUi(self, Form): + Form.setObjectName("Form") + Form.resize(241, 367) + self.gridLayout = QtGui.QGridLayout(Form) + self.gridLayout.setSpacing(0) + self.gridLayout.setObjectName("gridLayout") + self.label = QtGui.QLabel(Form) + self.label.setObjectName("label") + self.gridLayout.addWidget(self.label, 0, 0, 1, 3) + self.itemTree = QtGui.QTreeWidget(Form) + self.itemTree.setObjectName("itemTree") + self.itemTree.headerItem().setText(0, "1") + self.itemTree.header().setVisible(False) + self.gridLayout.addWidget(self.itemTree, 1, 0, 1, 3) + self.label_2 = QtGui.QLabel(Form) + self.label_2.setObjectName("label_2") + self.gridLayout.addWidget(self.label_2, 2, 0, 1, 3) + self.formatList = QtGui.QListWidget(Form) + self.formatList.setObjectName("formatList") + self.gridLayout.addWidget(self.formatList, 3, 0, 1, 3) + self.exportBtn = QtGui.QPushButton(Form) + self.exportBtn.setObjectName("exportBtn") + self.gridLayout.addWidget(self.exportBtn, 6, 1, 1, 1) + self.closeBtn = QtGui.QPushButton(Form) + self.closeBtn.setObjectName("closeBtn") + self.gridLayout.addWidget(self.closeBtn, 6, 2, 1, 1) + self.paramTree = ParameterTree(Form) + self.paramTree.setObjectName("paramTree") + self.paramTree.headerItem().setText(0, "1") + self.paramTree.header().setVisible(False) + self.gridLayout.addWidget(self.paramTree, 5, 0, 1, 3) + self.label_3 = QtGui.QLabel(Form) + self.label_3.setObjectName("label_3") + self.gridLayout.addWidget(self.label_3, 4, 0, 1, 3) + + self.retranslateUi(Form) + QtCore.QMetaObject.connectSlotsByName(Form) + + def retranslateUi(self, Form): + Form.setWindowTitle(QtGui.QApplication.translate("Form", "Export", None, QtGui.QApplication.UnicodeUTF8)) + self.label.setText(QtGui.QApplication.translate("Form", "Item to export:", None, QtGui.QApplication.UnicodeUTF8)) + self.label_2.setText(QtGui.QApplication.translate("Form", "Export format", None, QtGui.QApplication.UnicodeUTF8)) + self.exportBtn.setText(QtGui.QApplication.translate("Form", "Export", None, QtGui.QApplication.UnicodeUTF8)) + self.closeBtn.setText(QtGui.QApplication.translate("Form", "Close", None, QtGui.QApplication.UnicodeUTF8)) + self.label_3.setText(QtGui.QApplication.translate("Form", "Export options", None, QtGui.QApplication.UnicodeUTF8)) + +from pyqtgraph.parametertree import ParameterTree diff --git a/Qt.py b/Qt.py index ff3becdd..2f337942 100644 --- a/Qt.py +++ b/Qt.py @@ -1,8 +1,23 @@ ## Do all Qt imports from here to allow easier PyQt / PySide compatibility +import sys -USE_PYSIDE = False ## If False, import PyQt4. If True, import PySide - ## Note that when switching between PyQt and PySide, all template - ## files (*.ui) must be rebuilt for the target library. +## Automatically determine whether to use PyQt or PySide. +## This is done by first checking to see whether one of the libraries +## is already imported. If not, then attempt to import PyQt4, then PySide. +if 'PyQt4' in sys.modules: + USE_PYSIDE = False +elif 'PySide' in sys.modules: + USE_PYSIDE = True +else: + try: + import PyQt4 + USE_PYSIDE = False + except ImportError: + try: + import Pyside + USE_PYSIDE = True + except ImportError: + raise Exception("PyQtGraph requires either PyQt4 or PySide; neither package could be imported.") if USE_PYSIDE: from PySide import QtGui, QtCore, QtOpenGL, QtSvg diff --git a/__init__.py b/__init__.py index b9133b8f..4da9faee 100644 --- a/__init__.py +++ b/__init__.py @@ -72,6 +72,10 @@ def renamePyc(startDir): ### Used to rename orphaned .pyc files ### When a python file changes its location in the repository, usually the .pyc file ### is left behind, possibly causing mysterious and difficult to track bugs. + + ### Note that this is no longer necessary for python 3.2; from PEP 3147: + ### "If the py source file is missing, the pyc file inside __pycache__ will be ignored. + ### This eliminates the problem of accidental stale pyc file imports." printed = False startDir = os.path.abspath(startDir) diff --git a/canvas/Canvas.py b/canvas/Canvas.py index 659480fd..5275eef3 100644 --- a/canvas/Canvas.py +++ b/canvas/Canvas.py @@ -4,15 +4,21 @@ if __name__ == '__main__': md = os.path.dirname(os.path.abspath(__file__)) sys.path = [os.path.dirname(md), os.path.join(md, '..', '..', '..')] + sys.path #print md - -from .CanvasTemplate import * + + #from pyqtgraph.GraphicsView import GraphicsView #import pyqtgraph.graphicsItems as graphicsItems #from pyqtgraph.PlotWidget import PlotWidget -from pyqtgraph.Qt import QtGui, QtCore +from pyqtgraph.Qt import QtGui, QtCore, USE_PYSIDE from pyqtgraph.graphicsItems.ROI import ROI from pyqtgraph.graphicsItems.ViewBox import ViewBox from pyqtgraph.graphicsItems.GridItem import GridItem + +if USE_PYSIDE: + from .CanvasTemplate_pyside import * +else: + from .CanvasTemplate_pyqt import * + #import DataManager import numpy as np from pyqtgraph import debug diff --git a/canvas/CanvasItem.py b/canvas/CanvasItem.py index 6473896b..a5e8d02c 100644 --- a/canvas/CanvasItem.py +++ b/canvas/CanvasItem.py @@ -1,8 +1,12 @@ # -*- coding: utf-8 -*- -from pyqtgraph.Qt import QtGui, QtCore, QtSvg +from pyqtgraph.Qt import QtGui, QtCore, QtSvg, USE_PYSIDE from pyqtgraph.graphicsItems.ROI import ROI import pyqtgraph as pg -from . import TransformGuiTemplate +if USE_PYSIDE: + from . import TransformGuiTemplate_pyside as TransformGuiTemplate +else: + from . import TransformGuiTemplate_pyqt as TransformGuiTemplate + from pyqtgraph import debug class SelectBox(ROI): diff --git a/canvas/CanvasTemplate.py b/canvas/CanvasTemplate_pyqt.py similarity index 96% rename from canvas/CanvasTemplate.py rename to canvas/CanvasTemplate_pyqt.py index 40a2511b..4d1d8208 100644 --- a/canvas/CanvasTemplate.py +++ b/canvas/CanvasTemplate_pyqt.py @@ -1,9 +1,9 @@ # -*- coding: utf-8 -*- -# Form implementation generated from reading ui file './lib/util/pyqtgraph/canvas/CanvasTemplate.ui' +# Form implementation generated from reading ui file './canvas/CanvasTemplate.ui' # -# Created: Wed Apr 18 13:40:19 2012 -# by: PyQt4 UI code generator 4.8.3 +# Created: Sun Sep 9 14:41:30 2012 +# by: PyQt4 UI code generator 4.9.1 # # WARNING! All changes made in this file will be lost! @@ -96,5 +96,5 @@ class Ui_Form(object): self.reflectSelectionBtn.setText(QtGui.QApplication.translate("Form", "MirrorXY", None, QtGui.QApplication.UnicodeUTF8)) from pyqtgraph.widgets.GraphicsView import GraphicsView -from .CanvasManager import CanvasCombo +from CanvasManager import CanvasCombo from pyqtgraph.widgets.TreeWidget import TreeWidget diff --git a/canvas/CanvasTemplate_pyside.py b/canvas/CanvasTemplate_pyside.py new file mode 100644 index 00000000..12afdf25 --- /dev/null +++ b/canvas/CanvasTemplate_pyside.py @@ -0,0 +1,95 @@ +# -*- coding: utf-8 -*- + +# Form implementation generated from reading ui file './canvas/CanvasTemplate.ui' +# +# Created: Sun Sep 9 14:41:30 2012 +# by: pyside-uic 0.2.13 running on PySide 1.1.0 +# +# WARNING! All changes made in this file will be lost! + +from PySide import QtCore, QtGui + +class Ui_Form(object): + def setupUi(self, Form): + Form.setObjectName("Form") + Form.resize(490, 414) + self.gridLayout = QtGui.QGridLayout(Form) + self.gridLayout.setContentsMargins(0, 0, 0, 0) + self.gridLayout.setSpacing(0) + self.gridLayout.setObjectName("gridLayout") + self.splitter = QtGui.QSplitter(Form) + self.splitter.setOrientation(QtCore.Qt.Horizontal) + self.splitter.setObjectName("splitter") + self.view = GraphicsView(self.splitter) + self.view.setObjectName("view") + self.layoutWidget = QtGui.QWidget(self.splitter) + self.layoutWidget.setObjectName("layoutWidget") + self.gridLayout_2 = QtGui.QGridLayout(self.layoutWidget) + self.gridLayout_2.setContentsMargins(0, 0, 0, 0) + self.gridLayout_2.setObjectName("gridLayout_2") + self.storeSvgBtn = QtGui.QPushButton(self.layoutWidget) + self.storeSvgBtn.setObjectName("storeSvgBtn") + self.gridLayout_2.addWidget(self.storeSvgBtn, 1, 0, 1, 1) + self.storePngBtn = QtGui.QPushButton(self.layoutWidget) + self.storePngBtn.setObjectName("storePngBtn") + self.gridLayout_2.addWidget(self.storePngBtn, 1, 1, 1, 1) + self.autoRangeBtn = QtGui.QPushButton(self.layoutWidget) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(1) + sizePolicy.setHeightForWidth(self.autoRangeBtn.sizePolicy().hasHeightForWidth()) + self.autoRangeBtn.setSizePolicy(sizePolicy) + self.autoRangeBtn.setObjectName("autoRangeBtn") + self.gridLayout_2.addWidget(self.autoRangeBtn, 3, 0, 1, 2) + self.horizontalLayout = QtGui.QHBoxLayout() + self.horizontalLayout.setSpacing(0) + self.horizontalLayout.setObjectName("horizontalLayout") + self.redirectCheck = QtGui.QCheckBox(self.layoutWidget) + self.redirectCheck.setObjectName("redirectCheck") + self.horizontalLayout.addWidget(self.redirectCheck) + self.redirectCombo = CanvasCombo(self.layoutWidget) + self.redirectCombo.setObjectName("redirectCombo") + self.horizontalLayout.addWidget(self.redirectCombo) + self.gridLayout_2.addLayout(self.horizontalLayout, 6, 0, 1, 2) + self.itemList = TreeWidget(self.layoutWidget) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(100) + sizePolicy.setHeightForWidth(self.itemList.sizePolicy().hasHeightForWidth()) + self.itemList.setSizePolicy(sizePolicy) + self.itemList.setHeaderHidden(True) + self.itemList.setObjectName("itemList") + self.itemList.headerItem().setText(0, "1") + self.gridLayout_2.addWidget(self.itemList, 7, 0, 1, 2) + self.ctrlLayout = QtGui.QGridLayout() + self.ctrlLayout.setSpacing(0) + self.ctrlLayout.setObjectName("ctrlLayout") + self.gridLayout_2.addLayout(self.ctrlLayout, 11, 0, 1, 2) + self.resetTransformsBtn = QtGui.QPushButton(self.layoutWidget) + self.resetTransformsBtn.setObjectName("resetTransformsBtn") + self.gridLayout_2.addWidget(self.resetTransformsBtn, 8, 0, 1, 1) + self.mirrorSelectionBtn = QtGui.QPushButton(self.layoutWidget) + self.mirrorSelectionBtn.setObjectName("mirrorSelectionBtn") + self.gridLayout_2.addWidget(self.mirrorSelectionBtn, 4, 0, 1, 1) + self.reflectSelectionBtn = QtGui.QPushButton(self.layoutWidget) + self.reflectSelectionBtn.setObjectName("reflectSelectionBtn") + self.gridLayout_2.addWidget(self.reflectSelectionBtn, 4, 1, 1, 1) + self.gridLayout.addWidget(self.splitter, 0, 0, 1, 1) + + self.retranslateUi(Form) + QtCore.QMetaObject.connectSlotsByName(Form) + + def retranslateUi(self, Form): + Form.setWindowTitle(QtGui.QApplication.translate("Form", "Form", None, QtGui.QApplication.UnicodeUTF8)) + self.storeSvgBtn.setText(QtGui.QApplication.translate("Form", "Store SVG", None, QtGui.QApplication.UnicodeUTF8)) + self.storePngBtn.setText(QtGui.QApplication.translate("Form", "Store PNG", None, QtGui.QApplication.UnicodeUTF8)) + self.autoRangeBtn.setText(QtGui.QApplication.translate("Form", "Auto Range", None, QtGui.QApplication.UnicodeUTF8)) + self.redirectCheck.setToolTip(QtGui.QApplication.translate("Form", "Check to display all local items in a remote canvas.", None, QtGui.QApplication.UnicodeUTF8)) + self.redirectCheck.setText(QtGui.QApplication.translate("Form", "Redirect", None, QtGui.QApplication.UnicodeUTF8)) + self.resetTransformsBtn.setText(QtGui.QApplication.translate("Form", "Reset Transforms", None, QtGui.QApplication.UnicodeUTF8)) + self.mirrorSelectionBtn.setText(QtGui.QApplication.translate("Form", "Mirror Selection", None, QtGui.QApplication.UnicodeUTF8)) + self.reflectSelectionBtn.setText(QtGui.QApplication.translate("Form", "MirrorXY", None, QtGui.QApplication.UnicodeUTF8)) + +from pyqtgraph.widgets.GraphicsView import GraphicsView +from CanvasManager import CanvasCombo +from pyqtgraph.widgets.TreeWidget import TreeWidget diff --git a/canvas/TransformGuiTemplate.py b/canvas/TransformGuiTemplate_pyqt.py similarity index 93% rename from canvas/TransformGuiTemplate.py rename to canvas/TransformGuiTemplate_pyqt.py index 3c7fcf50..1fb86d24 100644 --- a/canvas/TransformGuiTemplate.py +++ b/canvas/TransformGuiTemplate_pyqt.py @@ -1,9 +1,9 @@ # -*- coding: utf-8 -*- -# Form implementation generated from reading ui file './lib/util/pyqtgraph/canvas/TransformGuiTemplate.ui' +# Form implementation generated from reading ui file './canvas/TransformGuiTemplate.ui' # -# Created: Wed Apr 18 13:40:19 2012 -# by: PyQt4 UI code generator 4.8.3 +# Created: Sun Sep 9 14:41:30 2012 +# by: PyQt4 UI code generator 4.9.1 # # WARNING! All changes made in this file will be lost! diff --git a/canvas/TransformGuiTemplate_pyside.py b/canvas/TransformGuiTemplate_pyside.py new file mode 100644 index 00000000..47b23faa --- /dev/null +++ b/canvas/TransformGuiTemplate_pyside.py @@ -0,0 +1,55 @@ +# -*- coding: utf-8 -*- + +# Form implementation generated from reading ui file './canvas/TransformGuiTemplate.ui' +# +# Created: Sun Sep 9 14:41:30 2012 +# by: pyside-uic 0.2.13 running on PySide 1.1.0 +# +# WARNING! All changes made in this file will be lost! + +from PySide import QtCore, QtGui + +class Ui_Form(object): + def setupUi(self, Form): + Form.setObjectName("Form") + Form.resize(224, 117) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Preferred) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(Form.sizePolicy().hasHeightForWidth()) + Form.setSizePolicy(sizePolicy) + self.verticalLayout = QtGui.QVBoxLayout(Form) + self.verticalLayout.setSpacing(1) + self.verticalLayout.setContentsMargins(0, 0, 0, 0) + self.verticalLayout.setObjectName("verticalLayout") + self.translateLabel = QtGui.QLabel(Form) + self.translateLabel.setObjectName("translateLabel") + self.verticalLayout.addWidget(self.translateLabel) + self.rotateLabel = QtGui.QLabel(Form) + self.rotateLabel.setObjectName("rotateLabel") + self.verticalLayout.addWidget(self.rotateLabel) + self.scaleLabel = QtGui.QLabel(Form) + self.scaleLabel.setObjectName("scaleLabel") + self.verticalLayout.addWidget(self.scaleLabel) + self.horizontalLayout = QtGui.QHBoxLayout() + self.horizontalLayout.setObjectName("horizontalLayout") + self.mirrorImageBtn = QtGui.QPushButton(Form) + self.mirrorImageBtn.setToolTip("") + self.mirrorImageBtn.setObjectName("mirrorImageBtn") + self.horizontalLayout.addWidget(self.mirrorImageBtn) + self.reflectImageBtn = QtGui.QPushButton(Form) + self.reflectImageBtn.setObjectName("reflectImageBtn") + self.horizontalLayout.addWidget(self.reflectImageBtn) + self.verticalLayout.addLayout(self.horizontalLayout) + + self.retranslateUi(Form) + QtCore.QMetaObject.connectSlotsByName(Form) + + def retranslateUi(self, Form): + Form.setWindowTitle(QtGui.QApplication.translate("Form", "Form", None, QtGui.QApplication.UnicodeUTF8)) + self.translateLabel.setText(QtGui.QApplication.translate("Form", "Translate:", None, QtGui.QApplication.UnicodeUTF8)) + self.rotateLabel.setText(QtGui.QApplication.translate("Form", "Rotate:", None, QtGui.QApplication.UnicodeUTF8)) + self.scaleLabel.setText(QtGui.QApplication.translate("Form", "Scale:", None, QtGui.QApplication.UnicodeUTF8)) + self.mirrorImageBtn.setText(QtGui.QApplication.translate("Form", "Mirror", None, QtGui.QApplication.UnicodeUTF8)) + self.reflectImageBtn.setText(QtGui.QApplication.translate("Form", "Reflect", None, QtGui.QApplication.UnicodeUTF8)) + diff --git a/console/Console.py b/console/Console.py index ba0ddeb8..c4fdff74 100644 --- a/console/Console.py +++ b/console/Console.py @@ -1,8 +1,12 @@ -from pyqtgraph.Qt import QtCore, QtGui +from pyqtgraph.Qt import QtCore, QtGui, USE_PYSIDE import sys, re, os, time, traceback, subprocess import pyqtgraph as pg -from . import template +if USE_PYSIDE: + from . import template_pyside as template +else: + from . import template_pyqt as template + import pyqtgraph.exceptionHandling as exceptionHandling import pickle diff --git a/console/template.py b/console/template_pyqt.py similarity index 98% rename from console/template.py rename to console/template_pyqt.py index ebdb8ab2..89ee6cff 100644 --- a/console/template.py +++ b/console/template_pyqt.py @@ -1,8 +1,8 @@ # -*- coding: utf-8 -*- -# Form implementation generated from reading ui file 'template.ui' +# Form implementation generated from reading ui file './console/template.ui' # -# Created: Mon Aug 20 22:49:47 2012 +# Created: Sun Sep 9 14:41:30 2012 # by: PyQt4 UI code generator 4.9.1 # # WARNING! All changes made in this file will be lost! diff --git a/console/template_pyside.py b/console/template_pyside.py new file mode 100644 index 00000000..0493a0fe --- /dev/null +++ b/console/template_pyside.py @@ -0,0 +1,106 @@ +# -*- coding: utf-8 -*- + +# Form implementation generated from reading ui file './console/template.ui' +# +# Created: Sun Sep 9 14:41:30 2012 +# by: pyside-uic 0.2.13 running on PySide 1.1.0 +# +# WARNING! All changes made in this file will be lost! + +from PySide import QtCore, QtGui + +class Ui_Form(object): + def setupUi(self, Form): + Form.setObjectName("Form") + Form.resize(710, 497) + self.gridLayout = QtGui.QGridLayout(Form) + self.gridLayout.setContentsMargins(0, 0, 0, 0) + self.gridLayout.setSpacing(0) + self.gridLayout.setObjectName("gridLayout") + self.splitter = QtGui.QSplitter(Form) + self.splitter.setOrientation(QtCore.Qt.Vertical) + self.splitter.setObjectName("splitter") + self.layoutWidget = QtGui.QWidget(self.splitter) + self.layoutWidget.setObjectName("layoutWidget") + self.verticalLayout = QtGui.QVBoxLayout(self.layoutWidget) + self.verticalLayout.setContentsMargins(0, 0, 0, 0) + self.verticalLayout.setObjectName("verticalLayout") + self.output = QtGui.QPlainTextEdit(self.layoutWidget) + font = QtGui.QFont() + font.setFamily("Monospace") + self.output.setFont(font) + self.output.setReadOnly(True) + self.output.setObjectName("output") + self.verticalLayout.addWidget(self.output) + self.horizontalLayout = QtGui.QHBoxLayout() + self.horizontalLayout.setObjectName("horizontalLayout") + self.input = CmdInput(self.layoutWidget) + self.input.setObjectName("input") + self.horizontalLayout.addWidget(self.input) + self.historyBtn = QtGui.QPushButton(self.layoutWidget) + self.historyBtn.setCheckable(True) + self.historyBtn.setObjectName("historyBtn") + self.horizontalLayout.addWidget(self.historyBtn) + self.exceptionBtn = QtGui.QPushButton(self.layoutWidget) + self.exceptionBtn.setCheckable(True) + self.exceptionBtn.setObjectName("exceptionBtn") + self.horizontalLayout.addWidget(self.exceptionBtn) + self.verticalLayout.addLayout(self.horizontalLayout) + self.historyList = QtGui.QListWidget(self.splitter) + font = QtGui.QFont() + font.setFamily("Monospace") + self.historyList.setFont(font) + self.historyList.setObjectName("historyList") + self.exceptionGroup = QtGui.QGroupBox(self.splitter) + self.exceptionGroup.setObjectName("exceptionGroup") + self.gridLayout_2 = QtGui.QGridLayout(self.exceptionGroup) + self.gridLayout_2.setSpacing(0) + self.gridLayout_2.setContentsMargins(-1, 0, -1, 0) + self.gridLayout_2.setObjectName("gridLayout_2") + self.catchAllExceptionsBtn = QtGui.QPushButton(self.exceptionGroup) + self.catchAllExceptionsBtn.setCheckable(True) + self.catchAllExceptionsBtn.setObjectName("catchAllExceptionsBtn") + self.gridLayout_2.addWidget(self.catchAllExceptionsBtn, 0, 1, 1, 1) + self.catchNextExceptionBtn = QtGui.QPushButton(self.exceptionGroup) + self.catchNextExceptionBtn.setCheckable(True) + self.catchNextExceptionBtn.setObjectName("catchNextExceptionBtn") + self.gridLayout_2.addWidget(self.catchNextExceptionBtn, 0, 0, 1, 1) + self.onlyUncaughtCheck = QtGui.QCheckBox(self.exceptionGroup) + self.onlyUncaughtCheck.setChecked(True) + self.onlyUncaughtCheck.setObjectName("onlyUncaughtCheck") + self.gridLayout_2.addWidget(self.onlyUncaughtCheck, 0, 2, 1, 1) + self.exceptionStackList = QtGui.QListWidget(self.exceptionGroup) + self.exceptionStackList.setAlternatingRowColors(True) + self.exceptionStackList.setObjectName("exceptionStackList") + self.gridLayout_2.addWidget(self.exceptionStackList, 2, 0, 1, 5) + self.runSelectedFrameCheck = QtGui.QCheckBox(self.exceptionGroup) + self.runSelectedFrameCheck.setChecked(True) + self.runSelectedFrameCheck.setObjectName("runSelectedFrameCheck") + self.gridLayout_2.addWidget(self.runSelectedFrameCheck, 3, 0, 1, 5) + self.exceptionInfoLabel = QtGui.QLabel(self.exceptionGroup) + self.exceptionInfoLabel.setObjectName("exceptionInfoLabel") + self.gridLayout_2.addWidget(self.exceptionInfoLabel, 1, 0, 1, 5) + self.clearExceptionBtn = QtGui.QPushButton(self.exceptionGroup) + self.clearExceptionBtn.setEnabled(False) + self.clearExceptionBtn.setObjectName("clearExceptionBtn") + self.gridLayout_2.addWidget(self.clearExceptionBtn, 0, 4, 1, 1) + spacerItem = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) + self.gridLayout_2.addItem(spacerItem, 0, 3, 1, 1) + self.gridLayout.addWidget(self.splitter, 0, 0, 1, 1) + + self.retranslateUi(Form) + QtCore.QMetaObject.connectSlotsByName(Form) + + def retranslateUi(self, Form): + Form.setWindowTitle(QtGui.QApplication.translate("Form", "Console", None, QtGui.QApplication.UnicodeUTF8)) + self.historyBtn.setText(QtGui.QApplication.translate("Form", "History..", None, QtGui.QApplication.UnicodeUTF8)) + self.exceptionBtn.setText(QtGui.QApplication.translate("Form", "Exceptions..", None, QtGui.QApplication.UnicodeUTF8)) + self.exceptionGroup.setTitle(QtGui.QApplication.translate("Form", "Exception Handling", None, QtGui.QApplication.UnicodeUTF8)) + self.catchAllExceptionsBtn.setText(QtGui.QApplication.translate("Form", "Show All Exceptions", None, QtGui.QApplication.UnicodeUTF8)) + self.catchNextExceptionBtn.setText(QtGui.QApplication.translate("Form", "Show Next Exception", None, QtGui.QApplication.UnicodeUTF8)) + self.onlyUncaughtCheck.setText(QtGui.QApplication.translate("Form", "Only Uncaught Exceptions", None, QtGui.QApplication.UnicodeUTF8)) + self.runSelectedFrameCheck.setText(QtGui.QApplication.translate("Form", "Run commands in selected stack frame", None, QtGui.QApplication.UnicodeUTF8)) + self.exceptionInfoLabel.setText(QtGui.QApplication.translate("Form", "Exception Info", None, QtGui.QApplication.UnicodeUTF8)) + self.clearExceptionBtn.setText(QtGui.QApplication.translate("Form", "Clear Exception", None, QtGui.QApplication.UnicodeUTF8)) + +from .CmdInput import CmdInput diff --git a/documentation/source/how_to_use.rst b/documentation/source/how_to_use.rst index ef938104..53a3d2b0 100644 --- a/documentation/source/how_to_use.rst +++ b/documentation/source/how_to_use.rst @@ -52,3 +52,22 @@ For the serious application developer, all of the functionality in pyqtgraph is #. Click "Add", then click "Promote". See the designer documentation for more information on promoting widgets. + + +PyQt and PySide +--------------- + +Pyqtgraph supports two popular python wrappers for the Qt library: PyQt and PySide. Both packages provide nearly identical +APIs and functionality, but for various reasons (discussed elsewhere) you may prefer to use one package or the other. When +pyqtgraph is first imported, it automatically determines which library to use by making the fillowing checks: + +#. If PyQt4 is already imported, use that +#. Else, if PySide is already imported, use that +#. Else, attempt to import PyQt4 +#. If that import fails, attempt to import PySide. + +If you have both libraries installed on your system and you wish to force pyqtgraph to use one or the other, simply +make sure it is imported before pyqtgraph:: + + import PySide ## this will force pyqtgraph to use PySide instead of PyQt4 + import pyqtgraph as pg diff --git a/examples/ScatterPlotSpeedTest.py b/examples/ScatterPlotSpeedTest.py index b213c623..4fe255b6 100644 --- a/examples/ScatterPlotSpeedTest.py +++ b/examples/ScatterPlotSpeedTest.py @@ -5,7 +5,7 @@ import sys, os sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', '..')) -from pyqtgraph.Qt import QtGui, QtCore +from pyqtgraph.Qt import QtGui, QtCore, USE_PYSIDE import numpy as np import pyqtgraph as pg from pyqtgraph.ptime import time @@ -13,7 +13,10 @@ from pyqtgraph.ptime import time app = QtGui.QApplication([]) #mw = QtGui.QMainWindow() #mw.resize(800,800) -from ScatterPlotSpeedTestTemplate import Ui_Form +if USE_PYSIDE: + from ScatterPlotSpeedTestTemplate_pyside import Ui_Form +else: + from ScatterPlotSpeedTestTemplate_pyqt import Ui_Form win = QtGui.QWidget() ui = Ui_Form() diff --git a/examples/ScatterPlotSpeedTestTemplate.py b/examples/ScatterPlotSpeedTestTemplate_pyqt.py similarity index 89% rename from examples/ScatterPlotSpeedTestTemplate.py rename to examples/ScatterPlotSpeedTestTemplate_pyqt.py index 8a9be334..efd1343b 100644 --- a/examples/ScatterPlotSpeedTestTemplate.py +++ b/examples/ScatterPlotSpeedTestTemplate_pyqt.py @@ -1,9 +1,9 @@ # -*- coding: utf-8 -*- -# Form implementation generated from reading ui file 'ScatterPlotSpeedTestTemplate.ui' +# Form implementation generated from reading ui file './examples/ScatterPlotSpeedTestTemplate.ui' # -# Created: Tue May 8 23:09:16 2012 -# by: PyQt4 UI code generator 4.8.5 +# Created: Sun Sep 9 14:41:31 2012 +# by: PyQt4 UI code generator 4.9.1 # # WARNING! All changes made in this file will be lost! @@ -18,18 +18,15 @@ class Ui_Form(object): def setupUi(self, Form): Form.setObjectName(_fromUtf8("Form")) Form.resize(400, 300) - Form.setWindowTitle(QtGui.QApplication.translate("Form", "Form", None, QtGui.QApplication.UnicodeUTF8)) self.gridLayout = QtGui.QGridLayout(Form) self.gridLayout.setObjectName(_fromUtf8("gridLayout")) self.plot = PlotWidget(Form) self.plot.setObjectName(_fromUtf8("plot")) self.gridLayout.addWidget(self.plot, 0, 0, 1, 2) self.identicalCheck = QtGui.QCheckBox(Form) - self.identicalCheck.setText(QtGui.QApplication.translate("Form", "Identical", None, QtGui.QApplication.UnicodeUTF8)) self.identicalCheck.setObjectName(_fromUtf8("identicalCheck")) self.gridLayout.addWidget(self.identicalCheck, 1, 0, 1, 1) self.pixelModeCheck = QtGui.QCheckBox(Form) - self.pixelModeCheck.setText(QtGui.QApplication.translate("Form", "pixel mode", None, QtGui.QApplication.UnicodeUTF8)) self.pixelModeCheck.setObjectName(_fromUtf8("pixelModeCheck")) self.gridLayout.addWidget(self.pixelModeCheck, 1, 1, 1, 1) @@ -37,6 +34,8 @@ class Ui_Form(object): QtCore.QMetaObject.connectSlotsByName(Form) def retranslateUi(self, Form): - pass + Form.setWindowTitle(QtGui.QApplication.translate("Form", "Form", None, QtGui.QApplication.UnicodeUTF8)) + self.identicalCheck.setText(QtGui.QApplication.translate("Form", "Identical", None, QtGui.QApplication.UnicodeUTF8)) + self.pixelModeCheck.setText(QtGui.QApplication.translate("Form", "pixel mode", None, QtGui.QApplication.UnicodeUTF8)) from pyqtgraph import PlotWidget diff --git a/examples/ScatterPlotSpeedTestTemplate_pyside.py b/examples/ScatterPlotSpeedTestTemplate_pyside.py new file mode 100644 index 00000000..ed7d6363 --- /dev/null +++ b/examples/ScatterPlotSpeedTestTemplate_pyside.py @@ -0,0 +1,36 @@ +# -*- coding: utf-8 -*- + +# Form implementation generated from reading ui file './examples/ScatterPlotSpeedTestTemplate.ui' +# +# Created: Sun Sep 9 14:41:31 2012 +# by: pyside-uic 0.2.13 running on PySide 1.1.0 +# +# WARNING! All changes made in this file will be lost! + +from PySide import QtCore, QtGui + +class Ui_Form(object): + def setupUi(self, Form): + Form.setObjectName("Form") + Form.resize(400, 300) + self.gridLayout = QtGui.QGridLayout(Form) + self.gridLayout.setObjectName("gridLayout") + self.plot = PlotWidget(Form) + self.plot.setObjectName("plot") + self.gridLayout.addWidget(self.plot, 0, 0, 1, 2) + self.identicalCheck = QtGui.QCheckBox(Form) + self.identicalCheck.setObjectName("identicalCheck") + self.gridLayout.addWidget(self.identicalCheck, 1, 0, 1, 1) + self.pixelModeCheck = QtGui.QCheckBox(Form) + self.pixelModeCheck.setObjectName("pixelModeCheck") + self.gridLayout.addWidget(self.pixelModeCheck, 1, 1, 1, 1) + + self.retranslateUi(Form) + QtCore.QMetaObject.connectSlotsByName(Form) + + def retranslateUi(self, Form): + Form.setWindowTitle(QtGui.QApplication.translate("Form", "Form", None, QtGui.QApplication.UnicodeUTF8)) + self.identicalCheck.setText(QtGui.QApplication.translate("Form", "Identical", None, QtGui.QApplication.UnicodeUTF8)) + self.pixelModeCheck.setText(QtGui.QApplication.translate("Form", "pixel mode", None, QtGui.QApplication.UnicodeUTF8)) + +from pyqtgraph import PlotWidget diff --git a/examples/VideoSpeedTest.py b/examples/VideoSpeedTest.py index 1ec28a3c..d51798bd 100644 --- a/examples/VideoSpeedTest.py +++ b/examples/VideoSpeedTest.py @@ -10,13 +10,18 @@ is used by the view widget import initExample ## Add path to library (just for examples; you do not need this) -from pyqtgraph.Qt import QtGui, QtCore +from pyqtgraph.Qt import QtGui, QtCore, USE_PYSIDE import numpy as np import pyqtgraph as pg from pyqtgraph import RawImageWidget import scipy.ndimage as ndi import pyqtgraph.ptime as ptime -import VideoTemplate + +if USE_PYSIDE: + import VideoTemplate_pyside as VideoTemplate +else: + import VideoTemplate_pyqt as VideoTemplate + #QtGui.QApplication.setGraphicsSystem('raster') app = QtGui.QApplication([]) diff --git a/examples/VideoTemplate.py b/examples/VideoTemplate_pyqt.py similarity index 98% rename from examples/VideoTemplate.py rename to examples/VideoTemplate_pyqt.py index d4f712d5..21e66635 100644 --- a/examples/VideoTemplate.py +++ b/examples/VideoTemplate_pyqt.py @@ -1,9 +1,9 @@ # -*- coding: utf-8 -*- -# Form implementation generated from reading ui file 'VideoTemplate.ui' +# Form implementation generated from reading ui file './examples/VideoTemplate.ui' # -# Created: Sun Jan 8 19:22:32 2012 -# by: PyQt4 UI code generator 4.8.3 +# Created: Sun Sep 9 14:41:31 2012 +# by: PyQt4 UI code generator 4.9.1 # # WARNING! All changes made in this file will be lost! diff --git a/examples/VideoTemplate_pyside.py b/examples/VideoTemplate_pyside.py new file mode 100644 index 00000000..5cbce05c --- /dev/null +++ b/examples/VideoTemplate_pyside.py @@ -0,0 +1,144 @@ +# -*- coding: utf-8 -*- + +# Form implementation generated from reading ui file './examples/VideoTemplate.ui' +# +# Created: Sun Sep 9 14:41:31 2012 +# by: pyside-uic 0.2.13 running on PySide 1.1.0 +# +# WARNING! All changes made in this file will be lost! + +from PySide import QtCore, QtGui + +class Ui_MainWindow(object): + def setupUi(self, MainWindow): + MainWindow.setObjectName("MainWindow") + MainWindow.resize(985, 674) + self.centralwidget = QtGui.QWidget(MainWindow) + self.centralwidget.setObjectName("centralwidget") + self.gridLayout_2 = QtGui.QGridLayout(self.centralwidget) + self.gridLayout_2.setObjectName("gridLayout_2") + self.gridLayout = QtGui.QGridLayout() + self.gridLayout.setObjectName("gridLayout") + self.rawImg = RawImageWidget(self.centralwidget) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.rawImg.sizePolicy().hasHeightForWidth()) + self.rawImg.setSizePolicy(sizePolicy) + self.rawImg.setObjectName("rawImg") + self.gridLayout.addWidget(self.rawImg, 0, 0, 1, 1) + self.graphicsView = GraphicsView(self.centralwidget) + self.graphicsView.setObjectName("graphicsView") + self.gridLayout.addWidget(self.graphicsView, 0, 1, 1, 1) + self.rawRadio = QtGui.QRadioButton(self.centralwidget) + self.rawRadio.setChecked(True) + self.rawRadio.setObjectName("rawRadio") + self.gridLayout.addWidget(self.rawRadio, 1, 0, 1, 1) + self.gfxRadio = QtGui.QRadioButton(self.centralwidget) + self.gfxRadio.setObjectName("gfxRadio") + self.gridLayout.addWidget(self.gfxRadio, 1, 1, 1, 1) + self.gridLayout_2.addLayout(self.gridLayout, 1, 0, 1, 4) + self.label = QtGui.QLabel(self.centralwidget) + self.label.setObjectName("label") + self.gridLayout_2.addWidget(self.label, 2, 0, 1, 1) + self.dtypeCombo = QtGui.QComboBox(self.centralwidget) + self.dtypeCombo.setObjectName("dtypeCombo") + self.dtypeCombo.addItem("") + self.dtypeCombo.addItem("") + self.dtypeCombo.addItem("") + self.gridLayout_2.addWidget(self.dtypeCombo, 2, 2, 1, 1) + self.scaleCheck = QtGui.QCheckBox(self.centralwidget) + self.scaleCheck.setObjectName("scaleCheck") + self.gridLayout_2.addWidget(self.scaleCheck, 3, 0, 1, 1) + self.rgbCheck = QtGui.QCheckBox(self.centralwidget) + self.rgbCheck.setObjectName("rgbCheck") + self.gridLayout_2.addWidget(self.rgbCheck, 3, 1, 1, 1) + self.horizontalLayout = QtGui.QHBoxLayout() + self.horizontalLayout.setObjectName("horizontalLayout") + self.minSpin1 = SpinBox(self.centralwidget) + self.minSpin1.setObjectName("minSpin1") + self.horizontalLayout.addWidget(self.minSpin1) + self.label_2 = QtGui.QLabel(self.centralwidget) + self.label_2.setAlignment(QtCore.Qt.AlignCenter) + self.label_2.setObjectName("label_2") + self.horizontalLayout.addWidget(self.label_2) + self.maxSpin1 = SpinBox(self.centralwidget) + self.maxSpin1.setObjectName("maxSpin1") + self.horizontalLayout.addWidget(self.maxSpin1) + self.gridLayout_2.addLayout(self.horizontalLayout, 3, 2, 1, 1) + self.horizontalLayout_2 = QtGui.QHBoxLayout() + self.horizontalLayout_2.setObjectName("horizontalLayout_2") + self.minSpin2 = SpinBox(self.centralwidget) + self.minSpin2.setEnabled(False) + self.minSpin2.setObjectName("minSpin2") + self.horizontalLayout_2.addWidget(self.minSpin2) + self.label_3 = QtGui.QLabel(self.centralwidget) + self.label_3.setAlignment(QtCore.Qt.AlignCenter) + self.label_3.setObjectName("label_3") + self.horizontalLayout_2.addWidget(self.label_3) + self.maxSpin2 = SpinBox(self.centralwidget) + self.maxSpin2.setEnabled(False) + self.maxSpin2.setObjectName("maxSpin2") + self.horizontalLayout_2.addWidget(self.maxSpin2) + self.gridLayout_2.addLayout(self.horizontalLayout_2, 4, 2, 1, 1) + self.horizontalLayout_3 = QtGui.QHBoxLayout() + self.horizontalLayout_3.setObjectName("horizontalLayout_3") + self.minSpin3 = SpinBox(self.centralwidget) + self.minSpin3.setEnabled(False) + self.minSpin3.setObjectName("minSpin3") + self.horizontalLayout_3.addWidget(self.minSpin3) + self.label_4 = QtGui.QLabel(self.centralwidget) + self.label_4.setAlignment(QtCore.Qt.AlignCenter) + self.label_4.setObjectName("label_4") + self.horizontalLayout_3.addWidget(self.label_4) + self.maxSpin3 = SpinBox(self.centralwidget) + self.maxSpin3.setEnabled(False) + self.maxSpin3.setObjectName("maxSpin3") + self.horizontalLayout_3.addWidget(self.maxSpin3) + self.gridLayout_2.addLayout(self.horizontalLayout_3, 5, 2, 1, 1) + self.lutCheck = QtGui.QCheckBox(self.centralwidget) + self.lutCheck.setObjectName("lutCheck") + self.gridLayout_2.addWidget(self.lutCheck, 6, 0, 1, 1) + self.alphaCheck = QtGui.QCheckBox(self.centralwidget) + self.alphaCheck.setObjectName("alphaCheck") + self.gridLayout_2.addWidget(self.alphaCheck, 6, 1, 1, 1) + self.gradient = GradientWidget(self.centralwidget) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.gradient.sizePolicy().hasHeightForWidth()) + self.gradient.setSizePolicy(sizePolicy) + self.gradient.setObjectName("gradient") + self.gridLayout_2.addWidget(self.gradient, 6, 2, 1, 2) + spacerItem = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) + self.gridLayout_2.addItem(spacerItem, 2, 3, 1, 1) + self.fpsLabel = QtGui.QLabel(self.centralwidget) + font = QtGui.QFont() + font.setPointSize(12) + self.fpsLabel.setFont(font) + self.fpsLabel.setAlignment(QtCore.Qt.AlignCenter) + self.fpsLabel.setObjectName("fpsLabel") + self.gridLayout_2.addWidget(self.fpsLabel, 0, 0, 1, 4) + MainWindow.setCentralWidget(self.centralwidget) + + self.retranslateUi(MainWindow) + QtCore.QMetaObject.connectSlotsByName(MainWindow) + + def retranslateUi(self, MainWindow): + MainWindow.setWindowTitle(QtGui.QApplication.translate("MainWindow", "MainWindow", None, QtGui.QApplication.UnicodeUTF8)) + self.rawRadio.setText(QtGui.QApplication.translate("MainWindow", "RawImageWidget (unscaled; faster)", None, QtGui.QApplication.UnicodeUTF8)) + self.gfxRadio.setText(QtGui.QApplication.translate("MainWindow", "GraphicsView + ImageItem (scaled; slower)", None, QtGui.QApplication.UnicodeUTF8)) + self.label.setText(QtGui.QApplication.translate("MainWindow", "Data type", None, QtGui.QApplication.UnicodeUTF8)) + self.dtypeCombo.setItemText(0, QtGui.QApplication.translate("MainWindow", "uint8", None, QtGui.QApplication.UnicodeUTF8)) + self.dtypeCombo.setItemText(1, QtGui.QApplication.translate("MainWindow", "uint16", None, QtGui.QApplication.UnicodeUTF8)) + self.dtypeCombo.setItemText(2, QtGui.QApplication.translate("MainWindow", "float", None, QtGui.QApplication.UnicodeUTF8)) + self.scaleCheck.setText(QtGui.QApplication.translate("MainWindow", "Scale Data", None, QtGui.QApplication.UnicodeUTF8)) + self.rgbCheck.setText(QtGui.QApplication.translate("MainWindow", "RGB", None, QtGui.QApplication.UnicodeUTF8)) + self.label_2.setText(QtGui.QApplication.translate("MainWindow", "<--->", None, QtGui.QApplication.UnicodeUTF8)) + self.label_3.setText(QtGui.QApplication.translate("MainWindow", "<--->", None, QtGui.QApplication.UnicodeUTF8)) + self.label_4.setText(QtGui.QApplication.translate("MainWindow", "<--->", None, QtGui.QApplication.UnicodeUTF8)) + self.lutCheck.setText(QtGui.QApplication.translate("MainWindow", "Use Lookup Table", None, QtGui.QApplication.UnicodeUTF8)) + self.alphaCheck.setText(QtGui.QApplication.translate("MainWindow", "alpha", None, QtGui.QApplication.UnicodeUTF8)) + self.fpsLabel.setText(QtGui.QApplication.translate("MainWindow", "FPS", None, QtGui.QApplication.UnicodeUTF8)) + +from pyqtgraph import SpinBox, GradientWidget, GraphicsView, RawImageWidget diff --git a/examples/__main__.py b/examples/__main__.py index daa11e4a..ae5163ee 100644 --- a/examples/__main__.py +++ b/examples/__main__.py @@ -1,9 +1,13 @@ import sys, os ## make sure this pyqtgraph is importable before any others sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', '..')) -from pyqtgraph.Qt import QtCore, QtGui +from pyqtgraph.Qt import QtCore, QtGui, USE_PYSIDE -from exampleLoaderTemplate import Ui_Form +if USE_PYSIDE: + from exampleLoaderTemplate_pyside import Ui_Form +else: + from exampleLoaderTemplate_pyqt import Ui_Form + import os, sys from collections import OrderedDict diff --git a/examples/exampleLoaderTemplate.py b/examples/exampleLoaderTemplate_pyqt.py similarity index 92% rename from examples/exampleLoaderTemplate.py rename to examples/exampleLoaderTemplate_pyqt.py index 7447e84c..80e95295 100644 --- a/examples/exampleLoaderTemplate.py +++ b/examples/exampleLoaderTemplate_pyqt.py @@ -1,9 +1,9 @@ # -*- coding: utf-8 -*- -# Form implementation generated from reading ui file 'exampleLoaderTemplate.ui' +# Form implementation generated from reading ui file './examples/exampleLoaderTemplate.ui' # -# Created: Sat Dec 17 23:46:27 2011 -# by: PyQt4 UI code generator 4.8.3 +# Created: Sun Sep 9 14:41:31 2012 +# by: PyQt4 UI code generator 4.9.1 # # WARNING! All changes made in this file will be lost! diff --git a/examples/exampleLoaderTemplate_pyside.py b/examples/exampleLoaderTemplate_pyside.py new file mode 100644 index 00000000..fa0ccfd1 --- /dev/null +++ b/examples/exampleLoaderTemplate_pyside.py @@ -0,0 +1,50 @@ +# -*- coding: utf-8 -*- + +# Form implementation generated from reading ui file './examples/exampleLoaderTemplate.ui' +# +# Created: Sun Sep 9 14:41:31 2012 +# by: pyside-uic 0.2.13 running on PySide 1.1.0 +# +# WARNING! All changes made in this file will be lost! + +from PySide import QtCore, QtGui + +class Ui_Form(object): + def setupUi(self, Form): + Form.setObjectName("Form") + Form.resize(762, 302) + self.gridLayout = QtGui.QGridLayout(Form) + self.gridLayout.setContentsMargins(0, 0, 0, 0) + self.gridLayout.setSpacing(0) + self.gridLayout.setObjectName("gridLayout") + self.splitter = QtGui.QSplitter(Form) + self.splitter.setOrientation(QtCore.Qt.Horizontal) + self.splitter.setObjectName("splitter") + self.layoutWidget = QtGui.QWidget(self.splitter) + self.layoutWidget.setObjectName("layoutWidget") + self.verticalLayout = QtGui.QVBoxLayout(self.layoutWidget) + self.verticalLayout.setContentsMargins(0, 0, 0, 0) + self.verticalLayout.setObjectName("verticalLayout") + self.exampleTree = QtGui.QTreeWidget(self.layoutWidget) + self.exampleTree.setObjectName("exampleTree") + self.exampleTree.headerItem().setText(0, "1") + self.exampleTree.header().setVisible(False) + self.verticalLayout.addWidget(self.exampleTree) + self.loadBtn = QtGui.QPushButton(self.layoutWidget) + self.loadBtn.setObjectName("loadBtn") + self.verticalLayout.addWidget(self.loadBtn) + self.codeView = QtGui.QTextBrowser(self.splitter) + font = QtGui.QFont() + font.setFamily("Monospace") + font.setPointSize(10) + self.codeView.setFont(font) + self.codeView.setObjectName("codeView") + self.gridLayout.addWidget(self.splitter, 0, 0, 1, 1) + + self.retranslateUi(Form) + QtCore.QMetaObject.connectSlotsByName(Form) + + def retranslateUi(self, Form): + Form.setWindowTitle(QtGui.QApplication.translate("Form", "Form", None, QtGui.QApplication.UnicodeUTF8)) + self.loadBtn.setText(QtGui.QApplication.translate("Form", "Load Example", None, QtGui.QApplication.UnicodeUTF8)) + diff --git a/examples/parametertree.py b/examples/parametertree.py index 0e76ec14..cedbb889 100644 --- a/examples/parametertree.py +++ b/examples/parametertree.py @@ -60,32 +60,6 @@ class ScalableGroup(pTypes.GroupParameter): self.addChild(dict(name="ScalableParam %d" % (len(self.childs)+1), type=typ, value=val, removable=True, renamable=True)) -## test column spanning (widget sub-item that spans all columns) -class TextParameterItem(pTypes.WidgetParameterItem): - def __init__(self, param, depth): - pTypes.WidgetParameterItem.__init__(self, param, depth) - self.subItem = QtGui.QTreeWidgetItem() - self.addChild(self.subItem) - - def treeWidgetChanged(self): - self.treeWidget().setFirstItemColumnSpanned(self.subItem, True) - self.treeWidget().setItemWidget(self.subItem, 0, self.textBox) - self.setExpanded(True) - - def makeWidget(self): - self.textBox = QtGui.QTextEdit() - self.textBox.setMaximumHeight(100) - self.textBox.value = lambda: str(self.textBox.toPlainText()) - self.textBox.setValue = self.textBox.setPlainText - self.textBox.sigChanged = self.textBox.textChanged - return self.textBox - -class TextParameter(Parameter): - itemClass = TextParameterItem - -registerParameterType('text', TextParameter) - - params = [ @@ -101,6 +75,8 @@ params = [ {'name': 'Sub-param 1', 'type': 'int', 'value': 10}, {'name': 'Sub-param 2', 'type': 'float', 'value': 1.2e6}, ]}, + {'name': 'Text Parameter', 'type': 'text', 'value': 'Some text...'}, + {'name': 'Action Parameter', 'type': 'action'}, ]}, {'name': 'Numerical Parameter Options', 'type': 'group', 'children': [ {'name': 'Units + SI prefix', 'type': 'float', 'value': 1.2e-6, 'step': 1e-6, 'siPrefix': True, 'suffix': 'V'}, @@ -108,6 +84,13 @@ params = [ {'name': 'DEC stepping', 'type': 'float', 'value': 1.2e6, 'dec': True, 'step': 1, 'siPrefix': True, 'suffix': 'Hz'}, ]}, + {'name': 'Save/Restore functionality', 'type': 'group', 'children': [ + {'name': 'Save State', 'type': 'action'}, + {'name': 'Restore State', 'type': 'action', 'children': [ + {'name': 'Add missing items', 'type': 'bool', 'value': True}, + {'name': 'Remove extra items', 'type': 'bool', 'value': True}, + ]}, + ]}, {'name': 'Extra Parameter Options', 'type': 'group', 'children': [ {'name': 'Read-only', 'type': 'float', 'value': 1.2e6, 'siPrefix': True, 'suffix': 'Hz', 'readonly': True}, {'name': 'Renamable', 'type': 'float', 'value': 1.2e6, 'siPrefix': True, 'suffix': 'Hz', 'renamable': True}, @@ -118,7 +101,6 @@ params = [ {'name': 'ScalableParam 1', 'type': 'str', 'value': "default param 1"}, {'name': 'ScalableParam 2', 'type': 'str', 'value': "default param 2"}, ]), - {'name': 'Custom parameter class (text box)', 'type': 'text', 'value': 'Some text...'}, ] ## Create tree of Parameter objects @@ -140,15 +122,29 @@ def change(param, changes): p.sigTreeStateChanged.connect(change) + +def save(): + global state + state = p.saveState() + +def restore(): + global state + add = p['Save/Restore functionality', 'Restore State', 'Add missing items'] + rem = p['Save/Restore functionality', 'Restore State', 'Remove extra items'] + p.restoreState(state, addChildren=add, removeChildren=rem) +p.param('Save/Restore functionality', 'Save State').sigActivated.connect(save) +p.param('Save/Restore functionality', 'Restore State').sigActivated.connect(restore) + + ## Create two ParameterTree widgets, both accessing the same data t = ParameterTree() t.setParameters(p, showTop=False) t.show() -t.resize(400,600) +t.resize(400,800) t2 = ParameterTree() t2.setParameters(p, showTop=False) t2.show() -t2.resize(400,600) +t2.resize(400,800) ## test save/restore s = p.saveState() diff --git a/flowchart/Flowchart.py b/flowchart/Flowchart.py index 23955857..a5ea5f9a 100644 --- a/flowchart/Flowchart.py +++ b/flowchart/Flowchart.py @@ -1,15 +1,17 @@ # -*- coding: utf-8 -*- -from pyqtgraph.Qt import QtCore, QtGui -#from PyQt4 import QtCore, QtGui -#from PySide import QtCore, QtGui -#import Node as NodeMod +from pyqtgraph.Qt import QtCore, QtGui, USE_PYSIDE from .Node import * -#import functions from collections import OrderedDict from pyqtgraph.widgets.TreeWidget import * -#from .. DataTreeWidget import * -from . import FlowchartTemplate -from . import FlowchartCtrlTemplate + +## pyside and pyqt use incompatible ui files. +if USE_PYSIDE: + from . import FlowchartTemplate_pyside as FlowchartTemplate + from . import FlowchartCtrlTemplate_pyside as FlowchartCtrlTemplate +else: + from . import FlowchartTemplate_pyqt as FlowchartTemplate + from . import FlowchartCtrlTemplate_pyqt as FlowchartCtrlTemplate + from .Terminal import Terminal from numpy import ndarray from . import library diff --git a/flowchart/FlowchartCtrlTemplate.py b/flowchart/FlowchartCtrlTemplate_pyqt.py similarity index 94% rename from flowchart/FlowchartCtrlTemplate.py rename to flowchart/FlowchartCtrlTemplate_pyqt.py index f09e64ed..0410cdf3 100644 --- a/flowchart/FlowchartCtrlTemplate.py +++ b/flowchart/FlowchartCtrlTemplate_pyqt.py @@ -1,9 +1,9 @@ # -*- coding: utf-8 -*- -# Form implementation generated from reading ui file 'FlowchartCtrlTemplate.ui' +# Form implementation generated from reading ui file './flowchart/FlowchartCtrlTemplate.ui' # -# Created: Sun Dec 18 20:55:57 2011 -# by: PyQt4 UI code generator 4.8.3 +# Created: Sun Sep 9 14:41:30 2012 +# by: PyQt4 UI code generator 4.9.1 # # WARNING! All changes made in this file will be lost! @@ -48,8 +48,8 @@ class Ui_Form(object): self.gridLayout.addWidget(self.ctrlList, 3, 0, 1, 4) self.fileNameLabel = QtGui.QLabel(Form) font = QtGui.QFont() - font.setWeight(75) font.setBold(True) + font.setWeight(75) self.fileNameLabel.setFont(font) self.fileNameLabel.setText(_fromUtf8("")) self.fileNameLabel.setAlignment(QtCore.Qt.AlignCenter) diff --git a/flowchart/FlowchartCtrlTemplate_pyside.py b/flowchart/FlowchartCtrlTemplate_pyside.py new file mode 100644 index 00000000..f579c957 --- /dev/null +++ b/flowchart/FlowchartCtrlTemplate_pyside.py @@ -0,0 +1,66 @@ +# -*- coding: utf-8 -*- + +# Form implementation generated from reading ui file './flowchart/FlowchartCtrlTemplate.ui' +# +# Created: Sun Sep 9 14:41:30 2012 +# by: pyside-uic 0.2.13 running on PySide 1.1.0 +# +# WARNING! All changes made in this file will be lost! + +from PySide import QtCore, QtGui + +class Ui_Form(object): + def setupUi(self, Form): + Form.setObjectName("Form") + Form.resize(217, 499) + self.gridLayout = QtGui.QGridLayout(Form) + self.gridLayout.setContentsMargins(0, 0, 0, 0) + self.gridLayout.setVerticalSpacing(0) + self.gridLayout.setObjectName("gridLayout") + self.loadBtn = QtGui.QPushButton(Form) + self.loadBtn.setObjectName("loadBtn") + self.gridLayout.addWidget(self.loadBtn, 1, 0, 1, 1) + self.saveBtn = FeedbackButton(Form) + self.saveBtn.setObjectName("saveBtn") + self.gridLayout.addWidget(self.saveBtn, 1, 1, 1, 2) + self.saveAsBtn = FeedbackButton(Form) + self.saveAsBtn.setObjectName("saveAsBtn") + self.gridLayout.addWidget(self.saveAsBtn, 1, 3, 1, 1) + self.reloadBtn = FeedbackButton(Form) + self.reloadBtn.setCheckable(False) + self.reloadBtn.setFlat(False) + self.reloadBtn.setObjectName("reloadBtn") + self.gridLayout.addWidget(self.reloadBtn, 4, 0, 1, 2) + self.showChartBtn = QtGui.QPushButton(Form) + self.showChartBtn.setCheckable(True) + self.showChartBtn.setObjectName("showChartBtn") + self.gridLayout.addWidget(self.showChartBtn, 4, 2, 1, 2) + self.ctrlList = TreeWidget(Form) + self.ctrlList.setObjectName("ctrlList") + self.ctrlList.headerItem().setText(0, "1") + self.ctrlList.header().setVisible(False) + self.ctrlList.header().setStretchLastSection(False) + self.gridLayout.addWidget(self.ctrlList, 3, 0, 1, 4) + self.fileNameLabel = QtGui.QLabel(Form) + font = QtGui.QFont() + font.setWeight(75) + font.setBold(True) + self.fileNameLabel.setFont(font) + self.fileNameLabel.setText("") + self.fileNameLabel.setAlignment(QtCore.Qt.AlignCenter) + self.fileNameLabel.setObjectName("fileNameLabel") + self.gridLayout.addWidget(self.fileNameLabel, 0, 1, 1, 1) + + self.retranslateUi(Form) + QtCore.QMetaObject.connectSlotsByName(Form) + + def retranslateUi(self, Form): + Form.setWindowTitle(QtGui.QApplication.translate("Form", "Form", None, QtGui.QApplication.UnicodeUTF8)) + self.loadBtn.setText(QtGui.QApplication.translate("Form", "Load..", None, QtGui.QApplication.UnicodeUTF8)) + self.saveBtn.setText(QtGui.QApplication.translate("Form", "Save", None, QtGui.QApplication.UnicodeUTF8)) + self.saveAsBtn.setText(QtGui.QApplication.translate("Form", "As..", None, QtGui.QApplication.UnicodeUTF8)) + self.reloadBtn.setText(QtGui.QApplication.translate("Form", "Reload Libs", None, QtGui.QApplication.UnicodeUTF8)) + self.showChartBtn.setText(QtGui.QApplication.translate("Form", "Flowchart", None, QtGui.QApplication.UnicodeUTF8)) + +from pyqtgraph.widgets.FeedbackButton import FeedbackButton +from pyqtgraph.widgets.TreeWidget import TreeWidget diff --git a/flowchart/FlowchartTemplate.py b/flowchart/FlowchartTemplate_pyqt.py similarity index 91% rename from flowchart/FlowchartTemplate.py rename to flowchart/FlowchartTemplate_pyqt.py index b92af212..2e9ea312 100644 --- a/flowchart/FlowchartTemplate.py +++ b/flowchart/FlowchartTemplate_pyqt.py @@ -1,9 +1,9 @@ # -*- coding: utf-8 -*- -# Form implementation generated from reading ui file 'FlowchartTemplate.ui' +# Form implementation generated from reading ui file './flowchart/FlowchartTemplate.ui' # -# Created: Sun Dec 18 20:55:57 2011 -# by: PyQt4 UI code generator 4.8.3 +# Created: Sun Sep 9 14:41:29 2012 +# by: PyQt4 UI code generator 4.9.1 # # WARNING! All changes made in this file will be lost! @@ -32,8 +32,8 @@ class Ui_Form(object): self.gridLayout.addWidget(self.selDescLabel, 0, 0, 1, 1) self.selNameLabel = QtGui.QLabel(self.selInfoWidget) font = QtGui.QFont() - font.setWeight(75) font.setBold(True) + font.setWeight(75) self.selNameLabel.setFont(font) self.selNameLabel.setText(_fromUtf8("")) self.selNameLabel.setObjectName(_fromUtf8("selNameLabel")) @@ -56,4 +56,4 @@ class Ui_Form(object): Form.setWindowTitle(QtGui.QApplication.translate("Form", "Form", None, QtGui.QApplication.UnicodeUTF8)) from pyqtgraph.widgets.DataTreeWidget import DataTreeWidget -from .FlowchartGraphicsView import FlowchartGraphicsView +from FlowchartGraphicsView import FlowchartGraphicsView diff --git a/flowchart/FlowchartTemplate_pyside.py b/flowchart/FlowchartTemplate_pyside.py new file mode 100644 index 00000000..d49d3083 --- /dev/null +++ b/flowchart/FlowchartTemplate_pyside.py @@ -0,0 +1,54 @@ +# -*- coding: utf-8 -*- + +# Form implementation generated from reading ui file './flowchart/FlowchartTemplate.ui' +# +# Created: Sun Sep 9 14:41:30 2012 +# by: pyside-uic 0.2.13 running on PySide 1.1.0 +# +# WARNING! All changes made in this file will be lost! + +from PySide import QtCore, QtGui + +class Ui_Form(object): + def setupUi(self, Form): + Form.setObjectName("Form") + Form.resize(529, 329) + self.selInfoWidget = QtGui.QWidget(Form) + self.selInfoWidget.setGeometry(QtCore.QRect(260, 10, 264, 222)) + self.selInfoWidget.setObjectName("selInfoWidget") + self.gridLayout = QtGui.QGridLayout(self.selInfoWidget) + self.gridLayout.setContentsMargins(0, 0, 0, 0) + self.gridLayout.setObjectName("gridLayout") + self.selDescLabel = QtGui.QLabel(self.selInfoWidget) + self.selDescLabel.setText("") + self.selDescLabel.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop) + self.selDescLabel.setWordWrap(True) + self.selDescLabel.setObjectName("selDescLabel") + self.gridLayout.addWidget(self.selDescLabel, 0, 0, 1, 1) + self.selNameLabel = QtGui.QLabel(self.selInfoWidget) + font = QtGui.QFont() + font.setWeight(75) + font.setBold(True) + self.selNameLabel.setFont(font) + self.selNameLabel.setText("") + self.selNameLabel.setObjectName("selNameLabel") + self.gridLayout.addWidget(self.selNameLabel, 0, 1, 1, 1) + self.selectedTree = DataTreeWidget(self.selInfoWidget) + self.selectedTree.setObjectName("selectedTree") + self.selectedTree.headerItem().setText(0, "1") + self.gridLayout.addWidget(self.selectedTree, 1, 0, 1, 2) + self.hoverText = QtGui.QTextEdit(Form) + self.hoverText.setGeometry(QtCore.QRect(0, 240, 521, 81)) + self.hoverText.setObjectName("hoverText") + self.view = FlowchartGraphicsView(Form) + self.view.setGeometry(QtCore.QRect(0, 0, 256, 192)) + self.view.setObjectName("view") + + self.retranslateUi(Form) + QtCore.QMetaObject.connectSlotsByName(Form) + + def retranslateUi(self, Form): + Form.setWindowTitle(QtGui.QApplication.translate("Form", "Form", None, QtGui.QApplication.UnicodeUTF8)) + +from pyqtgraph.widgets.DataTreeWidget import DataTreeWidget +from FlowchartGraphicsView import FlowchartGraphicsView diff --git a/graphicsItems/PlotItem/PlotItem.py b/graphicsItems/PlotItem/PlotItem.py index 60f30a1d..c9ebe3f4 100644 --- a/graphicsItems/PlotItem/PlotItem.py +++ b/graphicsItems/PlotItem/PlotItem.py @@ -16,24 +16,24 @@ This class is very heavily featured: - Control panel with a huge feature set including averaging, decimation, display, power spectrum, svg/png export, plot linking, and more. """ -#from graphicsItems import * -from .plotConfigTemplate import * -from pyqtgraph.Qt import QtGui, QtCore, QtSvg +from pyqtgraph.Qt import QtGui, QtCore, QtSvg, USE_PYSIDE + +if USE_PYSIDE: + from .plotConfigTemplate_pyside import * +else: + from .plotConfigTemplate_pyqt import * + import pyqtgraph.functions as fn from pyqtgraph.widgets.FileDialog import FileDialog import weakref -#from types import * import numpy as np import os -#from .. PlotCurveItem import PlotCurveItem -#from .. ScatterPlotItem import ScatterPlotItem from .. PlotDataItem import PlotDataItem from .. ViewBox import ViewBox from .. AxisItem import AxisItem from .. LabelItem import LabelItem from .. GraphicsWidget import GraphicsWidget from .. ButtonItem import ButtonItem -#from .. GraphicsLayout import GraphicsLayout from pyqtgraph.WidgetGroup import WidgetGroup import collections diff --git a/graphicsItems/PlotItem/plotConfigTemplate.py b/graphicsItems/PlotItem/plotConfigTemplate_pyqt.py similarity index 98% rename from graphicsItems/PlotItem/plotConfigTemplate.py rename to graphicsItems/PlotItem/plotConfigTemplate_pyqt.py index 0c620839..d34cd297 100644 --- a/graphicsItems/PlotItem/plotConfigTemplate.py +++ b/graphicsItems/PlotItem/plotConfigTemplate_pyqt.py @@ -1,9 +1,9 @@ # -*- coding: utf-8 -*- -# Form implementation generated from reading ui file 'plotConfigTemplate.ui' +# Form implementation generated from reading ui file './graphicsItems/PlotItem/plotConfigTemplate.ui' # -# Created: Sat Apr 21 14:42:02 2012 -# by: PyQt4 UI code generator 4.8.5 +# Created: Sun Sep 9 14:41:32 2012 +# by: PyQt4 UI code generator 4.9.1 # # WARNING! All changes made in this file will be lost! @@ -18,11 +18,8 @@ class Ui_Form(object): def setupUi(self, Form): Form.setObjectName(_fromUtf8("Form")) Form.resize(258, 605) - Form.setWindowTitle(QtGui.QApplication.translate("Form", "Form", None, QtGui.QApplication.UnicodeUTF8)) self.averageGroup = QtGui.QGroupBox(Form) self.averageGroup.setGeometry(QtCore.QRect(10, 200, 242, 182)) - self.averageGroup.setToolTip(QtGui.QApplication.translate("Form", "Display averages of the curves displayed in this plot. The parameter list allows you to choose parameters to average over (if any are available).", None, QtGui.QApplication.UnicodeUTF8)) - self.averageGroup.setTitle(QtGui.QApplication.translate("Form", "Average", None, QtGui.QApplication.UnicodeUTF8)) self.averageGroup.setCheckable(True) self.averageGroup.setChecked(False) self.averageGroup.setObjectName(_fromUtf8("averageGroup")) @@ -35,7 +32,6 @@ class Ui_Form(object): self.gridLayout_5.addWidget(self.avgParamList, 0, 0, 1, 1) self.decimateGroup = QtGui.QGroupBox(Form) self.decimateGroup.setGeometry(QtCore.QRect(0, 70, 242, 160)) - self.decimateGroup.setTitle(QtGui.QApplication.translate("Form", "Downsample", None, QtGui.QApplication.UnicodeUTF8)) self.decimateGroup.setCheckable(True) self.decimateGroup.setObjectName(_fromUtf8("decimateGroup")) self.gridLayout_4 = QtGui.QGridLayout(self.decimateGroup) @@ -43,7 +39,6 @@ class Ui_Form(object): self.gridLayout_4.setSpacing(0) self.gridLayout_4.setObjectName(_fromUtf8("gridLayout_4")) self.manualDecimateRadio = QtGui.QRadioButton(self.decimateGroup) - self.manualDecimateRadio.setText(QtGui.QApplication.translate("Form", "Manual", None, QtGui.QApplication.UnicodeUTF8)) self.manualDecimateRadio.setChecked(True) self.manualDecimateRadio.setObjectName(_fromUtf8("manualDecimateRadio")) self.gridLayout_4.addWidget(self.manualDecimateRadio, 0, 0, 1, 1) @@ -54,22 +49,16 @@ class Ui_Form(object): self.downsampleSpin.setObjectName(_fromUtf8("downsampleSpin")) self.gridLayout_4.addWidget(self.downsampleSpin, 0, 1, 1, 1) self.autoDecimateRadio = QtGui.QRadioButton(self.decimateGroup) - self.autoDecimateRadio.setText(QtGui.QApplication.translate("Form", "Auto", None, QtGui.QApplication.UnicodeUTF8)) self.autoDecimateRadio.setChecked(False) self.autoDecimateRadio.setObjectName(_fromUtf8("autoDecimateRadio")) self.gridLayout_4.addWidget(self.autoDecimateRadio, 1, 0, 1, 1) self.maxTracesCheck = QtGui.QCheckBox(self.decimateGroup) - self.maxTracesCheck.setToolTip(QtGui.QApplication.translate("Form", "If multiple curves are displayed in this plot, check this box to limit the number of traces that are displayed.", None, QtGui.QApplication.UnicodeUTF8)) - self.maxTracesCheck.setText(QtGui.QApplication.translate("Form", "Max Traces:", None, QtGui.QApplication.UnicodeUTF8)) self.maxTracesCheck.setObjectName(_fromUtf8("maxTracesCheck")) self.gridLayout_4.addWidget(self.maxTracesCheck, 2, 0, 1, 1) self.maxTracesSpin = QtGui.QSpinBox(self.decimateGroup) - self.maxTracesSpin.setToolTip(QtGui.QApplication.translate("Form", "If multiple curves are displayed in this plot, check \"Max Traces\" and set this value to limit the number of traces that are displayed.", None, QtGui.QApplication.UnicodeUTF8)) self.maxTracesSpin.setObjectName(_fromUtf8("maxTracesSpin")) self.gridLayout_4.addWidget(self.maxTracesSpin, 2, 1, 1, 1) self.forgetTracesCheck = QtGui.QCheckBox(self.decimateGroup) - self.forgetTracesCheck.setToolTip(QtGui.QApplication.translate("Form", "If MaxTraces is checked, remove curves from memory after they are hidden (saves memory, but traces can not be un-hidden).", None, QtGui.QApplication.UnicodeUTF8)) - self.forgetTracesCheck.setText(QtGui.QApplication.translate("Form", "Forget hidden traces", None, QtGui.QApplication.UnicodeUTF8)) self.forgetTracesCheck.setObjectName(_fromUtf8("forgetTracesCheck")) self.gridLayout_4.addWidget(self.forgetTracesCheck, 3, 0, 1, 2) self.transformGroup = QtGui.QFrame(Form) @@ -78,26 +67,21 @@ class Ui_Form(object): self.gridLayout = QtGui.QGridLayout(self.transformGroup) self.gridLayout.setObjectName(_fromUtf8("gridLayout")) self.fftCheck = QtGui.QCheckBox(self.transformGroup) - self.fftCheck.setText(QtGui.QApplication.translate("Form", "Power Spectrum (FFT)", None, QtGui.QApplication.UnicodeUTF8)) self.fftCheck.setObjectName(_fromUtf8("fftCheck")) self.gridLayout.addWidget(self.fftCheck, 0, 0, 1, 1) self.logXCheck = QtGui.QCheckBox(self.transformGroup) - self.logXCheck.setText(QtGui.QApplication.translate("Form", "Log X", None, QtGui.QApplication.UnicodeUTF8)) self.logXCheck.setObjectName(_fromUtf8("logXCheck")) self.gridLayout.addWidget(self.logXCheck, 1, 0, 1, 1) self.logYCheck = QtGui.QCheckBox(self.transformGroup) - self.logYCheck.setText(QtGui.QApplication.translate("Form", "Log Y", None, QtGui.QApplication.UnicodeUTF8)) self.logYCheck.setObjectName(_fromUtf8("logYCheck")) self.gridLayout.addWidget(self.logYCheck, 2, 0, 1, 1) self.pointsGroup = QtGui.QGroupBox(Form) self.pointsGroup.setGeometry(QtCore.QRect(10, 550, 234, 58)) - self.pointsGroup.setTitle(QtGui.QApplication.translate("Form", "Points", None, QtGui.QApplication.UnicodeUTF8)) self.pointsGroup.setCheckable(True) self.pointsGroup.setObjectName(_fromUtf8("pointsGroup")) self.verticalLayout_5 = QtGui.QVBoxLayout(self.pointsGroup) self.verticalLayout_5.setObjectName(_fromUtf8("verticalLayout_5")) self.autoPointsCheck = QtGui.QCheckBox(self.pointsGroup) - self.autoPointsCheck.setText(QtGui.QApplication.translate("Form", "Auto", None, QtGui.QApplication.UnicodeUTF8)) self.autoPointsCheck.setChecked(True) self.autoPointsCheck.setObjectName(_fromUtf8("autoPointsCheck")) self.verticalLayout_5.addWidget(self.autoPointsCheck) @@ -107,11 +91,9 @@ class Ui_Form(object): self.gridLayout_2 = QtGui.QGridLayout(self.gridGroup) self.gridLayout_2.setObjectName(_fromUtf8("gridLayout_2")) self.xGridCheck = QtGui.QCheckBox(self.gridGroup) - self.xGridCheck.setText(QtGui.QApplication.translate("Form", "Show X Grid", None, QtGui.QApplication.UnicodeUTF8)) self.xGridCheck.setObjectName(_fromUtf8("xGridCheck")) self.gridLayout_2.addWidget(self.xGridCheck, 0, 0, 1, 2) self.yGridCheck = QtGui.QCheckBox(self.gridGroup) - self.yGridCheck.setText(QtGui.QApplication.translate("Form", "Show Y Grid", None, QtGui.QApplication.UnicodeUTF8)) self.yGridCheck.setObjectName(_fromUtf8("yGridCheck")) self.gridLayout_2.addWidget(self.yGridCheck, 1, 0, 1, 2) self.gridAlphaSlider = QtGui.QSlider(self.gridGroup) @@ -121,18 +103,15 @@ class Ui_Form(object): self.gridAlphaSlider.setObjectName(_fromUtf8("gridAlphaSlider")) self.gridLayout_2.addWidget(self.gridAlphaSlider, 2, 1, 1, 1) self.label = QtGui.QLabel(self.gridGroup) - self.label.setText(QtGui.QApplication.translate("Form", "Opacity", None, QtGui.QApplication.UnicodeUTF8)) self.label.setObjectName(_fromUtf8("label")) self.gridLayout_2.addWidget(self.label, 2, 0, 1, 1) self.alphaGroup = QtGui.QGroupBox(Form) self.alphaGroup.setGeometry(QtCore.QRect(10, 390, 234, 60)) - self.alphaGroup.setTitle(QtGui.QApplication.translate("Form", "Alpha", None, QtGui.QApplication.UnicodeUTF8)) self.alphaGroup.setCheckable(True) self.alphaGroup.setObjectName(_fromUtf8("alphaGroup")) self.horizontalLayout = QtGui.QHBoxLayout(self.alphaGroup) self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout")) self.autoAlphaCheck = QtGui.QCheckBox(self.alphaGroup) - self.autoAlphaCheck.setText(QtGui.QApplication.translate("Form", "Auto", None, QtGui.QApplication.UnicodeUTF8)) self.autoAlphaCheck.setChecked(False) self.autoAlphaCheck.setObjectName(_fromUtf8("autoAlphaCheck")) self.horizontalLayout.addWidget(self.autoAlphaCheck) @@ -147,5 +126,25 @@ class Ui_Form(object): QtCore.QMetaObject.connectSlotsByName(Form) def retranslateUi(self, Form): - pass + Form.setWindowTitle(QtGui.QApplication.translate("Form", "Form", None, QtGui.QApplication.UnicodeUTF8)) + self.averageGroup.setToolTip(QtGui.QApplication.translate("Form", "Display averages of the curves displayed in this plot. The parameter list allows you to choose parameters to average over (if any are available).", None, QtGui.QApplication.UnicodeUTF8)) + self.averageGroup.setTitle(QtGui.QApplication.translate("Form", "Average", None, QtGui.QApplication.UnicodeUTF8)) + self.decimateGroup.setTitle(QtGui.QApplication.translate("Form", "Downsample", None, QtGui.QApplication.UnicodeUTF8)) + self.manualDecimateRadio.setText(QtGui.QApplication.translate("Form", "Manual", None, QtGui.QApplication.UnicodeUTF8)) + self.autoDecimateRadio.setText(QtGui.QApplication.translate("Form", "Auto", None, QtGui.QApplication.UnicodeUTF8)) + self.maxTracesCheck.setToolTip(QtGui.QApplication.translate("Form", "If multiple curves are displayed in this plot, check this box to limit the number of traces that are displayed.", None, QtGui.QApplication.UnicodeUTF8)) + self.maxTracesCheck.setText(QtGui.QApplication.translate("Form", "Max Traces:", None, QtGui.QApplication.UnicodeUTF8)) + self.maxTracesSpin.setToolTip(QtGui.QApplication.translate("Form", "If multiple curves are displayed in this plot, check \"Max Traces\" and set this value to limit the number of traces that are displayed.", None, QtGui.QApplication.UnicodeUTF8)) + self.forgetTracesCheck.setToolTip(QtGui.QApplication.translate("Form", "If MaxTraces is checked, remove curves from memory after they are hidden (saves memory, but traces can not be un-hidden).", None, QtGui.QApplication.UnicodeUTF8)) + self.forgetTracesCheck.setText(QtGui.QApplication.translate("Form", "Forget hidden traces", None, QtGui.QApplication.UnicodeUTF8)) + self.fftCheck.setText(QtGui.QApplication.translate("Form", "Power Spectrum (FFT)", None, QtGui.QApplication.UnicodeUTF8)) + self.logXCheck.setText(QtGui.QApplication.translate("Form", "Log X", None, QtGui.QApplication.UnicodeUTF8)) + self.logYCheck.setText(QtGui.QApplication.translate("Form", "Log Y", None, QtGui.QApplication.UnicodeUTF8)) + self.pointsGroup.setTitle(QtGui.QApplication.translate("Form", "Points", None, QtGui.QApplication.UnicodeUTF8)) + self.autoPointsCheck.setText(QtGui.QApplication.translate("Form", "Auto", None, QtGui.QApplication.UnicodeUTF8)) + self.xGridCheck.setText(QtGui.QApplication.translate("Form", "Show X Grid", None, QtGui.QApplication.UnicodeUTF8)) + self.yGridCheck.setText(QtGui.QApplication.translate("Form", "Show Y Grid", None, QtGui.QApplication.UnicodeUTF8)) + self.label.setText(QtGui.QApplication.translate("Form", "Opacity", None, QtGui.QApplication.UnicodeUTF8)) + self.alphaGroup.setTitle(QtGui.QApplication.translate("Form", "Alpha", None, QtGui.QApplication.UnicodeUTF8)) + self.autoAlphaCheck.setText(QtGui.QApplication.translate("Form", "Auto", None, QtGui.QApplication.UnicodeUTF8)) diff --git a/graphicsItems/PlotItem/plotConfigTemplate_pyside.py b/graphicsItems/PlotItem/plotConfigTemplate_pyside.py new file mode 100644 index 00000000..85b563a7 --- /dev/null +++ b/graphicsItems/PlotItem/plotConfigTemplate_pyside.py @@ -0,0 +1,145 @@ +# -*- coding: utf-8 -*- + +# Form implementation generated from reading ui file './graphicsItems/PlotItem/plotConfigTemplate.ui' +# +# Created: Sun Sep 9 14:41:32 2012 +# by: pyside-uic 0.2.13 running on PySide 1.1.0 +# +# WARNING! All changes made in this file will be lost! + +from PySide import QtCore, QtGui + +class Ui_Form(object): + def setupUi(self, Form): + Form.setObjectName("Form") + Form.resize(258, 605) + self.averageGroup = QtGui.QGroupBox(Form) + self.averageGroup.setGeometry(QtCore.QRect(10, 200, 242, 182)) + self.averageGroup.setCheckable(True) + self.averageGroup.setChecked(False) + self.averageGroup.setObjectName("averageGroup") + self.gridLayout_5 = QtGui.QGridLayout(self.averageGroup) + self.gridLayout_5.setContentsMargins(0, 0, 0, 0) + self.gridLayout_5.setSpacing(0) + self.gridLayout_5.setObjectName("gridLayout_5") + self.avgParamList = QtGui.QListWidget(self.averageGroup) + self.avgParamList.setObjectName("avgParamList") + self.gridLayout_5.addWidget(self.avgParamList, 0, 0, 1, 1) + self.decimateGroup = QtGui.QGroupBox(Form) + self.decimateGroup.setGeometry(QtCore.QRect(0, 70, 242, 160)) + self.decimateGroup.setCheckable(True) + self.decimateGroup.setObjectName("decimateGroup") + self.gridLayout_4 = QtGui.QGridLayout(self.decimateGroup) + self.gridLayout_4.setContentsMargins(0, 0, 0, 0) + self.gridLayout_4.setSpacing(0) + self.gridLayout_4.setObjectName("gridLayout_4") + self.manualDecimateRadio = QtGui.QRadioButton(self.decimateGroup) + self.manualDecimateRadio.setChecked(True) + self.manualDecimateRadio.setObjectName("manualDecimateRadio") + self.gridLayout_4.addWidget(self.manualDecimateRadio, 0, 0, 1, 1) + self.downsampleSpin = QtGui.QSpinBox(self.decimateGroup) + self.downsampleSpin.setMinimum(1) + self.downsampleSpin.setMaximum(100000) + self.downsampleSpin.setProperty("value", 1) + self.downsampleSpin.setObjectName("downsampleSpin") + self.gridLayout_4.addWidget(self.downsampleSpin, 0, 1, 1, 1) + self.autoDecimateRadio = QtGui.QRadioButton(self.decimateGroup) + self.autoDecimateRadio.setChecked(False) + self.autoDecimateRadio.setObjectName("autoDecimateRadio") + self.gridLayout_4.addWidget(self.autoDecimateRadio, 1, 0, 1, 1) + self.maxTracesCheck = QtGui.QCheckBox(self.decimateGroup) + self.maxTracesCheck.setObjectName("maxTracesCheck") + self.gridLayout_4.addWidget(self.maxTracesCheck, 2, 0, 1, 1) + self.maxTracesSpin = QtGui.QSpinBox(self.decimateGroup) + self.maxTracesSpin.setObjectName("maxTracesSpin") + self.gridLayout_4.addWidget(self.maxTracesSpin, 2, 1, 1, 1) + self.forgetTracesCheck = QtGui.QCheckBox(self.decimateGroup) + self.forgetTracesCheck.setObjectName("forgetTracesCheck") + self.gridLayout_4.addWidget(self.forgetTracesCheck, 3, 0, 1, 2) + self.transformGroup = QtGui.QFrame(Form) + self.transformGroup.setGeometry(QtCore.QRect(0, 0, 154, 79)) + self.transformGroup.setObjectName("transformGroup") + self.gridLayout = QtGui.QGridLayout(self.transformGroup) + self.gridLayout.setObjectName("gridLayout") + self.fftCheck = QtGui.QCheckBox(self.transformGroup) + self.fftCheck.setObjectName("fftCheck") + self.gridLayout.addWidget(self.fftCheck, 0, 0, 1, 1) + self.logXCheck = QtGui.QCheckBox(self.transformGroup) + self.logXCheck.setObjectName("logXCheck") + self.gridLayout.addWidget(self.logXCheck, 1, 0, 1, 1) + self.logYCheck = QtGui.QCheckBox(self.transformGroup) + self.logYCheck.setObjectName("logYCheck") + self.gridLayout.addWidget(self.logYCheck, 2, 0, 1, 1) + self.pointsGroup = QtGui.QGroupBox(Form) + self.pointsGroup.setGeometry(QtCore.QRect(10, 550, 234, 58)) + self.pointsGroup.setCheckable(True) + self.pointsGroup.setObjectName("pointsGroup") + self.verticalLayout_5 = QtGui.QVBoxLayout(self.pointsGroup) + self.verticalLayout_5.setObjectName("verticalLayout_5") + self.autoPointsCheck = QtGui.QCheckBox(self.pointsGroup) + self.autoPointsCheck.setChecked(True) + self.autoPointsCheck.setObjectName("autoPointsCheck") + self.verticalLayout_5.addWidget(self.autoPointsCheck) + self.gridGroup = QtGui.QFrame(Form) + self.gridGroup.setGeometry(QtCore.QRect(10, 460, 221, 81)) + self.gridGroup.setObjectName("gridGroup") + self.gridLayout_2 = QtGui.QGridLayout(self.gridGroup) + self.gridLayout_2.setObjectName("gridLayout_2") + self.xGridCheck = QtGui.QCheckBox(self.gridGroup) + self.xGridCheck.setObjectName("xGridCheck") + self.gridLayout_2.addWidget(self.xGridCheck, 0, 0, 1, 2) + self.yGridCheck = QtGui.QCheckBox(self.gridGroup) + self.yGridCheck.setObjectName("yGridCheck") + self.gridLayout_2.addWidget(self.yGridCheck, 1, 0, 1, 2) + self.gridAlphaSlider = QtGui.QSlider(self.gridGroup) + self.gridAlphaSlider.setMaximum(255) + self.gridAlphaSlider.setProperty("value", 128) + self.gridAlphaSlider.setOrientation(QtCore.Qt.Horizontal) + self.gridAlphaSlider.setObjectName("gridAlphaSlider") + self.gridLayout_2.addWidget(self.gridAlphaSlider, 2, 1, 1, 1) + self.label = QtGui.QLabel(self.gridGroup) + self.label.setObjectName("label") + self.gridLayout_2.addWidget(self.label, 2, 0, 1, 1) + self.alphaGroup = QtGui.QGroupBox(Form) + self.alphaGroup.setGeometry(QtCore.QRect(10, 390, 234, 60)) + self.alphaGroup.setCheckable(True) + self.alphaGroup.setObjectName("alphaGroup") + self.horizontalLayout = QtGui.QHBoxLayout(self.alphaGroup) + self.horizontalLayout.setObjectName("horizontalLayout") + self.autoAlphaCheck = QtGui.QCheckBox(self.alphaGroup) + self.autoAlphaCheck.setChecked(False) + self.autoAlphaCheck.setObjectName("autoAlphaCheck") + self.horizontalLayout.addWidget(self.autoAlphaCheck) + self.alphaSlider = QtGui.QSlider(self.alphaGroup) + self.alphaSlider.setMaximum(1000) + self.alphaSlider.setProperty("value", 1000) + self.alphaSlider.setOrientation(QtCore.Qt.Horizontal) + self.alphaSlider.setObjectName("alphaSlider") + self.horizontalLayout.addWidget(self.alphaSlider) + + self.retranslateUi(Form) + QtCore.QMetaObject.connectSlotsByName(Form) + + def retranslateUi(self, Form): + Form.setWindowTitle(QtGui.QApplication.translate("Form", "Form", None, QtGui.QApplication.UnicodeUTF8)) + self.averageGroup.setToolTip(QtGui.QApplication.translate("Form", "Display averages of the curves displayed in this plot. The parameter list allows you to choose parameters to average over (if any are available).", None, QtGui.QApplication.UnicodeUTF8)) + self.averageGroup.setTitle(QtGui.QApplication.translate("Form", "Average", None, QtGui.QApplication.UnicodeUTF8)) + self.decimateGroup.setTitle(QtGui.QApplication.translate("Form", "Downsample", None, QtGui.QApplication.UnicodeUTF8)) + self.manualDecimateRadio.setText(QtGui.QApplication.translate("Form", "Manual", None, QtGui.QApplication.UnicodeUTF8)) + self.autoDecimateRadio.setText(QtGui.QApplication.translate("Form", "Auto", None, QtGui.QApplication.UnicodeUTF8)) + self.maxTracesCheck.setToolTip(QtGui.QApplication.translate("Form", "If multiple curves are displayed in this plot, check this box to limit the number of traces that are displayed.", None, QtGui.QApplication.UnicodeUTF8)) + self.maxTracesCheck.setText(QtGui.QApplication.translate("Form", "Max Traces:", None, QtGui.QApplication.UnicodeUTF8)) + self.maxTracesSpin.setToolTip(QtGui.QApplication.translate("Form", "If multiple curves are displayed in this plot, check \"Max Traces\" and set this value to limit the number of traces that are displayed.", None, QtGui.QApplication.UnicodeUTF8)) + self.forgetTracesCheck.setToolTip(QtGui.QApplication.translate("Form", "If MaxTraces is checked, remove curves from memory after they are hidden (saves memory, but traces can not be un-hidden).", None, QtGui.QApplication.UnicodeUTF8)) + self.forgetTracesCheck.setText(QtGui.QApplication.translate("Form", "Forget hidden traces", None, QtGui.QApplication.UnicodeUTF8)) + self.fftCheck.setText(QtGui.QApplication.translate("Form", "Power Spectrum (FFT)", None, QtGui.QApplication.UnicodeUTF8)) + self.logXCheck.setText(QtGui.QApplication.translate("Form", "Log X", None, QtGui.QApplication.UnicodeUTF8)) + self.logYCheck.setText(QtGui.QApplication.translate("Form", "Log Y", None, QtGui.QApplication.UnicodeUTF8)) + self.pointsGroup.setTitle(QtGui.QApplication.translate("Form", "Points", None, QtGui.QApplication.UnicodeUTF8)) + self.autoPointsCheck.setText(QtGui.QApplication.translate("Form", "Auto", None, QtGui.QApplication.UnicodeUTF8)) + self.xGridCheck.setText(QtGui.QApplication.translate("Form", "Show X Grid", None, QtGui.QApplication.UnicodeUTF8)) + self.yGridCheck.setText(QtGui.QApplication.translate("Form", "Show Y Grid", None, QtGui.QApplication.UnicodeUTF8)) + self.label.setText(QtGui.QApplication.translate("Form", "Opacity", None, QtGui.QApplication.UnicodeUTF8)) + self.alphaGroup.setTitle(QtGui.QApplication.translate("Form", "Alpha", None, QtGui.QApplication.UnicodeUTF8)) + self.autoAlphaCheck.setText(QtGui.QApplication.translate("Form", "Auto", None, QtGui.QApplication.UnicodeUTF8)) + diff --git a/graphicsItems/ViewBox/ViewBoxMenu.py b/graphicsItems/ViewBox/ViewBoxMenu.py index 4c6f54a1..bbb40efc 100644 --- a/graphicsItems/ViewBox/ViewBoxMenu.py +++ b/graphicsItems/ViewBox/ViewBoxMenu.py @@ -1,7 +1,12 @@ -from pyqtgraph.Qt import QtCore, QtGui +from pyqtgraph.Qt import QtCore, QtGui, USE_PYSIDE from pyqtgraph.python2_3 import asUnicode from pyqtgraph.WidgetGroup import WidgetGroup -from .axisCtrlTemplate import Ui_Form as AxisCtrlTemplate + +if USE_PYSIDE: + from .axisCtrlTemplate_pyside import Ui_Form as AxisCtrlTemplate +else: + from .axisCtrlTemplate_pyqt import Ui_Form as AxisCtrlTemplate + import weakref class ViewBoxMenu(QtGui.QMenu): diff --git a/graphicsItems/ViewBox/axisCtrlTemplate.py b/graphicsItems/ViewBox/axisCtrlTemplate_pyqt.py similarity index 98% rename from graphicsItems/ViewBox/axisCtrlTemplate.py rename to graphicsItems/ViewBox/axisCtrlTemplate_pyqt.py index 08fa3af0..db14033e 100644 --- a/graphicsItems/ViewBox/axisCtrlTemplate.py +++ b/graphicsItems/ViewBox/axisCtrlTemplate_pyqt.py @@ -1,8 +1,8 @@ # -*- coding: utf-8 -*- -# Form implementation generated from reading ui file 'axisCtrlTemplate.ui' +# Form implementation generated from reading ui file './graphicsItems/ViewBox/axisCtrlTemplate.ui' # -# Created: Fri Jun 1 17:38:02 2012 +# Created: Sun Sep 9 14:41:31 2012 # by: PyQt4 UI code generator 4.9.1 # # WARNING! All changes made in this file will be lost! diff --git a/graphicsItems/ViewBox/axisCtrlTemplate_pyside.py b/graphicsItems/ViewBox/axisCtrlTemplate_pyside.py new file mode 100644 index 00000000..18510bc2 --- /dev/null +++ b/graphicsItems/ViewBox/axisCtrlTemplate_pyside.py @@ -0,0 +1,88 @@ +# -*- coding: utf-8 -*- + +# Form implementation generated from reading ui file './graphicsItems/ViewBox/axisCtrlTemplate.ui' +# +# Created: Sun Sep 9 14:41:32 2012 +# by: pyside-uic 0.2.13 running on PySide 1.1.0 +# +# WARNING! All changes made in this file will be lost! + +from PySide import QtCore, QtGui + +class Ui_Form(object): + def setupUi(self, Form): + Form.setObjectName("Form") + Form.resize(186, 154) + Form.setMaximumSize(QtCore.QSize(200, 16777215)) + self.gridLayout = QtGui.QGridLayout(Form) + self.gridLayout.setContentsMargins(0, 0, 0, 0) + self.gridLayout.setSpacing(0) + self.gridLayout.setObjectName("gridLayout") + self.label = QtGui.QLabel(Form) + self.label.setObjectName("label") + self.gridLayout.addWidget(self.label, 7, 0, 1, 2) + self.linkCombo = QtGui.QComboBox(Form) + self.linkCombo.setSizeAdjustPolicy(QtGui.QComboBox.AdjustToContents) + self.linkCombo.setObjectName("linkCombo") + self.gridLayout.addWidget(self.linkCombo, 7, 2, 1, 2) + self.autoPercentSpin = QtGui.QSpinBox(Form) + self.autoPercentSpin.setEnabled(True) + self.autoPercentSpin.setMinimum(1) + self.autoPercentSpin.setMaximum(100) + self.autoPercentSpin.setSingleStep(1) + self.autoPercentSpin.setProperty("value", 100) + self.autoPercentSpin.setObjectName("autoPercentSpin") + self.gridLayout.addWidget(self.autoPercentSpin, 2, 2, 1, 2) + self.autoRadio = QtGui.QRadioButton(Form) + self.autoRadio.setChecked(True) + self.autoRadio.setObjectName("autoRadio") + self.gridLayout.addWidget(self.autoRadio, 2, 0, 1, 2) + self.manualRadio = QtGui.QRadioButton(Form) + self.manualRadio.setObjectName("manualRadio") + self.gridLayout.addWidget(self.manualRadio, 1, 0, 1, 2) + self.minText = QtGui.QLineEdit(Form) + self.minText.setObjectName("minText") + self.gridLayout.addWidget(self.minText, 1, 2, 1, 1) + self.maxText = QtGui.QLineEdit(Form) + self.maxText.setObjectName("maxText") + self.gridLayout.addWidget(self.maxText, 1, 3, 1, 1) + self.invertCheck = QtGui.QCheckBox(Form) + self.invertCheck.setObjectName("invertCheck") + self.gridLayout.addWidget(self.invertCheck, 5, 0, 1, 4) + self.mouseCheck = QtGui.QCheckBox(Form) + self.mouseCheck.setChecked(True) + self.mouseCheck.setObjectName("mouseCheck") + self.gridLayout.addWidget(self.mouseCheck, 6, 0, 1, 4) + self.visibleOnlyCheck = QtGui.QCheckBox(Form) + self.visibleOnlyCheck.setObjectName("visibleOnlyCheck") + self.gridLayout.addWidget(self.visibleOnlyCheck, 3, 2, 1, 2) + self.autoPanCheck = QtGui.QCheckBox(Form) + self.autoPanCheck.setObjectName("autoPanCheck") + self.gridLayout.addWidget(self.autoPanCheck, 4, 2, 1, 2) + + self.retranslateUi(Form) + QtCore.QMetaObject.connectSlotsByName(Form) + + def retranslateUi(self, Form): + Form.setWindowTitle(QtGui.QApplication.translate("Form", "Form", None, QtGui.QApplication.UnicodeUTF8)) + self.label.setText(QtGui.QApplication.translate("Form", "Link Axis:", None, QtGui.QApplication.UnicodeUTF8)) + self.linkCombo.setToolTip(QtGui.QApplication.translate("Form", "

Links this axis with another view. When linked, both views will display the same data range.

", None, QtGui.QApplication.UnicodeUTF8)) + self.autoPercentSpin.setToolTip(QtGui.QApplication.translate("Form", "

Percent of data to be visible when auto-scaling. It may be useful to decrease this value for data with spiky noise.

", None, QtGui.QApplication.UnicodeUTF8)) + self.autoPercentSpin.setSuffix(QtGui.QApplication.translate("Form", "%", None, QtGui.QApplication.UnicodeUTF8)) + self.autoRadio.setToolTip(QtGui.QApplication.translate("Form", "

Automatically resize this axis whenever the displayed data is changed.

", None, QtGui.QApplication.UnicodeUTF8)) + self.autoRadio.setText(QtGui.QApplication.translate("Form", "Auto", None, QtGui.QApplication.UnicodeUTF8)) + self.manualRadio.setToolTip(QtGui.QApplication.translate("Form", "

Set the range for this axis manually. This disables automatic scaling.

", None, QtGui.QApplication.UnicodeUTF8)) + self.manualRadio.setText(QtGui.QApplication.translate("Form", "Manual", None, QtGui.QApplication.UnicodeUTF8)) + self.minText.setToolTip(QtGui.QApplication.translate("Form", "

Minimum value to display for this axis.

", None, QtGui.QApplication.UnicodeUTF8)) + self.minText.setText(QtGui.QApplication.translate("Form", "0", None, QtGui.QApplication.UnicodeUTF8)) + self.maxText.setToolTip(QtGui.QApplication.translate("Form", "

Maximum value to display for this axis.

", None, QtGui.QApplication.UnicodeUTF8)) + self.maxText.setText(QtGui.QApplication.translate("Form", "0", None, QtGui.QApplication.UnicodeUTF8)) + self.invertCheck.setToolTip(QtGui.QApplication.translate("Form", "

Inverts the display of this axis. (+y points downward instead of upward)

", None, QtGui.QApplication.UnicodeUTF8)) + self.invertCheck.setText(QtGui.QApplication.translate("Form", "Invert Axis", None, QtGui.QApplication.UnicodeUTF8)) + self.mouseCheck.setToolTip(QtGui.QApplication.translate("Form", "

Enables mouse interaction (panning, scaling) for this axis.

", None, QtGui.QApplication.UnicodeUTF8)) + self.mouseCheck.setText(QtGui.QApplication.translate("Form", "Mouse Enabled", None, QtGui.QApplication.UnicodeUTF8)) + self.visibleOnlyCheck.setToolTip(QtGui.QApplication.translate("Form", "

When checked, the axis will only auto-scale to data that is visible along the orthogonal axis.

", None, QtGui.QApplication.UnicodeUTF8)) + self.visibleOnlyCheck.setText(QtGui.QApplication.translate("Form", "Visible Data Only", None, QtGui.QApplication.UnicodeUTF8)) + self.autoPanCheck.setToolTip(QtGui.QApplication.translate("Form", "

When checked, the axis will automatically pan to center on the current data, but the scale along this axis will not change.

", None, QtGui.QApplication.UnicodeUTF8)) + self.autoPanCheck.setText(QtGui.QApplication.translate("Form", "Auto Pan Only", None, QtGui.QApplication.UnicodeUTF8)) + diff --git a/imageview/ImageView.py b/imageview/ImageView.py index 53eb6809..5c6573e3 100644 --- a/imageview/ImageView.py +++ b/imageview/ImageView.py @@ -12,15 +12,19 @@ Widget used for displaying 2D or 3D data. Features: - ROI plotting - Image normalization through a variety of methods """ +from pyqtgraph.Qt import QtCore, QtGui, USE_PYSIDE -from .ImageViewTemplate import * +if USE_PYSIDE: + from .ImageViewTemplate_pyside import * +else: + from .ImageViewTemplate_pyqt import * + from pyqtgraph.graphicsItems.ImageItem import * from pyqtgraph.graphicsItems.ROI import * from pyqtgraph.graphicsItems.LinearRegionItem import * from pyqtgraph.graphicsItems.InfiniteLine import * from pyqtgraph.graphicsItems.ViewBox import * #from widgets import ROI -from pyqtgraph.Qt import QtCore, QtGui import sys #from numpy import ndarray import pyqtgraph.ptime as ptime diff --git a/imageview/ImageViewTemplate.py b/imageview/ImageViewTemplate_pyqt.py similarity index 98% rename from imageview/ImageViewTemplate.py rename to imageview/ImageViewTemplate_pyqt.py index cf00ed7f..e6423276 100644 --- a/imageview/ImageViewTemplate.py +++ b/imageview/ImageViewTemplate_pyqt.py @@ -1,9 +1,9 @@ # -*- coding: utf-8 -*- -# Form implementation generated from reading ui file 'ImageViewTemplate.ui' +# Form implementation generated from reading ui file './imageview/ImageViewTemplate.ui' # -# Created: Tue Jan 17 23:09:04 2012 -# by: PyQt4 UI code generator 4.8.3 +# Created: Sun Sep 9 14:41:30 2012 +# by: PyQt4 UI code generator 4.9.1 # # WARNING! All changes made in this file will be lost! @@ -79,22 +79,22 @@ class Ui_Form(object): self.gridLayout_2.addWidget(self.normDivideRadio, 0, 1, 1, 1) self.label_5 = QtGui.QLabel(self.normGroup) font = QtGui.QFont() - font.setWeight(75) font.setBold(True) + font.setWeight(75) self.label_5.setFont(font) self.label_5.setObjectName(_fromUtf8("label_5")) self.gridLayout_2.addWidget(self.label_5, 0, 0, 1, 1) self.label_3 = QtGui.QLabel(self.normGroup) font = QtGui.QFont() - font.setWeight(75) font.setBold(True) + font.setWeight(75) self.label_3.setFont(font) self.label_3.setObjectName(_fromUtf8("label_3")) self.gridLayout_2.addWidget(self.label_3, 1, 0, 1, 1) self.label_4 = QtGui.QLabel(self.normGroup) font = QtGui.QFont() - font.setWeight(75) font.setBold(True) + font.setWeight(75) self.label_4.setFont(font) self.label_4.setObjectName(_fromUtf8("label_4")) self.gridLayout_2.addWidget(self.label_4, 2, 0, 1, 1) diff --git a/imageview/ImageViewTemplate_pyside.py b/imageview/ImageViewTemplate_pyside.py new file mode 100644 index 00000000..c17bbfe1 --- /dev/null +++ b/imageview/ImageViewTemplate_pyside.py @@ -0,0 +1,155 @@ +# -*- coding: utf-8 -*- + +# Form implementation generated from reading ui file './imageview/ImageViewTemplate.ui' +# +# Created: Sun Sep 9 14:41:31 2012 +# by: pyside-uic 0.2.13 running on PySide 1.1.0 +# +# WARNING! All changes made in this file will be lost! + +from PySide import QtCore, QtGui + +class Ui_Form(object): + def setupUi(self, Form): + Form.setObjectName("Form") + Form.resize(726, 588) + self.gridLayout_3 = QtGui.QGridLayout(Form) + self.gridLayout_3.setContentsMargins(0, 0, 0, 0) + self.gridLayout_3.setSpacing(0) + self.gridLayout_3.setObjectName("gridLayout_3") + self.splitter = QtGui.QSplitter(Form) + self.splitter.setOrientation(QtCore.Qt.Vertical) + self.splitter.setObjectName("splitter") + self.layoutWidget = QtGui.QWidget(self.splitter) + self.layoutWidget.setObjectName("layoutWidget") + self.gridLayout = QtGui.QGridLayout(self.layoutWidget) + self.gridLayout.setSpacing(0) + self.gridLayout.setContentsMargins(0, 0, 0, 0) + self.gridLayout.setObjectName("gridLayout") + self.graphicsView = GraphicsView(self.layoutWidget) + self.graphicsView.setObjectName("graphicsView") + self.gridLayout.addWidget(self.graphicsView, 0, 0, 2, 1) + self.histogram = HistogramLUTWidget(self.layoutWidget) + self.histogram.setObjectName("histogram") + self.gridLayout.addWidget(self.histogram, 0, 1, 1, 2) + self.roiBtn = QtGui.QPushButton(self.layoutWidget) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(1) + sizePolicy.setHeightForWidth(self.roiBtn.sizePolicy().hasHeightForWidth()) + self.roiBtn.setSizePolicy(sizePolicy) + self.roiBtn.setCheckable(True) + self.roiBtn.setObjectName("roiBtn") + self.gridLayout.addWidget(self.roiBtn, 1, 1, 1, 1) + self.normBtn = QtGui.QPushButton(self.layoutWidget) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(1) + sizePolicy.setHeightForWidth(self.normBtn.sizePolicy().hasHeightForWidth()) + self.normBtn.setSizePolicy(sizePolicy) + self.normBtn.setCheckable(True) + self.normBtn.setObjectName("normBtn") + self.gridLayout.addWidget(self.normBtn, 1, 2, 1, 1) + self.roiPlot = PlotWidget(self.splitter) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Preferred) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.roiPlot.sizePolicy().hasHeightForWidth()) + self.roiPlot.setSizePolicy(sizePolicy) + self.roiPlot.setMinimumSize(QtCore.QSize(0, 40)) + self.roiPlot.setObjectName("roiPlot") + self.gridLayout_3.addWidget(self.splitter, 0, 0, 1, 1) + self.normGroup = QtGui.QGroupBox(Form) + self.normGroup.setObjectName("normGroup") + self.gridLayout_2 = QtGui.QGridLayout(self.normGroup) + self.gridLayout_2.setContentsMargins(0, 0, 0, 0) + self.gridLayout_2.setSpacing(0) + self.gridLayout_2.setObjectName("gridLayout_2") + self.normSubtractRadio = QtGui.QRadioButton(self.normGroup) + self.normSubtractRadio.setObjectName("normSubtractRadio") + self.gridLayout_2.addWidget(self.normSubtractRadio, 0, 2, 1, 1) + self.normDivideRadio = QtGui.QRadioButton(self.normGroup) + self.normDivideRadio.setChecked(False) + self.normDivideRadio.setObjectName("normDivideRadio") + self.gridLayout_2.addWidget(self.normDivideRadio, 0, 1, 1, 1) + self.label_5 = QtGui.QLabel(self.normGroup) + font = QtGui.QFont() + font.setWeight(75) + font.setBold(True) + self.label_5.setFont(font) + self.label_5.setObjectName("label_5") + self.gridLayout_2.addWidget(self.label_5, 0, 0, 1, 1) + self.label_3 = QtGui.QLabel(self.normGroup) + font = QtGui.QFont() + font.setWeight(75) + font.setBold(True) + self.label_3.setFont(font) + self.label_3.setObjectName("label_3") + self.gridLayout_2.addWidget(self.label_3, 1, 0, 1, 1) + self.label_4 = QtGui.QLabel(self.normGroup) + font = QtGui.QFont() + font.setWeight(75) + font.setBold(True) + self.label_4.setFont(font) + self.label_4.setObjectName("label_4") + self.gridLayout_2.addWidget(self.label_4, 2, 0, 1, 1) + self.normROICheck = QtGui.QCheckBox(self.normGroup) + self.normROICheck.setObjectName("normROICheck") + self.gridLayout_2.addWidget(self.normROICheck, 1, 1, 1, 1) + self.normXBlurSpin = QtGui.QDoubleSpinBox(self.normGroup) + self.normXBlurSpin.setObjectName("normXBlurSpin") + self.gridLayout_2.addWidget(self.normXBlurSpin, 2, 2, 1, 1) + self.label_8 = QtGui.QLabel(self.normGroup) + self.label_8.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) + self.label_8.setObjectName("label_8") + self.gridLayout_2.addWidget(self.label_8, 2, 1, 1, 1) + self.label_9 = QtGui.QLabel(self.normGroup) + self.label_9.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) + self.label_9.setObjectName("label_9") + self.gridLayout_2.addWidget(self.label_9, 2, 3, 1, 1) + self.normYBlurSpin = QtGui.QDoubleSpinBox(self.normGroup) + self.normYBlurSpin.setObjectName("normYBlurSpin") + self.gridLayout_2.addWidget(self.normYBlurSpin, 2, 4, 1, 1) + self.label_10 = QtGui.QLabel(self.normGroup) + self.label_10.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) + self.label_10.setObjectName("label_10") + self.gridLayout_2.addWidget(self.label_10, 2, 5, 1, 1) + self.normOffRadio = QtGui.QRadioButton(self.normGroup) + self.normOffRadio.setChecked(True) + self.normOffRadio.setObjectName("normOffRadio") + self.gridLayout_2.addWidget(self.normOffRadio, 0, 3, 1, 1) + self.normTimeRangeCheck = QtGui.QCheckBox(self.normGroup) + self.normTimeRangeCheck.setObjectName("normTimeRangeCheck") + self.gridLayout_2.addWidget(self.normTimeRangeCheck, 1, 3, 1, 1) + self.normFrameCheck = QtGui.QCheckBox(self.normGroup) + self.normFrameCheck.setObjectName("normFrameCheck") + self.gridLayout_2.addWidget(self.normFrameCheck, 1, 2, 1, 1) + self.normTBlurSpin = QtGui.QDoubleSpinBox(self.normGroup) + self.normTBlurSpin.setObjectName("normTBlurSpin") + self.gridLayout_2.addWidget(self.normTBlurSpin, 2, 6, 1, 1) + self.gridLayout_3.addWidget(self.normGroup, 1, 0, 1, 1) + + self.retranslateUi(Form) + QtCore.QMetaObject.connectSlotsByName(Form) + + def retranslateUi(self, Form): + Form.setWindowTitle(QtGui.QApplication.translate("Form", "Form", None, QtGui.QApplication.UnicodeUTF8)) + self.roiBtn.setText(QtGui.QApplication.translate("Form", "ROI", None, QtGui.QApplication.UnicodeUTF8)) + self.normBtn.setText(QtGui.QApplication.translate("Form", "Norm", None, QtGui.QApplication.UnicodeUTF8)) + self.normGroup.setTitle(QtGui.QApplication.translate("Form", "Normalization", None, QtGui.QApplication.UnicodeUTF8)) + self.normSubtractRadio.setText(QtGui.QApplication.translate("Form", "Subtract", None, QtGui.QApplication.UnicodeUTF8)) + self.normDivideRadio.setText(QtGui.QApplication.translate("Form", "Divide", None, QtGui.QApplication.UnicodeUTF8)) + self.label_5.setText(QtGui.QApplication.translate("Form", "Operation:", None, QtGui.QApplication.UnicodeUTF8)) + self.label_3.setText(QtGui.QApplication.translate("Form", "Mean:", None, QtGui.QApplication.UnicodeUTF8)) + self.label_4.setText(QtGui.QApplication.translate("Form", "Blur:", None, QtGui.QApplication.UnicodeUTF8)) + self.normROICheck.setText(QtGui.QApplication.translate("Form", "ROI", None, QtGui.QApplication.UnicodeUTF8)) + self.label_8.setText(QtGui.QApplication.translate("Form", "X", None, QtGui.QApplication.UnicodeUTF8)) + self.label_9.setText(QtGui.QApplication.translate("Form", "Y", None, QtGui.QApplication.UnicodeUTF8)) + self.label_10.setText(QtGui.QApplication.translate("Form", "T", None, QtGui.QApplication.UnicodeUTF8)) + self.normOffRadio.setText(QtGui.QApplication.translate("Form", "Off", None, QtGui.QApplication.UnicodeUTF8)) + self.normTimeRangeCheck.setText(QtGui.QApplication.translate("Form", "Time range", None, QtGui.QApplication.UnicodeUTF8)) + self.normFrameCheck.setText(QtGui.QApplication.translate("Form", "Frame", None, QtGui.QApplication.UnicodeUTF8)) + +from pyqtgraph.widgets.GraphicsView import GraphicsView +from pyqtgraph.widgets.PlotWidget import PlotWidget +from pyqtgraph.widgets.HistogramLUTWidget import HistogramLUTWidget diff --git a/rebuildUi.py b/rebuildUi.py index ee6ccd7f..184230de 100644 --- a/rebuildUi.py +++ b/rebuildUi.py @@ -1,9 +1,9 @@ import os, sys -## run "python rebuildUi.py pyside" to rebuild all ui files for pyside +## Search the package tree for all .ui files, compile each to +## a .py for pyqt and pyside -uic = 'pyuic4' -if len(sys.argv) > 1 and sys.argv[1] == 'pyside': - uic = 'pyside-uic' +pyqtuic = 'pyuic4' +pysideuic = 'pyside-uic' for path, sd, files in os.walk('.'): for f in files: @@ -11,6 +11,11 @@ for path, sd, files in os.walk('.'): if ext != '.ui': continue ui = os.path.join(path, f) - py = os.path.join(path, base + '.py') - os.system('%s %s > %s' % (uic, ui, py)) + + py = os.path.join(path, base + '_pyqt.py') + os.system('%s %s > %s' % (pyqtuic, ui, py)) + print(py) + + py = os.path.join(path, base + '_pyside.py') + os.system('%s %s > %s' % (pysideuic, ui, py)) print(py)