Merge branch 'pyqt5' into develop
Conflicts: examples/parametertree.py pyqtgraph/Qt.py pyqtgraph/graphicsItems/FillBetweenItem.py pyqtgraph/graphicsItems/InfiniteLine.py pyqtgraph/imageview/ImageView.py
This commit is contained in:
commit
1fe5976e19
@ -8,6 +8,8 @@ import pyqtgraph as pg
|
|||||||
from pyqtgraph.Qt import QtGui, QtCore
|
from pyqtgraph.Qt import QtGui, QtCore
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
|
#FIXME: When running on Qt5, not as perfect as on Qt4
|
||||||
|
|
||||||
win = pg.plot()
|
win = pg.plot()
|
||||||
win.setWindowTitle('pyqtgraph example: FillBetweenItem')
|
win.setWindowTitle('pyqtgraph example: FillBetweenItem')
|
||||||
win.setXRange(-10, 10)
|
win.setXRange(-10, 10)
|
||||||
|
@ -89,7 +89,7 @@ class ImageViewNode(Node):
|
|||||||
## CtrlNode is just a convenience class that automatically creates its
|
## CtrlNode is just a convenience class that automatically creates its
|
||||||
## control widget based on a simple data structure.
|
## control widget based on a simple data structure.
|
||||||
class UnsharpMaskNode(CtrlNode):
|
class UnsharpMaskNode(CtrlNode):
|
||||||
"""Return the input data passed through pg.gaussianFilter."""
|
"""Return the input data passed through an unsharp mask."""
|
||||||
nodeName = "UnsharpMask"
|
nodeName = "UnsharpMask"
|
||||||
uiTemplate = [
|
uiTemplate = [
|
||||||
('sigma', 'spin', {'value': 1.0, 'step': 1.0, 'range': [0.0, None]}),
|
('sigma', 'spin', {'value': 1.0, 'step': 1.0, 'range': [0.0, None]}),
|
||||||
|
@ -16,7 +16,7 @@ app = QtGui.QApplication([])
|
|||||||
w = QtGui.QMainWindow()
|
w = QtGui.QMainWindow()
|
||||||
w.show()
|
w.show()
|
||||||
w.setWindowTitle('pyqtgraph example: GradientWidget')
|
w.setWindowTitle('pyqtgraph example: GradientWidget')
|
||||||
w.resize(400,400)
|
w.setGeometry(10, 50, 400, 400)
|
||||||
cw = QtGui.QWidget()
|
cw = QtGui.QWidget()
|
||||||
w.setCentralWidget(cw)
|
w.setCentralWidget(cw)
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ p1.setPen((200,200,100))
|
|||||||
|
|
||||||
## Add in some extra graphics
|
## Add in some extra graphics
|
||||||
rect = QtGui.QGraphicsRectItem(QtCore.QRectF(0, 0, 1, 5e-11))
|
rect = QtGui.QGraphicsRectItem(QtCore.QRectF(0, 0, 1, 5e-11))
|
||||||
rect.setPen(QtGui.QPen(QtGui.QColor(100, 200, 100)))
|
rect.setPen(pg.mkPen(100, 200, 100))
|
||||||
pw.addItem(rect)
|
pw.addItem(rect)
|
||||||
|
|
||||||
pw.setLabel('left', 'Value', units='V')
|
pw.setLabel('left', 'Value', units='V')
|
||||||
|
@ -12,7 +12,7 @@ For testing rapid updates of ScatterPlotItem under various conditions.
|
|||||||
import initExample
|
import initExample
|
||||||
|
|
||||||
|
|
||||||
from pyqtgraph.Qt import QtGui, QtCore, USE_PYSIDE
|
from pyqtgraph.Qt import QtGui, QtCore, USE_PYSIDE, USE_PYQT5
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import pyqtgraph as pg
|
import pyqtgraph as pg
|
||||||
from pyqtgraph.ptime import time
|
from pyqtgraph.ptime import time
|
||||||
@ -22,6 +22,8 @@ app = QtGui.QApplication([])
|
|||||||
#mw.resize(800,800)
|
#mw.resize(800,800)
|
||||||
if USE_PYSIDE:
|
if USE_PYSIDE:
|
||||||
from ScatterPlotSpeedTestTemplate_pyside import Ui_Form
|
from ScatterPlotSpeedTestTemplate_pyside import Ui_Form
|
||||||
|
elif USE_PYQT5:
|
||||||
|
from ScatterPlotSpeedTestTemplate_pyqt5 import Ui_Form
|
||||||
else:
|
else:
|
||||||
from ScatterPlotSpeedTestTemplate_pyqt import Ui_Form
|
from ScatterPlotSpeedTestTemplate_pyqt import Ui_Form
|
||||||
|
|
||||||
|
@ -10,13 +10,15 @@ is used by the view widget
|
|||||||
import initExample ## Add path to library (just for examples; you do not need this)
|
import initExample ## Add path to library (just for examples; you do not need this)
|
||||||
|
|
||||||
|
|
||||||
from pyqtgraph.Qt import QtGui, QtCore, USE_PYSIDE
|
from pyqtgraph.Qt import QtGui, QtCore, USE_PYSIDE, USE_PYQT5
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import pyqtgraph as pg
|
import pyqtgraph as pg
|
||||||
import pyqtgraph.ptime as ptime
|
import pyqtgraph.ptime as ptime
|
||||||
|
|
||||||
if USE_PYSIDE:
|
if USE_PYSIDE:
|
||||||
import VideoTemplate_pyside as VideoTemplate
|
import VideoTemplate_pyside as VideoTemplate
|
||||||
|
elif USE_PYQT5:
|
||||||
|
import VideoTemplate_pyqt5 as VideoTemplate
|
||||||
else:
|
else:
|
||||||
import VideoTemplate_pyqt as VideoTemplate
|
import VideoTemplate_pyqt as VideoTemplate
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ class movableRect(QtGui.QGraphicsRectItem):
|
|||||||
self.setAcceptHoverEvents(True)
|
self.setAcceptHoverEvents(True)
|
||||||
def hoverEnterEvent(self, ev):
|
def hoverEnterEvent(self, ev):
|
||||||
self.savedPen = self.pen()
|
self.savedPen = self.pen()
|
||||||
self.setPen(QtGui.QPen(QtGui.QColor(255, 255, 255)))
|
self.setPen(pg.mkPen(255, 255, 255))
|
||||||
ev.ignore()
|
ev.ignore()
|
||||||
def hoverLeaveEvent(self, ev):
|
def hoverLeaveEvent(self, ev):
|
||||||
self.setPen(self.savedPen)
|
self.setPen(self.savedPen)
|
||||||
@ -57,7 +57,7 @@ class movableRect(QtGui.QGraphicsRectItem):
|
|||||||
self.setPos(self.mapToParent(ev.pos()) - self.pressDelta)
|
self.setPos(self.mapToParent(ev.pos()) - self.pressDelta)
|
||||||
|
|
||||||
rect = movableRect(QtCore.QRectF(0, 0, 1, 1))
|
rect = movableRect(QtCore.QRectF(0, 0, 1, 1))
|
||||||
rect.setPen(QtGui.QPen(QtGui.QColor(100, 200, 100)))
|
rect.setPen(pg.mkPen(100, 200, 100))
|
||||||
vb.addItem(rect)
|
vb.addItem(rect)
|
||||||
|
|
||||||
l.addItem(vb, 0, 1)
|
l.addItem(vb, 0, 1)
|
||||||
|
@ -7,11 +7,13 @@ if __name__ == "__main__" and (__package__ is None or __package__==''):
|
|||||||
__package__ = "examples"
|
__package__ = "examples"
|
||||||
|
|
||||||
from . import initExample
|
from . import initExample
|
||||||
from pyqtgraph.Qt import QtCore, QtGui, USE_PYSIDE
|
from pyqtgraph.Qt import QtCore, QtGui, USE_PYSIDE, USE_PYQT5
|
||||||
import pyqtgraph as pg
|
import pyqtgraph as pg
|
||||||
|
|
||||||
if USE_PYSIDE:
|
if USE_PYSIDE:
|
||||||
from .exampleLoaderTemplate_pyside import Ui_Form
|
from .exampleLoaderTemplate_pyside import Ui_Form
|
||||||
|
elif USE_PYQT5:
|
||||||
|
from .exampleLoaderTemplate_pyqt5 import Ui_Form
|
||||||
else:
|
else:
|
||||||
from .exampleLoaderTemplate_pyqt import Ui_Form
|
from .exampleLoaderTemplate_pyqt import Ui_Form
|
||||||
|
|
||||||
@ -123,20 +125,9 @@ class ExampleLoader(QtGui.QMainWindow):
|
|||||||
self.ui.loadBtn.clicked.connect(self.loadFile)
|
self.ui.loadBtn.clicked.connect(self.loadFile)
|
||||||
self.ui.exampleTree.currentItemChanged.connect(self.showFile)
|
self.ui.exampleTree.currentItemChanged.connect(self.showFile)
|
||||||
self.ui.exampleTree.itemDoubleClicked.connect(self.loadFile)
|
self.ui.exampleTree.itemDoubleClicked.connect(self.loadFile)
|
||||||
self.ui.pyqtCheck.toggled.connect(self.pyqtToggled)
|
|
||||||
self.ui.pysideCheck.toggled.connect(self.pysideToggled)
|
|
||||||
self.ui.codeView.textChanged.connect(self.codeEdited)
|
self.ui.codeView.textChanged.connect(self.codeEdited)
|
||||||
self.codeBtn.clicked.connect(self.runEditedCode)
|
self.codeBtn.clicked.connect(self.runEditedCode)
|
||||||
|
|
||||||
def pyqtToggled(self, b):
|
|
||||||
if b:
|
|
||||||
self.ui.pysideCheck.setChecked(False)
|
|
||||||
|
|
||||||
def pysideToggled(self, b):
|
|
||||||
if b:
|
|
||||||
self.ui.pyqtCheck.setChecked(False)
|
|
||||||
|
|
||||||
|
|
||||||
def populateTree(self, root, examples):
|
def populateTree(self, root, examples):
|
||||||
for key, val in examples.items():
|
for key, val in examples.items():
|
||||||
item = QtGui.QTreeWidgetItem([key])
|
item = QtGui.QTreeWidgetItem([key])
|
||||||
@ -149,7 +140,6 @@ class ExampleLoader(QtGui.QMainWindow):
|
|||||||
self.populateTree(item, val)
|
self.populateTree(item, val)
|
||||||
root.addChild(item)
|
root.addChild(item)
|
||||||
|
|
||||||
|
|
||||||
def currentFile(self):
|
def currentFile(self):
|
||||||
item = self.ui.exampleTree.currentItem()
|
item = self.ui.exampleTree.currentItem()
|
||||||
if hasattr(item, 'file'):
|
if hasattr(item, 'file'):
|
||||||
@ -160,19 +150,13 @@ class ExampleLoader(QtGui.QMainWindow):
|
|||||||
def loadFile(self, edited=False):
|
def loadFile(self, edited=False):
|
||||||
|
|
||||||
extra = []
|
extra = []
|
||||||
if self.ui.pyqtCheck.isChecked():
|
qtLib = str(self.ui.qtLibCombo.currentText())
|
||||||
extra.append('pyqt')
|
gfxSys = str(self.ui.graphicsSystemCombo.currentText())
|
||||||
elif self.ui.pysideCheck.isChecked():
|
|
||||||
extra.append('pyside')
|
|
||||||
|
|
||||||
if self.ui.forceGraphicsCheck.isChecked():
|
if qtLib != 'default':
|
||||||
extra.append(str(self.ui.forceGraphicsCombo.currentText()))
|
extra.append(qtLib.lower())
|
||||||
|
elif gfxSys != 'default':
|
||||||
|
extra.append(gfxSys)
|
||||||
#if sys.platform.startswith('win'):
|
|
||||||
#os.spawnl(os.P_NOWAIT, sys.executable, '"'+sys.executable+'"', '"' + fn + '"', *extra)
|
|
||||||
#else:
|
|
||||||
#os.spawnl(os.P_NOWAIT, sys.executable, sys.executable, fn, *extra)
|
|
||||||
|
|
||||||
if edited:
|
if edited:
|
||||||
path = os.path.abspath(os.path.dirname(__file__))
|
path = os.path.abspath(os.path.dirname(__file__))
|
||||||
@ -291,15 +275,19 @@ except:
|
|||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
if '--test' in sys.argv[1:]:
|
args = sys.argv[1:]
|
||||||
|
|
||||||
|
if '--test' in args:
|
||||||
# get rid of orphaned cache files first
|
# get rid of orphaned cache files first
|
||||||
pg.renamePyc(path)
|
pg.renamePyc(path)
|
||||||
|
|
||||||
files = buildFileList(examples)
|
files = buildFileList(examples)
|
||||||
if '--pyside' in sys.argv[1:]:
|
if '--pyside' in args:
|
||||||
lib = 'PySide'
|
lib = 'PySide'
|
||||||
elif '--pyqt' in sys.argv[1:]:
|
elif '--pyqt' in args or '--pyqt4' in args:
|
||||||
lib = 'PyQt4'
|
lib = 'PyQt4'
|
||||||
|
elif '--pyqt5' in args:
|
||||||
|
lib = 'PyQt5'
|
||||||
else:
|
else:
|
||||||
lib = ''
|
lib = ''
|
||||||
|
|
||||||
|
@ -6,28 +6,22 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>623</width>
|
<width>846</width>
|
||||||
<height>380</height>
|
<height>552</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Form</string>
|
<string>Form</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<layout class="QGridLayout" name="gridLayout_2">
|
||||||
<property name="margin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="spacing">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QSplitter" name="splitter">
|
<widget class="QSplitter" name="splitter">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="">
|
<widget class="QWidget" name="">
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
<item>
|
<item row="0" column="0" colspan="2">
|
||||||
<widget class="QTreeWidget" name="exampleTree">
|
<widget class="QTreeWidget" name="exampleTree">
|
||||||
<attribute name="headerVisible">
|
<attribute name="headerVisible">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
@ -39,35 +33,13 @@
|
|||||||
</column>
|
</column>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="2" column="1">
|
||||||
|
<widget class="QComboBox" name="graphicsSystemCombo">
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
|
||||||
<item>
|
|
||||||
<widget class="QCheckBox" name="pyqtCheck">
|
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Force PyQt</string>
|
<string>default</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<widget class="QCheckBox" name="pysideCheck">
|
|
||||||
<property name="text">
|
|
||||||
<string>Force PySide</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
|
||||||
<item>
|
|
||||||
<widget class="QCheckBox" name="forceGraphicsCheck">
|
|
||||||
<property name="text">
|
|
||||||
<string>Force Graphics System:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QComboBox" name="forceGraphicsCombo">
|
|
||||||
<item>
|
<item>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>native</string>
|
<string>native</string>
|
||||||
@ -85,9 +57,45 @@
|
|||||||
</item>
|
</item>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
<item row="1" column="1">
|
||||||
|
<widget class="QComboBox" name="qtLibCombo">
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>default</string>
|
||||||
|
</property>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>PyQt4</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>PySide</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>PyQt5</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
|
<widget class="QLabel" name="label_2">
|
||||||
|
<property name="text">
|
||||||
|
<string>Graphics System:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="text">
|
||||||
|
<string>Qt Library:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="1">
|
||||||
<widget class="QPushButton" name="loadBtn">
|
<widget class="QPushButton" name="loadBtn">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Run Example</string>
|
<string>Run Example</string>
|
||||||
@ -97,7 +105,7 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QWidget" name="">
|
<widget class="QWidget" name="">
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="loadedFileLabel">
|
<widget class="QLabel" name="loadedFileLabel">
|
||||||
<property name="font">
|
<property name="font">
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
# Form implementation generated from reading ui file './exampleLoaderTemplate.ui'
|
# Form implementation generated from reading ui file 'exampleLoaderTemplate.ui'
|
||||||
#
|
#
|
||||||
# Created: Mon Feb 25 09:02:09 2013
|
# Created: Sat Feb 28 10:30:29 2015
|
||||||
# by: PyQt4 UI code generator 4.9.3
|
# by: PyQt4 UI code generator 4.10.4
|
||||||
#
|
#
|
||||||
# WARNING! All changes made in this file will be lost!
|
# WARNING! All changes made in this file will be lost!
|
||||||
|
|
||||||
@ -12,58 +12,64 @@ from PyQt4 import QtCore, QtGui
|
|||||||
try:
|
try:
|
||||||
_fromUtf8 = QtCore.QString.fromUtf8
|
_fromUtf8 = QtCore.QString.fromUtf8
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
_fromUtf8 = lambda s: s
|
def _fromUtf8(s):
|
||||||
|
return s
|
||||||
|
|
||||||
|
try:
|
||||||
|
_encoding = QtGui.QApplication.UnicodeUTF8
|
||||||
|
def _translate(context, text, disambig):
|
||||||
|
return QtGui.QApplication.translate(context, text, disambig, _encoding)
|
||||||
|
except AttributeError:
|
||||||
|
def _translate(context, text, disambig):
|
||||||
|
return QtGui.QApplication.translate(context, text, disambig)
|
||||||
|
|
||||||
class Ui_Form(object):
|
class Ui_Form(object):
|
||||||
def setupUi(self, Form):
|
def setupUi(self, Form):
|
||||||
Form.setObjectName(_fromUtf8("Form"))
|
Form.setObjectName(_fromUtf8("Form"))
|
||||||
Form.resize(623, 380)
|
Form.resize(846, 552)
|
||||||
self.gridLayout = QtGui.QGridLayout(Form)
|
self.gridLayout_2 = QtGui.QGridLayout(Form)
|
||||||
self.gridLayout.setMargin(0)
|
self.gridLayout_2.setObjectName(_fromUtf8("gridLayout_2"))
|
||||||
self.gridLayout.setSpacing(0)
|
|
||||||
self.gridLayout.setObjectName(_fromUtf8("gridLayout"))
|
|
||||||
self.splitter = QtGui.QSplitter(Form)
|
self.splitter = QtGui.QSplitter(Form)
|
||||||
self.splitter.setOrientation(QtCore.Qt.Horizontal)
|
self.splitter.setOrientation(QtCore.Qt.Horizontal)
|
||||||
self.splitter.setObjectName(_fromUtf8("splitter"))
|
self.splitter.setObjectName(_fromUtf8("splitter"))
|
||||||
self.widget = QtGui.QWidget(self.splitter)
|
self.widget = QtGui.QWidget(self.splitter)
|
||||||
self.widget.setObjectName(_fromUtf8("widget"))
|
self.widget.setObjectName(_fromUtf8("widget"))
|
||||||
self.verticalLayout = QtGui.QVBoxLayout(self.widget)
|
self.gridLayout = QtGui.QGridLayout(self.widget)
|
||||||
self.verticalLayout.setMargin(0)
|
self.gridLayout.setMargin(0)
|
||||||
self.verticalLayout.setObjectName(_fromUtf8("verticalLayout"))
|
self.gridLayout.setObjectName(_fromUtf8("gridLayout"))
|
||||||
self.exampleTree = QtGui.QTreeWidget(self.widget)
|
self.exampleTree = QtGui.QTreeWidget(self.widget)
|
||||||
self.exampleTree.setObjectName(_fromUtf8("exampleTree"))
|
self.exampleTree.setObjectName(_fromUtf8("exampleTree"))
|
||||||
self.exampleTree.headerItem().setText(0, _fromUtf8("1"))
|
self.exampleTree.headerItem().setText(0, _fromUtf8("1"))
|
||||||
self.exampleTree.header().setVisible(False)
|
self.exampleTree.header().setVisible(False)
|
||||||
self.verticalLayout.addWidget(self.exampleTree)
|
self.gridLayout.addWidget(self.exampleTree, 0, 0, 1, 2)
|
||||||
self.horizontalLayout = QtGui.QHBoxLayout()
|
self.graphicsSystemCombo = QtGui.QComboBox(self.widget)
|
||||||
self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout"))
|
self.graphicsSystemCombo.setObjectName(_fromUtf8("graphicsSystemCombo"))
|
||||||
self.pyqtCheck = QtGui.QCheckBox(self.widget)
|
self.graphicsSystemCombo.addItem(_fromUtf8(""))
|
||||||
self.pyqtCheck.setObjectName(_fromUtf8("pyqtCheck"))
|
self.graphicsSystemCombo.addItem(_fromUtf8(""))
|
||||||
self.horizontalLayout.addWidget(self.pyqtCheck)
|
self.graphicsSystemCombo.addItem(_fromUtf8(""))
|
||||||
self.pysideCheck = QtGui.QCheckBox(self.widget)
|
self.graphicsSystemCombo.addItem(_fromUtf8(""))
|
||||||
self.pysideCheck.setObjectName(_fromUtf8("pysideCheck"))
|
self.gridLayout.addWidget(self.graphicsSystemCombo, 2, 1, 1, 1)
|
||||||
self.horizontalLayout.addWidget(self.pysideCheck)
|
self.qtLibCombo = QtGui.QComboBox(self.widget)
|
||||||
self.verticalLayout.addLayout(self.horizontalLayout)
|
self.qtLibCombo.setObjectName(_fromUtf8("qtLibCombo"))
|
||||||
self.horizontalLayout_2 = QtGui.QHBoxLayout()
|
self.qtLibCombo.addItem(_fromUtf8(""))
|
||||||
self.horizontalLayout_2.setObjectName(_fromUtf8("horizontalLayout_2"))
|
self.qtLibCombo.addItem(_fromUtf8(""))
|
||||||
self.forceGraphicsCheck = QtGui.QCheckBox(self.widget)
|
self.qtLibCombo.addItem(_fromUtf8(""))
|
||||||
self.forceGraphicsCheck.setObjectName(_fromUtf8("forceGraphicsCheck"))
|
self.qtLibCombo.addItem(_fromUtf8(""))
|
||||||
self.horizontalLayout_2.addWidget(self.forceGraphicsCheck)
|
self.gridLayout.addWidget(self.qtLibCombo, 1, 1, 1, 1)
|
||||||
self.forceGraphicsCombo = QtGui.QComboBox(self.widget)
|
self.label_2 = QtGui.QLabel(self.widget)
|
||||||
self.forceGraphicsCombo.setObjectName(_fromUtf8("forceGraphicsCombo"))
|
self.label_2.setObjectName(_fromUtf8("label_2"))
|
||||||
self.forceGraphicsCombo.addItem(_fromUtf8(""))
|
self.gridLayout.addWidget(self.label_2, 2, 0, 1, 1)
|
||||||
self.forceGraphicsCombo.addItem(_fromUtf8(""))
|
self.label = QtGui.QLabel(self.widget)
|
||||||
self.forceGraphicsCombo.addItem(_fromUtf8(""))
|
self.label.setObjectName(_fromUtf8("label"))
|
||||||
self.horizontalLayout_2.addWidget(self.forceGraphicsCombo)
|
self.gridLayout.addWidget(self.label, 1, 0, 1, 1)
|
||||||
self.verticalLayout.addLayout(self.horizontalLayout_2)
|
|
||||||
self.loadBtn = QtGui.QPushButton(self.widget)
|
self.loadBtn = QtGui.QPushButton(self.widget)
|
||||||
self.loadBtn.setObjectName(_fromUtf8("loadBtn"))
|
self.loadBtn.setObjectName(_fromUtf8("loadBtn"))
|
||||||
self.verticalLayout.addWidget(self.loadBtn)
|
self.gridLayout.addWidget(self.loadBtn, 3, 1, 1, 1)
|
||||||
self.widget1 = QtGui.QWidget(self.splitter)
|
self.widget1 = QtGui.QWidget(self.splitter)
|
||||||
self.widget1.setObjectName(_fromUtf8("widget1"))
|
self.widget1.setObjectName(_fromUtf8("widget1"))
|
||||||
self.verticalLayout_2 = QtGui.QVBoxLayout(self.widget1)
|
self.verticalLayout = QtGui.QVBoxLayout(self.widget1)
|
||||||
self.verticalLayout_2.setMargin(0)
|
self.verticalLayout.setMargin(0)
|
||||||
self.verticalLayout_2.setObjectName(_fromUtf8("verticalLayout_2"))
|
self.verticalLayout.setObjectName(_fromUtf8("verticalLayout"))
|
||||||
self.loadedFileLabel = QtGui.QLabel(self.widget1)
|
self.loadedFileLabel = QtGui.QLabel(self.widget1)
|
||||||
font = QtGui.QFont()
|
font = QtGui.QFont()
|
||||||
font.setBold(True)
|
font.setBold(True)
|
||||||
@ -72,25 +78,29 @@ class Ui_Form(object):
|
|||||||
self.loadedFileLabel.setText(_fromUtf8(""))
|
self.loadedFileLabel.setText(_fromUtf8(""))
|
||||||
self.loadedFileLabel.setAlignment(QtCore.Qt.AlignCenter)
|
self.loadedFileLabel.setAlignment(QtCore.Qt.AlignCenter)
|
||||||
self.loadedFileLabel.setObjectName(_fromUtf8("loadedFileLabel"))
|
self.loadedFileLabel.setObjectName(_fromUtf8("loadedFileLabel"))
|
||||||
self.verticalLayout_2.addWidget(self.loadedFileLabel)
|
self.verticalLayout.addWidget(self.loadedFileLabel)
|
||||||
self.codeView = QtGui.QPlainTextEdit(self.widget1)
|
self.codeView = QtGui.QPlainTextEdit(self.widget1)
|
||||||
font = QtGui.QFont()
|
font = QtGui.QFont()
|
||||||
font.setFamily(_fromUtf8("FreeMono"))
|
font.setFamily(_fromUtf8("FreeMono"))
|
||||||
self.codeView.setFont(font)
|
self.codeView.setFont(font)
|
||||||
self.codeView.setObjectName(_fromUtf8("codeView"))
|
self.codeView.setObjectName(_fromUtf8("codeView"))
|
||||||
self.verticalLayout_2.addWidget(self.codeView)
|
self.verticalLayout.addWidget(self.codeView)
|
||||||
self.gridLayout.addWidget(self.splitter, 0, 0, 1, 1)
|
self.gridLayout_2.addWidget(self.splitter, 0, 0, 1, 1)
|
||||||
|
|
||||||
self.retranslateUi(Form)
|
self.retranslateUi(Form)
|
||||||
QtCore.QMetaObject.connectSlotsByName(Form)
|
QtCore.QMetaObject.connectSlotsByName(Form)
|
||||||
|
|
||||||
def retranslateUi(self, Form):
|
def retranslateUi(self, Form):
|
||||||
Form.setWindowTitle(QtGui.QApplication.translate("Form", "Form", None, QtGui.QApplication.UnicodeUTF8))
|
Form.setWindowTitle(_translate("Form", "Form", None))
|
||||||
self.pyqtCheck.setText(QtGui.QApplication.translate("Form", "Force PyQt", None, QtGui.QApplication.UnicodeUTF8))
|
self.graphicsSystemCombo.setItemText(0, _translate("Form", "default", None))
|
||||||
self.pysideCheck.setText(QtGui.QApplication.translate("Form", "Force PySide", None, QtGui.QApplication.UnicodeUTF8))
|
self.graphicsSystemCombo.setItemText(1, _translate("Form", "native", None))
|
||||||
self.forceGraphicsCheck.setText(QtGui.QApplication.translate("Form", "Force Graphics System:", None, QtGui.QApplication.UnicodeUTF8))
|
self.graphicsSystemCombo.setItemText(2, _translate("Form", "raster", None))
|
||||||
self.forceGraphicsCombo.setItemText(0, QtGui.QApplication.translate("Form", "native", None, QtGui.QApplication.UnicodeUTF8))
|
self.graphicsSystemCombo.setItemText(3, _translate("Form", "opengl", None))
|
||||||
self.forceGraphicsCombo.setItemText(1, QtGui.QApplication.translate("Form", "raster", None, QtGui.QApplication.UnicodeUTF8))
|
self.qtLibCombo.setItemText(0, _translate("Form", "default", None))
|
||||||
self.forceGraphicsCombo.setItemText(2, QtGui.QApplication.translate("Form", "opengl", None, QtGui.QApplication.UnicodeUTF8))
|
self.qtLibCombo.setItemText(1, _translate("Form", "PyQt4", None))
|
||||||
self.loadBtn.setText(QtGui.QApplication.translate("Form", "Run Example", None, QtGui.QApplication.UnicodeUTF8))
|
self.qtLibCombo.setItemText(2, _translate("Form", "PySide", None))
|
||||||
|
self.qtLibCombo.setItemText(3, _translate("Form", "PyQt5", None))
|
||||||
|
self.label_2.setText(_translate("Form", "Graphics System:", None))
|
||||||
|
self.label.setText(_translate("Form", "Qt Library:", None))
|
||||||
|
self.loadBtn.setText(_translate("Form", "Run Example", None))
|
||||||
|
|
||||||
|
93
examples/exampleLoaderTemplate_pyqt5.py
Normal file
93
examples/exampleLoaderTemplate_pyqt5.py
Normal file
@ -0,0 +1,93 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Form implementation generated from reading ui file 'exampleLoaderTemplate.ui'
|
||||||
|
#
|
||||||
|
# Created: Sat Feb 28 10:28:50 2015
|
||||||
|
# by: PyQt5 UI code generator 5.2.1
|
||||||
|
#
|
||||||
|
# WARNING! All changes made in this file will be lost!
|
||||||
|
|
||||||
|
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||||
|
|
||||||
|
class Ui_Form(object):
|
||||||
|
def setupUi(self, Form):
|
||||||
|
Form.setObjectName("Form")
|
||||||
|
Form.resize(846, 552)
|
||||||
|
self.gridLayout_2 = QtWidgets.QGridLayout(Form)
|
||||||
|
self.gridLayout_2.setObjectName("gridLayout_2")
|
||||||
|
self.splitter = QtWidgets.QSplitter(Form)
|
||||||
|
self.splitter.setOrientation(QtCore.Qt.Horizontal)
|
||||||
|
self.splitter.setObjectName("splitter")
|
||||||
|
self.widget = QtWidgets.QWidget(self.splitter)
|
||||||
|
self.widget.setObjectName("widget")
|
||||||
|
self.gridLayout = QtWidgets.QGridLayout(self.widget)
|
||||||
|
self.gridLayout.setContentsMargins(0, 0, 0, 0)
|
||||||
|
self.gridLayout.setObjectName("gridLayout")
|
||||||
|
self.exampleTree = QtWidgets.QTreeWidget(self.widget)
|
||||||
|
self.exampleTree.setObjectName("exampleTree")
|
||||||
|
self.exampleTree.headerItem().setText(0, "1")
|
||||||
|
self.exampleTree.header().setVisible(False)
|
||||||
|
self.gridLayout.addWidget(self.exampleTree, 0, 0, 1, 2)
|
||||||
|
self.graphicsSystemCombo = QtWidgets.QComboBox(self.widget)
|
||||||
|
self.graphicsSystemCombo.setObjectName("graphicsSystemCombo")
|
||||||
|
self.graphicsSystemCombo.addItem("")
|
||||||
|
self.graphicsSystemCombo.addItem("")
|
||||||
|
self.graphicsSystemCombo.addItem("")
|
||||||
|
self.graphicsSystemCombo.addItem("")
|
||||||
|
self.gridLayout.addWidget(self.graphicsSystemCombo, 2, 1, 1, 1)
|
||||||
|
self.qtLibCombo = QtWidgets.QComboBox(self.widget)
|
||||||
|
self.qtLibCombo.setObjectName("qtLibCombo")
|
||||||
|
self.qtLibCombo.addItem("")
|
||||||
|
self.qtLibCombo.addItem("")
|
||||||
|
self.qtLibCombo.addItem("")
|
||||||
|
self.qtLibCombo.addItem("")
|
||||||
|
self.gridLayout.addWidget(self.qtLibCombo, 1, 1, 1, 1)
|
||||||
|
self.label_2 = QtWidgets.QLabel(self.widget)
|
||||||
|
self.label_2.setObjectName("label_2")
|
||||||
|
self.gridLayout.addWidget(self.label_2, 2, 0, 1, 1)
|
||||||
|
self.label = QtWidgets.QLabel(self.widget)
|
||||||
|
self.label.setObjectName("label")
|
||||||
|
self.gridLayout.addWidget(self.label, 1, 0, 1, 1)
|
||||||
|
self.loadBtn = QtWidgets.QPushButton(self.widget)
|
||||||
|
self.loadBtn.setObjectName("loadBtn")
|
||||||
|
self.gridLayout.addWidget(self.loadBtn, 3, 1, 1, 1)
|
||||||
|
self.widget1 = QtWidgets.QWidget(self.splitter)
|
||||||
|
self.widget1.setObjectName("widget1")
|
||||||
|
self.verticalLayout = QtWidgets.QVBoxLayout(self.widget1)
|
||||||
|
self.verticalLayout.setContentsMargins(0, 0, 0, 0)
|
||||||
|
self.verticalLayout.setObjectName("verticalLayout")
|
||||||
|
self.loadedFileLabel = QtWidgets.QLabel(self.widget1)
|
||||||
|
font = QtGui.QFont()
|
||||||
|
font.setBold(True)
|
||||||
|
font.setWeight(75)
|
||||||
|
self.loadedFileLabel.setFont(font)
|
||||||
|
self.loadedFileLabel.setText("")
|
||||||
|
self.loadedFileLabel.setAlignment(QtCore.Qt.AlignCenter)
|
||||||
|
self.loadedFileLabel.setObjectName("loadedFileLabel")
|
||||||
|
self.verticalLayout.addWidget(self.loadedFileLabel)
|
||||||
|
self.codeView = QtWidgets.QPlainTextEdit(self.widget1)
|
||||||
|
font = QtGui.QFont()
|
||||||
|
font.setFamily("FreeMono")
|
||||||
|
self.codeView.setFont(font)
|
||||||
|
self.codeView.setObjectName("codeView")
|
||||||
|
self.verticalLayout.addWidget(self.codeView)
|
||||||
|
self.gridLayout_2.addWidget(self.splitter, 0, 0, 1, 1)
|
||||||
|
|
||||||
|
self.retranslateUi(Form)
|
||||||
|
QtCore.QMetaObject.connectSlotsByName(Form)
|
||||||
|
|
||||||
|
def retranslateUi(self, Form):
|
||||||
|
_translate = QtCore.QCoreApplication.translate
|
||||||
|
Form.setWindowTitle(_translate("Form", "Form"))
|
||||||
|
self.graphicsSystemCombo.setItemText(0, _translate("Form", "default"))
|
||||||
|
self.graphicsSystemCombo.setItemText(1, _translate("Form", "native"))
|
||||||
|
self.graphicsSystemCombo.setItemText(2, _translate("Form", "raster"))
|
||||||
|
self.graphicsSystemCombo.setItemText(3, _translate("Form", "opengl"))
|
||||||
|
self.qtLibCombo.setItemText(0, _translate("Form", "default"))
|
||||||
|
self.qtLibCombo.setItemText(1, _translate("Form", "PyQt4"))
|
||||||
|
self.qtLibCombo.setItemText(2, _translate("Form", "PySide"))
|
||||||
|
self.qtLibCombo.setItemText(3, _translate("Form", "PyQt5"))
|
||||||
|
self.label_2.setText(_translate("Form", "Graphics System:"))
|
||||||
|
self.label.setText(_translate("Form", "Qt Library:"))
|
||||||
|
self.loadBtn.setText(_translate("Form", "Run Example"))
|
||||||
|
|
@ -1,9 +1,9 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
# Form implementation generated from reading ui file './exampleLoaderTemplate.ui'
|
# Form implementation generated from reading ui file 'exampleLoaderTemplate.ui'
|
||||||
#
|
#
|
||||||
# Created: Mon Feb 25 09:02:09 2013
|
# Created: Sat Feb 28 10:31:57 2015
|
||||||
# by: pyside-uic 0.2.13 running on PySide 1.1.1
|
# by: pyside-uic 0.2.15 running on PySide 1.2.1
|
||||||
#
|
#
|
||||||
# WARNING! All changes made in this file will be lost!
|
# WARNING! All changes made in this file will be lost!
|
||||||
|
|
||||||
@ -12,53 +12,50 @@ from PySide import QtCore, QtGui
|
|||||||
class Ui_Form(object):
|
class Ui_Form(object):
|
||||||
def setupUi(self, Form):
|
def setupUi(self, Form):
|
||||||
Form.setObjectName("Form")
|
Form.setObjectName("Form")
|
||||||
Form.resize(623, 380)
|
Form.resize(846, 552)
|
||||||
self.gridLayout = QtGui.QGridLayout(Form)
|
self.gridLayout_2 = QtGui.QGridLayout(Form)
|
||||||
self.gridLayout.setContentsMargins(0, 0, 0, 0)
|
self.gridLayout_2.setObjectName("gridLayout_2")
|
||||||
self.gridLayout.setSpacing(0)
|
|
||||||
self.gridLayout.setObjectName("gridLayout")
|
|
||||||
self.splitter = QtGui.QSplitter(Form)
|
self.splitter = QtGui.QSplitter(Form)
|
||||||
self.splitter.setOrientation(QtCore.Qt.Horizontal)
|
self.splitter.setOrientation(QtCore.Qt.Horizontal)
|
||||||
self.splitter.setObjectName("splitter")
|
self.splitter.setObjectName("splitter")
|
||||||
self.widget = QtGui.QWidget(self.splitter)
|
self.widget = QtGui.QWidget(self.splitter)
|
||||||
self.widget.setObjectName("widget")
|
self.widget.setObjectName("widget")
|
||||||
self.verticalLayout = QtGui.QVBoxLayout(self.widget)
|
self.gridLayout = QtGui.QGridLayout(self.widget)
|
||||||
self.verticalLayout.setContentsMargins(0, 0, 0, 0)
|
self.gridLayout.setContentsMargins(0, 0, 0, 0)
|
||||||
self.verticalLayout.setObjectName("verticalLayout")
|
self.gridLayout.setObjectName("gridLayout")
|
||||||
self.exampleTree = QtGui.QTreeWidget(self.widget)
|
self.exampleTree = QtGui.QTreeWidget(self.widget)
|
||||||
self.exampleTree.setObjectName("exampleTree")
|
self.exampleTree.setObjectName("exampleTree")
|
||||||
self.exampleTree.headerItem().setText(0, "1")
|
self.exampleTree.headerItem().setText(0, "1")
|
||||||
self.exampleTree.header().setVisible(False)
|
self.exampleTree.header().setVisible(False)
|
||||||
self.verticalLayout.addWidget(self.exampleTree)
|
self.gridLayout.addWidget(self.exampleTree, 0, 0, 1, 2)
|
||||||
self.horizontalLayout = QtGui.QHBoxLayout()
|
self.graphicsSystemCombo = QtGui.QComboBox(self.widget)
|
||||||
self.horizontalLayout.setObjectName("horizontalLayout")
|
self.graphicsSystemCombo.setObjectName("graphicsSystemCombo")
|
||||||
self.pyqtCheck = QtGui.QCheckBox(self.widget)
|
self.graphicsSystemCombo.addItem("")
|
||||||
self.pyqtCheck.setObjectName("pyqtCheck")
|
self.graphicsSystemCombo.addItem("")
|
||||||
self.horizontalLayout.addWidget(self.pyqtCheck)
|
self.graphicsSystemCombo.addItem("")
|
||||||
self.pysideCheck = QtGui.QCheckBox(self.widget)
|
self.graphicsSystemCombo.addItem("")
|
||||||
self.pysideCheck.setObjectName("pysideCheck")
|
self.gridLayout.addWidget(self.graphicsSystemCombo, 2, 1, 1, 1)
|
||||||
self.horizontalLayout.addWidget(self.pysideCheck)
|
self.qtLibCombo = QtGui.QComboBox(self.widget)
|
||||||
self.verticalLayout.addLayout(self.horizontalLayout)
|
self.qtLibCombo.setObjectName("qtLibCombo")
|
||||||
self.horizontalLayout_2 = QtGui.QHBoxLayout()
|
self.qtLibCombo.addItem("")
|
||||||
self.horizontalLayout_2.setObjectName("horizontalLayout_2")
|
self.qtLibCombo.addItem("")
|
||||||
self.forceGraphicsCheck = QtGui.QCheckBox(self.widget)
|
self.qtLibCombo.addItem("")
|
||||||
self.forceGraphicsCheck.setObjectName("forceGraphicsCheck")
|
self.qtLibCombo.addItem("")
|
||||||
self.horizontalLayout_2.addWidget(self.forceGraphicsCheck)
|
self.gridLayout.addWidget(self.qtLibCombo, 1, 1, 1, 1)
|
||||||
self.forceGraphicsCombo = QtGui.QComboBox(self.widget)
|
self.label_2 = QtGui.QLabel(self.widget)
|
||||||
self.forceGraphicsCombo.setObjectName("forceGraphicsCombo")
|
self.label_2.setObjectName("label_2")
|
||||||
self.forceGraphicsCombo.addItem("")
|
self.gridLayout.addWidget(self.label_2, 2, 0, 1, 1)
|
||||||
self.forceGraphicsCombo.addItem("")
|
self.label = QtGui.QLabel(self.widget)
|
||||||
self.forceGraphicsCombo.addItem("")
|
self.label.setObjectName("label")
|
||||||
self.horizontalLayout_2.addWidget(self.forceGraphicsCombo)
|
self.gridLayout.addWidget(self.label, 1, 0, 1, 1)
|
||||||
self.verticalLayout.addLayout(self.horizontalLayout_2)
|
|
||||||
self.loadBtn = QtGui.QPushButton(self.widget)
|
self.loadBtn = QtGui.QPushButton(self.widget)
|
||||||
self.loadBtn.setObjectName("loadBtn")
|
self.loadBtn.setObjectName("loadBtn")
|
||||||
self.verticalLayout.addWidget(self.loadBtn)
|
self.gridLayout.addWidget(self.loadBtn, 3, 1, 1, 1)
|
||||||
self.widget1 = QtGui.QWidget(self.splitter)
|
self.widget1 = QtGui.QWidget(self.splitter)
|
||||||
self.widget1.setObjectName("widget1")
|
self.widget1.setObjectName("widget1")
|
||||||
self.verticalLayout_2 = QtGui.QVBoxLayout(self.widget1)
|
self.verticalLayout = QtGui.QVBoxLayout(self.widget1)
|
||||||
self.verticalLayout_2.setContentsMargins(0, 0, 0, 0)
|
self.verticalLayout.setContentsMargins(0, 0, 0, 0)
|
||||||
self.verticalLayout_2.setObjectName("verticalLayout_2")
|
self.verticalLayout.setObjectName("verticalLayout")
|
||||||
self.loadedFileLabel = QtGui.QLabel(self.widget1)
|
self.loadedFileLabel = QtGui.QLabel(self.widget1)
|
||||||
font = QtGui.QFont()
|
font = QtGui.QFont()
|
||||||
font.setWeight(75)
|
font.setWeight(75)
|
||||||
@ -67,25 +64,29 @@ class Ui_Form(object):
|
|||||||
self.loadedFileLabel.setText("")
|
self.loadedFileLabel.setText("")
|
||||||
self.loadedFileLabel.setAlignment(QtCore.Qt.AlignCenter)
|
self.loadedFileLabel.setAlignment(QtCore.Qt.AlignCenter)
|
||||||
self.loadedFileLabel.setObjectName("loadedFileLabel")
|
self.loadedFileLabel.setObjectName("loadedFileLabel")
|
||||||
self.verticalLayout_2.addWidget(self.loadedFileLabel)
|
self.verticalLayout.addWidget(self.loadedFileLabel)
|
||||||
self.codeView = QtGui.QPlainTextEdit(self.widget1)
|
self.codeView = QtGui.QPlainTextEdit(self.widget1)
|
||||||
font = QtGui.QFont()
|
font = QtGui.QFont()
|
||||||
font.setFamily("FreeMono")
|
font.setFamily("FreeMono")
|
||||||
self.codeView.setFont(font)
|
self.codeView.setFont(font)
|
||||||
self.codeView.setObjectName("codeView")
|
self.codeView.setObjectName("codeView")
|
||||||
self.verticalLayout_2.addWidget(self.codeView)
|
self.verticalLayout.addWidget(self.codeView)
|
||||||
self.gridLayout.addWidget(self.splitter, 0, 0, 1, 1)
|
self.gridLayout_2.addWidget(self.splitter, 0, 0, 1, 1)
|
||||||
|
|
||||||
self.retranslateUi(Form)
|
self.retranslateUi(Form)
|
||||||
QtCore.QMetaObject.connectSlotsByName(Form)
|
QtCore.QMetaObject.connectSlotsByName(Form)
|
||||||
|
|
||||||
def retranslateUi(self, Form):
|
def retranslateUi(self, Form):
|
||||||
Form.setWindowTitle(QtGui.QApplication.translate("Form", "Form", None, QtGui.QApplication.UnicodeUTF8))
|
Form.setWindowTitle(QtGui.QApplication.translate("Form", "Form", None, QtGui.QApplication.UnicodeUTF8))
|
||||||
self.pyqtCheck.setText(QtGui.QApplication.translate("Form", "Force PyQt", None, QtGui.QApplication.UnicodeUTF8))
|
self.graphicsSystemCombo.setItemText(0, QtGui.QApplication.translate("Form", "default", None, QtGui.QApplication.UnicodeUTF8))
|
||||||
self.pysideCheck.setText(QtGui.QApplication.translate("Form", "Force PySide", None, QtGui.QApplication.UnicodeUTF8))
|
self.graphicsSystemCombo.setItemText(1, QtGui.QApplication.translate("Form", "native", None, QtGui.QApplication.UnicodeUTF8))
|
||||||
self.forceGraphicsCheck.setText(QtGui.QApplication.translate("Form", "Force Graphics System:", None, QtGui.QApplication.UnicodeUTF8))
|
self.graphicsSystemCombo.setItemText(2, QtGui.QApplication.translate("Form", "raster", None, QtGui.QApplication.UnicodeUTF8))
|
||||||
self.forceGraphicsCombo.setItemText(0, QtGui.QApplication.translate("Form", "native", None, QtGui.QApplication.UnicodeUTF8))
|
self.graphicsSystemCombo.setItemText(3, QtGui.QApplication.translate("Form", "opengl", None, QtGui.QApplication.UnicodeUTF8))
|
||||||
self.forceGraphicsCombo.setItemText(1, QtGui.QApplication.translate("Form", "raster", None, QtGui.QApplication.UnicodeUTF8))
|
self.qtLibCombo.setItemText(0, QtGui.QApplication.translate("Form", "default", None, QtGui.QApplication.UnicodeUTF8))
|
||||||
self.forceGraphicsCombo.setItemText(2, QtGui.QApplication.translate("Form", "opengl", None, QtGui.QApplication.UnicodeUTF8))
|
self.qtLibCombo.setItemText(1, QtGui.QApplication.translate("Form", "PyQt4", None, QtGui.QApplication.UnicodeUTF8))
|
||||||
|
self.qtLibCombo.setItemText(2, QtGui.QApplication.translate("Form", "PySide", None, QtGui.QApplication.UnicodeUTF8))
|
||||||
|
self.qtLibCombo.setItemText(3, QtGui.QApplication.translate("Form", "PyQt5", None, QtGui.QApplication.UnicodeUTF8))
|
||||||
|
self.label_2.setText(QtGui.QApplication.translate("Form", "Graphics System:", None, QtGui.QApplication.UnicodeUTF8))
|
||||||
|
self.label.setText(QtGui.QApplication.translate("Form", "Qt Library:", None, QtGui.QApplication.UnicodeUTF8))
|
||||||
self.loadBtn.setText(QtGui.QApplication.translate("Form", "Run Example", None, QtGui.QApplication.UnicodeUTF8))
|
self.loadBtn.setText(QtGui.QApplication.translate("Form", "Run Example", None, QtGui.QApplication.UnicodeUTF8))
|
||||||
|
|
||||||
|
@ -24,15 +24,23 @@ if 'pyside' in sys.argv:
|
|||||||
from PySide import QtGui
|
from PySide import QtGui
|
||||||
elif 'pyqt' in sys.argv:
|
elif 'pyqt' in sys.argv:
|
||||||
from PyQt4 import QtGui
|
from PyQt4 import QtGui
|
||||||
|
elif 'pyqt5' in sys.argv:
|
||||||
|
from PyQt5 import QtGui
|
||||||
else:
|
else:
|
||||||
from pyqtgraph.Qt import QtGui
|
from pyqtgraph.Qt import QtGui
|
||||||
|
|
||||||
|
import pyqtgraph as pg
|
||||||
|
|
||||||
## Force use of a specific graphics system
|
## Force use of a specific graphics system
|
||||||
|
use_gs = 'default'
|
||||||
for gs in ['raster', 'native', 'opengl']:
|
for gs in ['raster', 'native', 'opengl']:
|
||||||
if gs in sys.argv:
|
if gs in sys.argv:
|
||||||
|
use_gs = gs
|
||||||
QtGui.QApplication.setGraphicsSystem(gs)
|
QtGui.QApplication.setGraphicsSystem(gs)
|
||||||
break
|
break
|
||||||
|
|
||||||
|
print("Using %s (%s graphics system)" % (pg.Qt.QT_LIB, use_gs))
|
||||||
|
|
||||||
## Enable fault handling to give more helpful error messages on crash.
|
## Enable fault handling to give more helpful error messages on crash.
|
||||||
## Only available in python 3.3+
|
## Only available in python 3.3+
|
||||||
try:
|
try:
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from PyQt4 import QtGui, QtCore
|
|
||||||
import pyqtgraph as pg
|
import pyqtgraph as pg
|
||||||
#from pyqtgraph.canvas import Canvas, CanvasItem
|
from pyqtgraph.Qt import QtGui, QtCore
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import csv, gzip, os
|
import csv, gzip, os
|
||||||
from pyqtgraph import Point
|
from pyqtgraph import Point
|
||||||
|
@ -124,7 +124,7 @@ p.sigTreeStateChanged.connect(change)
|
|||||||
|
|
||||||
|
|
||||||
def valueChanging(param, value):
|
def valueChanging(param, value):
|
||||||
print("Value changing (not finalized):", param, value)
|
print("Value changing (not finalized): %s %s" % (param, value))
|
||||||
|
|
||||||
# Too lazy for recursion:
|
# Too lazy for recursion:
|
||||||
for child in p.children():
|
for child in p.children():
|
||||||
|
@ -1 +1 @@
|
|||||||
from relativity import *
|
from .relativity import *
|
||||||
|
@ -4,7 +4,6 @@ from pyqtgraph.parametertree import Parameter, ParameterTree
|
|||||||
from pyqtgraph.parametertree import types as pTypes
|
from pyqtgraph.parametertree import types as pTypes
|
||||||
import pyqtgraph.configfile
|
import pyqtgraph.configfile
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import user
|
|
||||||
import collections
|
import collections
|
||||||
import sys, os
|
import sys, os
|
||||||
|
|
||||||
@ -247,7 +246,7 @@ class GridParam(pTypes.GroupParameter):
|
|||||||
template = self.param('ClockTemplate')
|
template = self.param('ClockTemplate')
|
||||||
spacing = self['Spacing']
|
spacing = self['Spacing']
|
||||||
for i in range(self['Number of Clocks']):
|
for i in range(self['Number of Clocks']):
|
||||||
c = template.buildClocks().values()[0]
|
c = list(template.buildClocks().values())[0]
|
||||||
c.x0 += i * spacing
|
c.x0 += i * spacing
|
||||||
clocks[self.name() + '%02d' % i] = c
|
clocks[self.name() + '%02d' % i] = c
|
||||||
return clocks
|
return clocks
|
||||||
@ -502,7 +501,7 @@ class Simulation:
|
|||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
nPts = int(self.duration/self.dt)+1
|
nPts = int(self.duration/self.dt)+1
|
||||||
for cl in self.clocks.itervalues():
|
for cl in self.clocks.values():
|
||||||
cl.init(nPts)
|
cl.init(nPts)
|
||||||
|
|
||||||
if self.ref is None:
|
if self.ref is None:
|
||||||
@ -514,7 +513,7 @@ class Simulation:
|
|||||||
clocks = self.clocks
|
clocks = self.clocks
|
||||||
dt = self.dt
|
dt = self.dt
|
||||||
tVals = np.linspace(0, dt*(nPts-1), nPts)
|
tVals = np.linspace(0, dt*(nPts-1), nPts)
|
||||||
for cl in self.clocks.itervalues():
|
for cl in self.clocks.values():
|
||||||
for i in xrange(1,nPts):
|
for i in xrange(1,nPts):
|
||||||
nextT = tVals[i]
|
nextT = tVals[i]
|
||||||
while True:
|
while True:
|
||||||
@ -549,7 +548,7 @@ class Simulation:
|
|||||||
|
|
||||||
## make sure reference clock is not present in the list of clocks--this will be handled separately.
|
## make sure reference clock is not present in the list of clocks--this will be handled separately.
|
||||||
clocks = clocks.copy()
|
clocks = clocks.copy()
|
||||||
for k,v in clocks.iteritems():
|
for k,v in clocks.items():
|
||||||
if v is ref:
|
if v is ref:
|
||||||
del clocks[k]
|
del clocks[k]
|
||||||
break
|
break
|
||||||
@ -586,7 +585,7 @@ class Simulation:
|
|||||||
|
|
||||||
|
|
||||||
## update all other clocks
|
## update all other clocks
|
||||||
for cl in clocks.itervalues():
|
for cl in clocks.values():
|
||||||
while True:
|
while True:
|
||||||
g = cl.acceleration()
|
g = cl.acceleration()
|
||||||
tau1, tau2 = cl.accelLimits()
|
tau1, tau2 = cl.accelLimits()
|
||||||
@ -635,7 +634,7 @@ class Simulation:
|
|||||||
|
|
||||||
def plot(self, plot):
|
def plot(self, plot):
|
||||||
plot.clear()
|
plot.clear()
|
||||||
for cl in self.clocks.itervalues():
|
for cl in self.clocks.values():
|
||||||
c, p = cl.getCurve()
|
c, p = cl.getCurve()
|
||||||
plot.addItem(c)
|
plot.addItem(c)
|
||||||
plot.addItem(p)
|
plot.addItem(p)
|
||||||
|
@ -11,6 +11,8 @@ import pyqtgraph as pg
|
|||||||
from pyqtgraph.Qt import QtCore, QtGui
|
from pyqtgraph.Qt import QtCore, QtGui
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
|
app = QtGui.QApplication([])
|
||||||
|
|
||||||
# win.setWindowTitle('pyqtgraph example: ____')
|
# win.setWindowTitle('pyqtgraph example: ____')
|
||||||
|
|
||||||
## Start Qt event loop unless running in interactive mode or using pyside.
|
## Start Qt event loop unless running in interactive mode or using pyside.
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
from ..Qt import QtCore, QtGui, USE_PYSIDE
|
from ..Qt import QtCore, QtGui, USE_PYSIDE, USE_PYQT5
|
||||||
from .. import exporters as exporters
|
from .. import exporters as exporters
|
||||||
from .. import functions as fn
|
from .. import functions as fn
|
||||||
from ..graphicsItems.ViewBox import ViewBox
|
from ..graphicsItems.ViewBox import ViewBox
|
||||||
@ -6,6 +6,8 @@ from ..graphicsItems.PlotItem import PlotItem
|
|||||||
|
|
||||||
if USE_PYSIDE:
|
if USE_PYSIDE:
|
||||||
from . import exportDialogTemplate_pyside as exportDialogTemplate
|
from . import exportDialogTemplate_pyside as exportDialogTemplate
|
||||||
|
elif USE_PYQT5:
|
||||||
|
from . import exportDialogTemplate_pyqt5 as exportDialogTemplate
|
||||||
else:
|
else:
|
||||||
from . import exportDialogTemplate_pyqt as exportDialogTemplate
|
from . import exportDialogTemplate_pyqt as exportDialogTemplate
|
||||||
|
|
||||||
|
64
pyqtgraph/GraphicsScene/exportDialogTemplate_pyqt5.py
Normal file
64
pyqtgraph/GraphicsScene/exportDialogTemplate_pyqt5.py
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Form implementation generated from reading ui file './pyqtgraph/GraphicsScene/exportDialogTemplate.ui'
|
||||||
|
#
|
||||||
|
# Created: Wed Mar 26 15:09:29 2014
|
||||||
|
# by: PyQt5 UI code generator 5.0.1
|
||||||
|
#
|
||||||
|
# WARNING! All changes made in this file will be lost!
|
||||||
|
|
||||||
|
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||||
|
|
||||||
|
class Ui_Form(object):
|
||||||
|
def setupUi(self, Form):
|
||||||
|
Form.setObjectName("Form")
|
||||||
|
Form.resize(241, 367)
|
||||||
|
self.gridLayout = QtWidgets.QGridLayout(Form)
|
||||||
|
self.gridLayout.setSpacing(0)
|
||||||
|
self.gridLayout.setObjectName("gridLayout")
|
||||||
|
self.label = QtWidgets.QLabel(Form)
|
||||||
|
self.label.setObjectName("label")
|
||||||
|
self.gridLayout.addWidget(self.label, 0, 0, 1, 3)
|
||||||
|
self.itemTree = QtWidgets.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 = QtWidgets.QLabel(Form)
|
||||||
|
self.label_2.setObjectName("label_2")
|
||||||
|
self.gridLayout.addWidget(self.label_2, 2, 0, 1, 3)
|
||||||
|
self.formatList = QtWidgets.QListWidget(Form)
|
||||||
|
self.formatList.setObjectName("formatList")
|
||||||
|
self.gridLayout.addWidget(self.formatList, 3, 0, 1, 3)
|
||||||
|
self.exportBtn = QtWidgets.QPushButton(Form)
|
||||||
|
self.exportBtn.setObjectName("exportBtn")
|
||||||
|
self.gridLayout.addWidget(self.exportBtn, 6, 1, 1, 1)
|
||||||
|
self.closeBtn = QtWidgets.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 = QtWidgets.QLabel(Form)
|
||||||
|
self.label_3.setObjectName("label_3")
|
||||||
|
self.gridLayout.addWidget(self.label_3, 4, 0, 1, 3)
|
||||||
|
self.copyBtn = QtWidgets.QPushButton(Form)
|
||||||
|
self.copyBtn.setObjectName("copyBtn")
|
||||||
|
self.gridLayout.addWidget(self.copyBtn, 6, 0, 1, 1)
|
||||||
|
|
||||||
|
self.retranslateUi(Form)
|
||||||
|
QtCore.QMetaObject.connectSlotsByName(Form)
|
||||||
|
|
||||||
|
def retranslateUi(self, Form):
|
||||||
|
_translate = QtCore.QCoreApplication.translate
|
||||||
|
Form.setWindowTitle(_translate("Form", "Export"))
|
||||||
|
self.label.setText(_translate("Form", "Item to export:"))
|
||||||
|
self.label_2.setText(_translate("Form", "Export format"))
|
||||||
|
self.exportBtn.setText(_translate("Form", "Export"))
|
||||||
|
self.closeBtn.setText(_translate("Form", "Close"))
|
||||||
|
self.label_3.setText(_translate("Form", "Export options"))
|
||||||
|
self.copyBtn.setText(_translate("Form", "Copy"))
|
||||||
|
|
||||||
|
from ..parametertree import ParameterTree
|
109
pyqtgraph/Qt.py
109
pyqtgraph/Qt.py
@ -13,25 +13,35 @@ import sys, re
|
|||||||
|
|
||||||
from .python2_3 import asUnicode
|
from .python2_3 import asUnicode
|
||||||
|
|
||||||
|
PYSIDE = 'PySide'
|
||||||
|
PYQT4 = 'PyQt4'
|
||||||
|
PYQT5 = 'PyQt5'
|
||||||
|
|
||||||
|
QT_LIB = None
|
||||||
|
|
||||||
## Automatically determine whether to use PyQt or PySide.
|
## Automatically determine whether to use PyQt or PySide.
|
||||||
## This is done by first checking to see whether one of the libraries
|
## 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.
|
## is already imported. If not, then attempt to import PyQt4, then PySide.
|
||||||
if 'PyQt4' in sys.modules:
|
libOrder = [PYQT4, PYSIDE, PYQT5]
|
||||||
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:
|
for lib in libOrder:
|
||||||
|
if lib in sys.modules:
|
||||||
|
QT_LIB = lib
|
||||||
|
break
|
||||||
|
|
||||||
|
if QT_LIB is None:
|
||||||
|
for lib in libOrder:
|
||||||
|
try:
|
||||||
|
__import__(lib)
|
||||||
|
QT_LIB = lib
|
||||||
|
break
|
||||||
|
except ImportError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
if QT_LIB == None:
|
||||||
|
raise Exception("PyQtGraph requires one of PyQt4, PyQt5 or PySide; none of these packages could be imported.")
|
||||||
|
|
||||||
|
if QT_LIB == PYSIDE:
|
||||||
from PySide import QtGui, QtCore, QtOpenGL, QtSvg
|
from PySide import QtGui, QtCore, QtOpenGL, QtSvg
|
||||||
try:
|
try:
|
||||||
from PySide import QtTest
|
from PySide import QtTest
|
||||||
@ -99,8 +109,8 @@ if USE_PYSIDE:
|
|||||||
|
|
||||||
return form_class, base_class
|
return form_class, base_class
|
||||||
|
|
||||||
|
elif QT_LIB == PYQT4:
|
||||||
|
|
||||||
else:
|
|
||||||
from PyQt4 import QtGui, QtCore, uic
|
from PyQt4 import QtGui, QtCore, uic
|
||||||
try:
|
try:
|
||||||
from PyQt4 import QtSvg
|
from PyQt4 import QtSvg
|
||||||
@ -115,21 +125,82 @@ else:
|
|||||||
except ImportError:
|
except ImportError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
VERSION_INFO = 'PyQt4 ' + QtCore.PYQT_VERSION_STR + ' Qt ' + QtCore.QT_VERSION_STR
|
||||||
|
|
||||||
|
elif QT_LIB == PYQT5:
|
||||||
|
|
||||||
|
# We're using PyQt5 which has a different structure so we're going to use a shim to
|
||||||
|
# recreate the Qt4 structure for Qt5
|
||||||
|
from PyQt5 import QtGui, QtCore, QtWidgets, Qt, uic
|
||||||
|
try:
|
||||||
|
from PyQt5 import QtSvg
|
||||||
|
except ImportError:
|
||||||
|
pass
|
||||||
|
try:
|
||||||
|
from PyQt5 import QtOpenGL
|
||||||
|
except ImportError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
# Re-implement deprecated APIs
|
||||||
|
def scale(self, sx, sy):
|
||||||
|
tr = self.transform()
|
||||||
|
tr.scale(sx, sy)
|
||||||
|
self.setTransform(tr)
|
||||||
|
QtWidgets.QGraphicsItem.scale = scale
|
||||||
|
|
||||||
|
def rotate(self, angle):
|
||||||
|
tr = self.transform()
|
||||||
|
tr.rotate(angle)
|
||||||
|
self.setTransform(tr)
|
||||||
|
QtWidgets.QGraphicsItem.rotate = rotate
|
||||||
|
|
||||||
|
def translate(self, dx, dy):
|
||||||
|
tr = self.transform()
|
||||||
|
tr.translate(dx, dy)
|
||||||
|
self.setTransform(tr)
|
||||||
|
QtWidgets.QGraphicsItem.translate = translate
|
||||||
|
|
||||||
|
def setMargin(self, i):
|
||||||
|
self.setContentsMargins(i, i, i, i)
|
||||||
|
QtWidgets.QGridLayout.setMargin = setMargin
|
||||||
|
|
||||||
|
def setResizeMode(self, mode):
|
||||||
|
self.setSectionResizeMode(mode)
|
||||||
|
QtWidgets.QHeaderView.setResizeMode = setResizeMode
|
||||||
|
|
||||||
|
|
||||||
|
QtGui.QApplication = QtWidgets.QApplication
|
||||||
|
QtGui.QGraphicsScene = QtWidgets.QGraphicsScene
|
||||||
|
QtGui.QGraphicsObject = QtWidgets.QGraphicsObject
|
||||||
|
QtGui.QGraphicsWidget = QtWidgets.QGraphicsWidget
|
||||||
|
|
||||||
|
QtGui.QApplication.setGraphicsSystem = None
|
||||||
|
|
||||||
|
# Import all QtWidgets objects into QtGui
|
||||||
|
for o in dir(QtWidgets):
|
||||||
|
if o.startswith('Q'):
|
||||||
|
setattr(QtGui, o, getattr(QtWidgets,o) )
|
||||||
|
|
||||||
|
VERSION_INFO = 'PyQt5 ' + QtCore.PYQT_VERSION_STR + ' Qt ' + QtCore.QT_VERSION_STR
|
||||||
|
|
||||||
|
# Common to PyQt4 and 5
|
||||||
|
if QT_LIB.startswith('PyQt'):
|
||||||
import sip
|
import sip
|
||||||
def isQObjectAlive(obj):
|
def isQObjectAlive(obj):
|
||||||
return not sip.isdeleted(obj)
|
return not sip.isdeleted(obj)
|
||||||
loadUiType = uic.loadUiType
|
loadUiType = uic.loadUiType
|
||||||
|
|
||||||
QtCore.Signal = QtCore.pyqtSignal
|
QtCore.Signal = QtCore.pyqtSignal
|
||||||
VERSION_INFO = 'PyQt4 ' + QtCore.PYQT_VERSION_STR + ' Qt ' + QtCore.QT_VERSION_STR
|
|
||||||
|
|
||||||
|
|
||||||
## Make sure we have Qt >= 4.7
|
## Make sure we have Qt >= 4.7
|
||||||
versionReq = [4, 7]
|
versionReq = [4, 7]
|
||||||
QtVersion = PySide.QtCore.__version__ if USE_PYSIDE else QtCore.QT_VERSION_STR
|
USE_PYSIDE = QT_LIB == PYSIDE
|
||||||
|
USE_PYQT4 = QT_LIB == PYQT4
|
||||||
|
USE_PYQT5 = QT_LIB == PYQT5
|
||||||
|
QtVersion = PySide.QtCore.__version__ if QT_LIB == PYSIDE else QtCore.QT_VERSION_STR
|
||||||
m = re.match(r'(\d+)\.(\d+).*', QtVersion)
|
m = re.match(r'(\d+)\.(\d+).*', QtVersion)
|
||||||
if m is not None and list(map(int, m.groups())) < versionReq:
|
if m is not None and list(map(int, m.groups())) < versionReq:
|
||||||
print(list(map(int, m.groups())))
|
print(list(map(int, m.groups())))
|
||||||
raise Exception('pyqtgraph requires Qt version >= %d.%d (your version is %s)' % (versionReq[0], versionReq[1], QtVersion))
|
raise Exception('pyqtgraph requires Qt version >= %d.%d (your version is %s)' % (versionReq[0], versionReq[1], QtVersion))
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ This class addresses the problem of having to save and restore the state
|
|||||||
of a large group of widgets.
|
of a large group of widgets.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from .Qt import QtCore, QtGui
|
from .Qt import QtCore, QtGui, USE_PYQT5
|
||||||
import weakref, inspect
|
import weakref, inspect
|
||||||
from .python2_3 import asUnicode
|
from .python2_3 import asUnicode
|
||||||
|
|
||||||
@ -60,9 +60,13 @@ def setComboState(w, v):
|
|||||||
|
|
||||||
|
|
||||||
class WidgetGroup(QtCore.QObject):
|
class WidgetGroup(QtCore.QObject):
|
||||||
"""This class takes a list of widgets and keeps an internal record of their state which is always up to date. Allows reading and writing from groups of widgets simultaneously."""
|
"""This class takes a list of widgets and keeps an internal record of their
|
||||||
|
state that is always up to date.
|
||||||
|
|
||||||
## List of widget types which can be handled by WidgetGroup.
|
Allows reading and writing from groups of widgets simultaneously.
|
||||||
|
"""
|
||||||
|
|
||||||
|
## List of widget types that can be handled by WidgetGroup.
|
||||||
## The value for each type is a tuple (change signal function, get function, set function, [auto-add children])
|
## The value for each type is a tuple (change signal function, get function, set function, [auto-add children])
|
||||||
## The change signal function that takes an object and returns a signal that is emitted any time the state of the widget changes, not just
|
## The change signal function that takes an object and returns a signal that is emitted any time the state of the widget changes, not just
|
||||||
## when it is changed by user interaction. (for example, 'clicked' is not a valid signal here)
|
## when it is changed by user interaction. (for example, 'clicked' is not a valid signal here)
|
||||||
@ -200,51 +204,35 @@ class WidgetGroup(QtCore.QObject):
|
|||||||
if hasattr(obj, 'widgetGroupInterface'):
|
if hasattr(obj, 'widgetGroupInterface'):
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
#return (type(obj) in WidgetGroup.classes)
|
|
||||||
|
|
||||||
def setScale(self, widget, scale):
|
def setScale(self, widget, scale):
|
||||||
val = self.readWidget(widget)
|
val = self.readWidget(widget)
|
||||||
self.scales[widget] = scale
|
self.scales[widget] = scale
|
||||||
self.setWidget(widget, val)
|
self.setWidget(widget, val)
|
||||||
#print "scaling %f to %f" % (val, self.readWidget(widget))
|
|
||||||
|
|
||||||
|
|
||||||
def mkChangeCallback(self, w):
|
def mkChangeCallback(self, w):
|
||||||
return lambda *args: self.widgetChanged(w, *args)
|
return lambda *args: self.widgetChanged(w, *args)
|
||||||
|
|
||||||
def widgetChanged(self, w, *args):
|
def widgetChanged(self, w, *args):
|
||||||
#print "widget changed"
|
|
||||||
n = self.widgetList[w]
|
n = self.widgetList[w]
|
||||||
v1 = self.cache[n]
|
v1 = self.cache[n]
|
||||||
v2 = self.readWidget(w)
|
v2 = self.readWidget(w)
|
||||||
if v1 != v2:
|
if v1 != v2:
|
||||||
#print "widget", n, " = ", v2
|
if not USE_PYQT5:
|
||||||
|
# Old signal kept for backward compatibility.
|
||||||
self.emit(QtCore.SIGNAL('changed'), self.widgetList[w], v2)
|
self.emit(QtCore.SIGNAL('changed'), self.widgetList[w], v2)
|
||||||
self.sigChanged.emit(self.widgetList[w], v2)
|
self.sigChanged.emit(self.widgetList[w], v2)
|
||||||
|
|
||||||
def state(self):
|
def state(self):
|
||||||
for w in self.uncachedWidgets:
|
for w in self.uncachedWidgets:
|
||||||
self.readWidget(w)
|
self.readWidget(w)
|
||||||
|
|
||||||
#cc = self.cache.copy()
|
|
||||||
#if 'averageGroup' in cc:
|
|
||||||
#val = cc['averageGroup']
|
|
||||||
#w = self.findWidget('averageGroup')
|
|
||||||
#self.readWidget(w)
|
|
||||||
#if val != self.cache['averageGroup']:
|
|
||||||
#print " AverageGroup did not match cached value!"
|
|
||||||
#else:
|
|
||||||
#print " AverageGroup OK"
|
|
||||||
return self.cache.copy()
|
return self.cache.copy()
|
||||||
|
|
||||||
def setState(self, s):
|
def setState(self, s):
|
||||||
#print "SET STATE", self, s
|
|
||||||
for w in self.widgetList:
|
for w in self.widgetList:
|
||||||
n = self.widgetList[w]
|
n = self.widgetList[w]
|
||||||
#print " restore %s?" % n
|
|
||||||
if n not in s:
|
if n not in s:
|
||||||
continue
|
continue
|
||||||
#print " restore state", w, n, s[n]
|
|
||||||
self.setWidget(w, s[n])
|
self.setWidget(w, s[n])
|
||||||
|
|
||||||
def readWidget(self, w):
|
def readWidget(self, w):
|
||||||
|
@ -41,6 +41,7 @@ elif 'darwin' in sys.platform: ## openGL can have a major impact on mac, but als
|
|||||||
useOpenGL = False
|
useOpenGL = False
|
||||||
if QtGui.QApplication.instance() is not None:
|
if QtGui.QApplication.instance() is not None:
|
||||||
print('Warning: QApplication was created before pyqtgraph was imported; there may be problems (to avoid bugs, call QApplication.setGraphicsSystem("raster") before the QApplication is created).')
|
print('Warning: QApplication was created before pyqtgraph was imported; there may be problems (to avoid bugs, call QApplication.setGraphicsSystem("raster") before the QApplication is created).')
|
||||||
|
if QtGui.QApplication.setGraphicsSystem:
|
||||||
QtGui.QApplication.setGraphicsSystem('raster') ## work around a variety of bugs in the native graphics system
|
QtGui.QApplication.setGraphicsSystem('raster') ## work around a variety of bugs in the native graphics system
|
||||||
else:
|
else:
|
||||||
useOpenGL = False ## on windows there's a more even performance / bugginess tradeoff.
|
useOpenGL = False ## on windows there's a more even performance / bugginess tradeoff.
|
||||||
|
96
pyqtgraph/canvas/CanvasTemplate_pyqt5.py
Normal file
96
pyqtgraph/canvas/CanvasTemplate_pyqt5.py
Normal file
@ -0,0 +1,96 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Form implementation generated from reading ui file './pyqtgraph/canvas/CanvasTemplate.ui'
|
||||||
|
#
|
||||||
|
# Created: Wed Mar 26 15:09:28 2014
|
||||||
|
# by: PyQt5 UI code generator 5.0.1
|
||||||
|
#
|
||||||
|
# WARNING! All changes made in this file will be lost!
|
||||||
|
|
||||||
|
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||||
|
|
||||||
|
class Ui_Form(object):
|
||||||
|
def setupUi(self, Form):
|
||||||
|
Form.setObjectName("Form")
|
||||||
|
Form.resize(490, 414)
|
||||||
|
self.gridLayout = QtWidgets.QGridLayout(Form)
|
||||||
|
self.gridLayout.setContentsMargins(0, 0, 0, 0)
|
||||||
|
self.gridLayout.setSpacing(0)
|
||||||
|
self.gridLayout.setObjectName("gridLayout")
|
||||||
|
self.splitter = QtWidgets.QSplitter(Form)
|
||||||
|
self.splitter.setOrientation(QtCore.Qt.Horizontal)
|
||||||
|
self.splitter.setObjectName("splitter")
|
||||||
|
self.view = GraphicsView(self.splitter)
|
||||||
|
self.view.setObjectName("view")
|
||||||
|
self.layoutWidget = QtWidgets.QWidget(self.splitter)
|
||||||
|
self.layoutWidget.setObjectName("layoutWidget")
|
||||||
|
self.gridLayout_2 = QtWidgets.QGridLayout(self.layoutWidget)
|
||||||
|
self.gridLayout_2.setContentsMargins(0, 0, 0, 0)
|
||||||
|
self.gridLayout_2.setObjectName("gridLayout_2")
|
||||||
|
self.storeSvgBtn = QtWidgets.QPushButton(self.layoutWidget)
|
||||||
|
self.storeSvgBtn.setObjectName("storeSvgBtn")
|
||||||
|
self.gridLayout_2.addWidget(self.storeSvgBtn, 1, 0, 1, 1)
|
||||||
|
self.storePngBtn = QtWidgets.QPushButton(self.layoutWidget)
|
||||||
|
self.storePngBtn.setObjectName("storePngBtn")
|
||||||
|
self.gridLayout_2.addWidget(self.storePngBtn, 1, 1, 1, 1)
|
||||||
|
self.autoRangeBtn = QtWidgets.QPushButton(self.layoutWidget)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.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 = QtWidgets.QHBoxLayout()
|
||||||
|
self.horizontalLayout.setSpacing(0)
|
||||||
|
self.horizontalLayout.setObjectName("horizontalLayout")
|
||||||
|
self.redirectCheck = QtWidgets.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 = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.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 = QtWidgets.QGridLayout()
|
||||||
|
self.ctrlLayout.setSpacing(0)
|
||||||
|
self.ctrlLayout.setObjectName("ctrlLayout")
|
||||||
|
self.gridLayout_2.addLayout(self.ctrlLayout, 11, 0, 1, 2)
|
||||||
|
self.resetTransformsBtn = QtWidgets.QPushButton(self.layoutWidget)
|
||||||
|
self.resetTransformsBtn.setObjectName("resetTransformsBtn")
|
||||||
|
self.gridLayout_2.addWidget(self.resetTransformsBtn, 8, 0, 1, 1)
|
||||||
|
self.mirrorSelectionBtn = QtWidgets.QPushButton(self.layoutWidget)
|
||||||
|
self.mirrorSelectionBtn.setObjectName("mirrorSelectionBtn")
|
||||||
|
self.gridLayout_2.addWidget(self.mirrorSelectionBtn, 4, 0, 1, 1)
|
||||||
|
self.reflectSelectionBtn = QtWidgets.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):
|
||||||
|
_translate = QtCore.QCoreApplication.translate
|
||||||
|
Form.setWindowTitle(_translate("Form", "Form"))
|
||||||
|
self.storeSvgBtn.setText(_translate("Form", "Store SVG"))
|
||||||
|
self.storePngBtn.setText(_translate("Form", "Store PNG"))
|
||||||
|
self.autoRangeBtn.setText(_translate("Form", "Auto Range"))
|
||||||
|
self.redirectCheck.setToolTip(_translate("Form", "Check to display all local items in a remote canvas."))
|
||||||
|
self.redirectCheck.setText(_translate("Form", "Redirect"))
|
||||||
|
self.resetTransformsBtn.setText(_translate("Form", "Reset Transforms"))
|
||||||
|
self.mirrorSelectionBtn.setText(_translate("Form", "Mirror Selection"))
|
||||||
|
self.reflectSelectionBtn.setText(_translate("Form", "MirrorXY"))
|
||||||
|
|
||||||
|
from ..widgets.GraphicsView import GraphicsView
|
||||||
|
from ..widgets.TreeWidget import TreeWidget
|
||||||
|
from CanvasManager import CanvasCombo
|
56
pyqtgraph/canvas/TransformGuiTemplate_pyqt5.py
Normal file
56
pyqtgraph/canvas/TransformGuiTemplate_pyqt5.py
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Form implementation generated from reading ui file './pyqtgraph/canvas/TransformGuiTemplate.ui'
|
||||||
|
#
|
||||||
|
# Created: Wed Mar 26 15:09:28 2014
|
||||||
|
# by: PyQt5 UI code generator 5.0.1
|
||||||
|
#
|
||||||
|
# WARNING! All changes made in this file will be lost!
|
||||||
|
|
||||||
|
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||||
|
|
||||||
|
class Ui_Form(object):
|
||||||
|
def setupUi(self, Form):
|
||||||
|
Form.setObjectName("Form")
|
||||||
|
Form.resize(224, 117)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(Form.sizePolicy().hasHeightForWidth())
|
||||||
|
Form.setSizePolicy(sizePolicy)
|
||||||
|
self.verticalLayout = QtWidgets.QVBoxLayout(Form)
|
||||||
|
self.verticalLayout.setSpacing(1)
|
||||||
|
self.verticalLayout.setContentsMargins(0, 0, 0, 0)
|
||||||
|
self.verticalLayout.setObjectName("verticalLayout")
|
||||||
|
self.translateLabel = QtWidgets.QLabel(Form)
|
||||||
|
self.translateLabel.setObjectName("translateLabel")
|
||||||
|
self.verticalLayout.addWidget(self.translateLabel)
|
||||||
|
self.rotateLabel = QtWidgets.QLabel(Form)
|
||||||
|
self.rotateLabel.setObjectName("rotateLabel")
|
||||||
|
self.verticalLayout.addWidget(self.rotateLabel)
|
||||||
|
self.scaleLabel = QtWidgets.QLabel(Form)
|
||||||
|
self.scaleLabel.setObjectName("scaleLabel")
|
||||||
|
self.verticalLayout.addWidget(self.scaleLabel)
|
||||||
|
self.horizontalLayout = QtWidgets.QHBoxLayout()
|
||||||
|
self.horizontalLayout.setObjectName("horizontalLayout")
|
||||||
|
self.mirrorImageBtn = QtWidgets.QPushButton(Form)
|
||||||
|
self.mirrorImageBtn.setToolTip("")
|
||||||
|
self.mirrorImageBtn.setObjectName("mirrorImageBtn")
|
||||||
|
self.horizontalLayout.addWidget(self.mirrorImageBtn)
|
||||||
|
self.reflectImageBtn = QtWidgets.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):
|
||||||
|
_translate = QtCore.QCoreApplication.translate
|
||||||
|
Form.setWindowTitle(_translate("Form", "Form"))
|
||||||
|
self.translateLabel.setText(_translate("Form", "Translate:"))
|
||||||
|
self.rotateLabel.setText(_translate("Form", "Rotate:"))
|
||||||
|
self.scaleLabel.setText(_translate("Form", "Scale:"))
|
||||||
|
self.mirrorImageBtn.setText(_translate("Form", "Mirror"))
|
||||||
|
self.reflectImageBtn.setText(_translate("Form", "Reflect"))
|
||||||
|
|
@ -1,8 +1,10 @@
|
|||||||
|
|
||||||
from ..Qt import QtCore, QtGui, USE_PYSIDE
|
from ..Qt import QtCore, QtGui, USE_PYSIDE, USE_PYQT5
|
||||||
import sys, re, os, time, traceback, subprocess
|
import sys, re, os, time, traceback, subprocess
|
||||||
if USE_PYSIDE:
|
if USE_PYSIDE:
|
||||||
from . import template_pyside as template
|
from . import template_pyside as template
|
||||||
|
elif USE_PYQT5:
|
||||||
|
from . import template_pyqt5 as template
|
||||||
else:
|
else:
|
||||||
from . import template_pyqt as template
|
from . import template_pyqt as template
|
||||||
|
|
||||||
|
107
pyqtgraph/console/template_pyqt5.py
Normal file
107
pyqtgraph/console/template_pyqt5.py
Normal file
@ -0,0 +1,107 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Form implementation generated from reading ui file './pyqtgraph/console/template.ui'
|
||||||
|
#
|
||||||
|
# Created: Wed Mar 26 15:09:29 2014
|
||||||
|
# by: PyQt5 UI code generator 5.0.1
|
||||||
|
#
|
||||||
|
# WARNING! All changes made in this file will be lost!
|
||||||
|
|
||||||
|
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||||
|
|
||||||
|
class Ui_Form(object):
|
||||||
|
def setupUi(self, Form):
|
||||||
|
Form.setObjectName("Form")
|
||||||
|
Form.resize(710, 497)
|
||||||
|
self.gridLayout = QtWidgets.QGridLayout(Form)
|
||||||
|
self.gridLayout.setContentsMargins(0, 0, 0, 0)
|
||||||
|
self.gridLayout.setSpacing(0)
|
||||||
|
self.gridLayout.setObjectName("gridLayout")
|
||||||
|
self.splitter = QtWidgets.QSplitter(Form)
|
||||||
|
self.splitter.setOrientation(QtCore.Qt.Vertical)
|
||||||
|
self.splitter.setObjectName("splitter")
|
||||||
|
self.layoutWidget = QtWidgets.QWidget(self.splitter)
|
||||||
|
self.layoutWidget.setObjectName("layoutWidget")
|
||||||
|
self.verticalLayout = QtWidgets.QVBoxLayout(self.layoutWidget)
|
||||||
|
self.verticalLayout.setContentsMargins(0, 0, 0, 0)
|
||||||
|
self.verticalLayout.setObjectName("verticalLayout")
|
||||||
|
self.output = QtWidgets.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 = QtWidgets.QHBoxLayout()
|
||||||
|
self.horizontalLayout.setObjectName("horizontalLayout")
|
||||||
|
self.input = CmdInput(self.layoutWidget)
|
||||||
|
self.input.setObjectName("input")
|
||||||
|
self.horizontalLayout.addWidget(self.input)
|
||||||
|
self.historyBtn = QtWidgets.QPushButton(self.layoutWidget)
|
||||||
|
self.historyBtn.setCheckable(True)
|
||||||
|
self.historyBtn.setObjectName("historyBtn")
|
||||||
|
self.horizontalLayout.addWidget(self.historyBtn)
|
||||||
|
self.exceptionBtn = QtWidgets.QPushButton(self.layoutWidget)
|
||||||
|
self.exceptionBtn.setCheckable(True)
|
||||||
|
self.exceptionBtn.setObjectName("exceptionBtn")
|
||||||
|
self.horizontalLayout.addWidget(self.exceptionBtn)
|
||||||
|
self.verticalLayout.addLayout(self.horizontalLayout)
|
||||||
|
self.historyList = QtWidgets.QListWidget(self.splitter)
|
||||||
|
font = QtGui.QFont()
|
||||||
|
font.setFamily("Monospace")
|
||||||
|
self.historyList.setFont(font)
|
||||||
|
self.historyList.setObjectName("historyList")
|
||||||
|
self.exceptionGroup = QtWidgets.QGroupBox(self.splitter)
|
||||||
|
self.exceptionGroup.setObjectName("exceptionGroup")
|
||||||
|
self.gridLayout_2 = QtWidgets.QGridLayout(self.exceptionGroup)
|
||||||
|
self.gridLayout_2.setSpacing(0)
|
||||||
|
self.gridLayout_2.setContentsMargins(-1, 0, -1, 0)
|
||||||
|
self.gridLayout_2.setObjectName("gridLayout_2")
|
||||||
|
self.catchAllExceptionsBtn = QtWidgets.QPushButton(self.exceptionGroup)
|
||||||
|
self.catchAllExceptionsBtn.setCheckable(True)
|
||||||
|
self.catchAllExceptionsBtn.setObjectName("catchAllExceptionsBtn")
|
||||||
|
self.gridLayout_2.addWidget(self.catchAllExceptionsBtn, 0, 1, 1, 1)
|
||||||
|
self.catchNextExceptionBtn = QtWidgets.QPushButton(self.exceptionGroup)
|
||||||
|
self.catchNextExceptionBtn.setCheckable(True)
|
||||||
|
self.catchNextExceptionBtn.setObjectName("catchNextExceptionBtn")
|
||||||
|
self.gridLayout_2.addWidget(self.catchNextExceptionBtn, 0, 0, 1, 1)
|
||||||
|
self.onlyUncaughtCheck = QtWidgets.QCheckBox(self.exceptionGroup)
|
||||||
|
self.onlyUncaughtCheck.setChecked(True)
|
||||||
|
self.onlyUncaughtCheck.setObjectName("onlyUncaughtCheck")
|
||||||
|
self.gridLayout_2.addWidget(self.onlyUncaughtCheck, 0, 2, 1, 1)
|
||||||
|
self.exceptionStackList = QtWidgets.QListWidget(self.exceptionGroup)
|
||||||
|
self.exceptionStackList.setAlternatingRowColors(True)
|
||||||
|
self.exceptionStackList.setObjectName("exceptionStackList")
|
||||||
|
self.gridLayout_2.addWidget(self.exceptionStackList, 2, 0, 1, 5)
|
||||||
|
self.runSelectedFrameCheck = QtWidgets.QCheckBox(self.exceptionGroup)
|
||||||
|
self.runSelectedFrameCheck.setChecked(True)
|
||||||
|
self.runSelectedFrameCheck.setObjectName("runSelectedFrameCheck")
|
||||||
|
self.gridLayout_2.addWidget(self.runSelectedFrameCheck, 3, 0, 1, 5)
|
||||||
|
self.exceptionInfoLabel = QtWidgets.QLabel(self.exceptionGroup)
|
||||||
|
self.exceptionInfoLabel.setObjectName("exceptionInfoLabel")
|
||||||
|
self.gridLayout_2.addWidget(self.exceptionInfoLabel, 1, 0, 1, 5)
|
||||||
|
self.clearExceptionBtn = QtWidgets.QPushButton(self.exceptionGroup)
|
||||||
|
self.clearExceptionBtn.setEnabled(False)
|
||||||
|
self.clearExceptionBtn.setObjectName("clearExceptionBtn")
|
||||||
|
self.gridLayout_2.addWidget(self.clearExceptionBtn, 0, 4, 1, 1)
|
||||||
|
spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.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):
|
||||||
|
_translate = QtCore.QCoreApplication.translate
|
||||||
|
Form.setWindowTitle(_translate("Form", "Console"))
|
||||||
|
self.historyBtn.setText(_translate("Form", "History.."))
|
||||||
|
self.exceptionBtn.setText(_translate("Form", "Exceptions.."))
|
||||||
|
self.exceptionGroup.setTitle(_translate("Form", "Exception Handling"))
|
||||||
|
self.catchAllExceptionsBtn.setText(_translate("Form", "Show All Exceptions"))
|
||||||
|
self.catchNextExceptionBtn.setText(_translate("Form", "Show Next Exception"))
|
||||||
|
self.onlyUncaughtCheck.setText(_translate("Form", "Only Uncaught Exceptions"))
|
||||||
|
self.runSelectedFrameCheck.setText(_translate("Form", "Run commands in selected stack frame"))
|
||||||
|
self.exceptionInfoLabel.setText(_translate("Form", "Exception Info"))
|
||||||
|
self.clearExceptionBtn.setText(_translate("Form", "Clear Exception"))
|
||||||
|
|
||||||
|
from .CmdInput import CmdInput
|
@ -45,41 +45,6 @@ class SVGExporter(Exporter):
|
|||||||
if toBytes is False and copy is False and fileName is None:
|
if toBytes is False and copy is False and fileName is None:
|
||||||
self.fileSaveDialog(filter="Scalable Vector Graphics (*.svg)")
|
self.fileSaveDialog(filter="Scalable Vector Graphics (*.svg)")
|
||||||
return
|
return
|
||||||
#self.svg = QtSvg.QSvgGenerator()
|
|
||||||
#self.svg.setFileName(fileName)
|
|
||||||
#dpi = QtGui.QDesktopWidget().physicalDpiX()
|
|
||||||
### not really sure why this works, but it seems to be important:
|
|
||||||
#self.svg.setSize(QtCore.QSize(self.params['width']*dpi/90., self.params['height']*dpi/90.))
|
|
||||||
#self.svg.setResolution(dpi)
|
|
||||||
##self.svg.setViewBox()
|
|
||||||
#targetRect = QtCore.QRect(0, 0, self.params['width'], self.params['height'])
|
|
||||||
#sourceRect = self.getSourceRect()
|
|
||||||
|
|
||||||
#painter = QtGui.QPainter(self.svg)
|
|
||||||
#try:
|
|
||||||
#self.setExportMode(True)
|
|
||||||
#self.render(painter, QtCore.QRectF(targetRect), sourceRect)
|
|
||||||
#finally:
|
|
||||||
#self.setExportMode(False)
|
|
||||||
#painter.end()
|
|
||||||
|
|
||||||
## Workaround to set pen widths correctly
|
|
||||||
#data = open(fileName).readlines()
|
|
||||||
#for i in range(len(data)):
|
|
||||||
#line = data[i]
|
|
||||||
#m = re.match(r'(<g .*)stroke-width="1"(.*transform="matrix\(([^\)]+)\)".*)', line)
|
|
||||||
#if m is not None:
|
|
||||||
##print "Matched group:", line
|
|
||||||
#g = m.groups()
|
|
||||||
#matrix = list(map(float, g[2].split(',')))
|
|
||||||
##print "matrix:", matrix
|
|
||||||
#scale = max(abs(matrix[0]), abs(matrix[3]))
|
|
||||||
#if scale == 0 or scale == 1.0:
|
|
||||||
#continue
|
|
||||||
#data[i] = g[0] + ' stroke-width="%0.2g" ' % (1.0/scale) + g[1] + '\n'
|
|
||||||
##print "old line:", line
|
|
||||||
##print "new line:", data[i]
|
|
||||||
#open(fileName, 'w').write(''.join(data))
|
|
||||||
|
|
||||||
## Qt's SVG generator is not complete. (notably, it lacks clipping)
|
## Qt's SVG generator is not complete. (notably, it lacks clipping)
|
||||||
## Instead, we will use Qt to generate SVG for each item independently,
|
## Instead, we will use Qt to generate SVG for each item independently,
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from ..Qt import QtCore, QtGui, USE_PYSIDE
|
from ..Qt import QtCore, QtGui, USE_PYSIDE, USE_PYQT5
|
||||||
from .Node import *
|
from .Node import *
|
||||||
from ..pgcollections import OrderedDict
|
from ..pgcollections import OrderedDict
|
||||||
from ..widgets.TreeWidget import *
|
from ..widgets.TreeWidget import *
|
||||||
@ -9,6 +9,9 @@ from .. import FileDialog, DataTreeWidget
|
|||||||
if USE_PYSIDE:
|
if USE_PYSIDE:
|
||||||
from . import FlowchartTemplate_pyside as FlowchartTemplate
|
from . import FlowchartTemplate_pyside as FlowchartTemplate
|
||||||
from . import FlowchartCtrlTemplate_pyside as FlowchartCtrlTemplate
|
from . import FlowchartCtrlTemplate_pyside as FlowchartCtrlTemplate
|
||||||
|
elif USE_PYQT5:
|
||||||
|
from . import FlowchartTemplate_pyqt5 as FlowchartTemplate
|
||||||
|
from . import FlowchartCtrlTemplate_pyqt5 as FlowchartCtrlTemplate
|
||||||
else:
|
else:
|
||||||
from . import FlowchartTemplate_pyqt as FlowchartTemplate
|
from . import FlowchartTemplate_pyqt as FlowchartTemplate
|
||||||
from . import FlowchartCtrlTemplate_pyqt as FlowchartCtrlTemplate
|
from . import FlowchartCtrlTemplate_pyqt as FlowchartCtrlTemplate
|
||||||
@ -619,7 +622,10 @@ class FlowchartCtrlWidget(QtGui.QWidget):
|
|||||||
self.cwWin.resize(1000,800)
|
self.cwWin.resize(1000,800)
|
||||||
|
|
||||||
h = self.ui.ctrlList.header()
|
h = self.ui.ctrlList.header()
|
||||||
|
if not USE_PYQT5:
|
||||||
h.setResizeMode(0, h.Stretch)
|
h.setResizeMode(0, h.Stretch)
|
||||||
|
else:
|
||||||
|
h.setSectionResizeMode(0, h.Stretch)
|
||||||
|
|
||||||
self.ui.ctrlList.itemChanged.connect(self.itemChanged)
|
self.ui.ctrlList.itemChanged.connect(self.itemChanged)
|
||||||
self.ui.loadBtn.clicked.connect(self.loadClicked)
|
self.ui.loadBtn.clicked.connect(self.loadClicked)
|
||||||
|
67
pyqtgraph/flowchart/FlowchartCtrlTemplate_pyqt5.py
Normal file
67
pyqtgraph/flowchart/FlowchartCtrlTemplate_pyqt5.py
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Form implementation generated from reading ui file './pyqtgraph/flowchart/FlowchartCtrlTemplate.ui'
|
||||||
|
#
|
||||||
|
# Created: Wed Mar 26 15:09:28 2014
|
||||||
|
# by: PyQt5 UI code generator 5.0.1
|
||||||
|
#
|
||||||
|
# WARNING! All changes made in this file will be lost!
|
||||||
|
|
||||||
|
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||||
|
|
||||||
|
class Ui_Form(object):
|
||||||
|
def setupUi(self, Form):
|
||||||
|
Form.setObjectName("Form")
|
||||||
|
Form.resize(217, 499)
|
||||||
|
self.gridLayout = QtWidgets.QGridLayout(Form)
|
||||||
|
self.gridLayout.setContentsMargins(0, 0, 0, 0)
|
||||||
|
self.gridLayout.setVerticalSpacing(0)
|
||||||
|
self.gridLayout.setObjectName("gridLayout")
|
||||||
|
self.loadBtn = QtWidgets.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 = QtWidgets.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 = QtWidgets.QLabel(Form)
|
||||||
|
font = QtGui.QFont()
|
||||||
|
font.setBold(True)
|
||||||
|
font.setWeight(75)
|
||||||
|
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):
|
||||||
|
_translate = QtCore.QCoreApplication.translate
|
||||||
|
Form.setWindowTitle(_translate("Form", "Form"))
|
||||||
|
self.loadBtn.setText(_translate("Form", "Load.."))
|
||||||
|
self.saveBtn.setText(_translate("Form", "Save"))
|
||||||
|
self.saveAsBtn.setText(_translate("Form", "As.."))
|
||||||
|
self.reloadBtn.setText(_translate("Form", "Reload Libs"))
|
||||||
|
self.showChartBtn.setText(_translate("Form", "Flowchart"))
|
||||||
|
|
||||||
|
from ..widgets.FeedbackButton import FeedbackButton
|
||||||
|
from ..widgets.TreeWidget import TreeWidget
|
55
pyqtgraph/flowchart/FlowchartTemplate_pyqt5.py
Normal file
55
pyqtgraph/flowchart/FlowchartTemplate_pyqt5.py
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Form implementation generated from reading ui file './pyqtgraph/flowchart/FlowchartTemplate.ui'
|
||||||
|
#
|
||||||
|
# Created: Wed Mar 26 15:09:28 2014
|
||||||
|
# by: PyQt5 UI code generator 5.0.1
|
||||||
|
#
|
||||||
|
# WARNING! All changes made in this file will be lost!
|
||||||
|
|
||||||
|
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||||
|
|
||||||
|
class Ui_Form(object):
|
||||||
|
def setupUi(self, Form):
|
||||||
|
Form.setObjectName("Form")
|
||||||
|
Form.resize(529, 329)
|
||||||
|
self.selInfoWidget = QtWidgets.QWidget(Form)
|
||||||
|
self.selInfoWidget.setGeometry(QtCore.QRect(260, 10, 264, 222))
|
||||||
|
self.selInfoWidget.setObjectName("selInfoWidget")
|
||||||
|
self.gridLayout = QtWidgets.QGridLayout(self.selInfoWidget)
|
||||||
|
self.gridLayout.setContentsMargins(0, 0, 0, 0)
|
||||||
|
self.gridLayout.setObjectName("gridLayout")
|
||||||
|
self.selDescLabel = QtWidgets.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 = QtWidgets.QLabel(self.selInfoWidget)
|
||||||
|
font = QtGui.QFont()
|
||||||
|
font.setBold(True)
|
||||||
|
font.setWeight(75)
|
||||||
|
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 = QtWidgets.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):
|
||||||
|
_translate = QtCore.QCoreApplication.translate
|
||||||
|
Form.setWindowTitle(_translate("Form", "Form"))
|
||||||
|
|
||||||
|
from ..widgets.DataTreeWidget import DataTreeWidget
|
||||||
|
from ..flowchart.FlowchartGraphicsView import FlowchartGraphicsView
|
@ -1,4 +1,4 @@
|
|||||||
from ..Qt import QtGui
|
from ..Qt import QtGui, USE_PYQT5, USE_PYQT4, USE_PYSIDE
|
||||||
from .. import functions as fn
|
from .. import functions as fn
|
||||||
from .PlotDataItem import PlotDataItem
|
from .PlotDataItem import PlotDataItem
|
||||||
from .PlotCurveItem import PlotCurveItem
|
from .PlotCurveItem import PlotCurveItem
|
||||||
@ -7,7 +7,7 @@ class FillBetweenItem(QtGui.QGraphicsPathItem):
|
|||||||
"""
|
"""
|
||||||
GraphicsItem filling the space between two PlotDataItems.
|
GraphicsItem filling the space between two PlotDataItems.
|
||||||
"""
|
"""
|
||||||
def __init__(self, curve1=None, curve2=None, brush=None):
|
def __init__(self, curve1=None, curve2=None, brush=None, pen=None):
|
||||||
QtGui.QGraphicsPathItem.__init__(self)
|
QtGui.QGraphicsPathItem.__init__(self)
|
||||||
self.curves = None
|
self.curves = None
|
||||||
if curve1 is not None and curve2 is not None:
|
if curve1 is not None and curve2 is not None:
|
||||||
@ -16,9 +16,16 @@ class FillBetweenItem(QtGui.QGraphicsPathItem):
|
|||||||
raise Exception("Must specify two curves to fill between.")
|
raise Exception("Must specify two curves to fill between.")
|
||||||
|
|
||||||
if brush is not None:
|
if brush is not None:
|
||||||
self.setBrush(fn.mkBrush(brush))
|
self.setBrush(brush)
|
||||||
|
self.setPen(pen)
|
||||||
self.updatePath()
|
self.updatePath()
|
||||||
|
|
||||||
|
def setBrush(self, *args, **kwds):
|
||||||
|
QtGui.QGraphicsPathItem.setBrush(self, fn.mkBrush(*args, **kwds))
|
||||||
|
|
||||||
|
def setPen(self, *args, **kwds):
|
||||||
|
QtGui.QGraphicsPathItem.setPen(self, fn.mkPen(*args, **kwds))
|
||||||
|
|
||||||
def setCurves(self, curve1, curve2):
|
def setCurves(self, curve1, curve2):
|
||||||
"""Set the curves to fill between.
|
"""Set the curves to fill between.
|
||||||
|
|
||||||
@ -26,7 +33,6 @@ class FillBetweenItem(QtGui.QGraphicsPathItem):
|
|||||||
|
|
||||||
Added in version 0.9.9
|
Added in version 0.9.9
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if self.curves is not None:
|
if self.curves is not None:
|
||||||
for c in self.curves:
|
for c in self.curves:
|
||||||
try:
|
try:
|
||||||
@ -63,8 +69,9 @@ class FillBetweenItem(QtGui.QGraphicsPathItem):
|
|||||||
paths.append(c.getPath())
|
paths.append(c.getPath())
|
||||||
|
|
||||||
path = QtGui.QPainterPath()
|
path = QtGui.QPainterPath()
|
||||||
p1 = paths[0].toSubpathPolygons()
|
transform = QtGui.QTransform()
|
||||||
p2 = paths[1].toReversed().toSubpathPolygons()
|
p1 = paths[0].toSubpathPolygons(transform)
|
||||||
|
p2 = paths[1].toReversed().toSubpathPolygons(transform)
|
||||||
if len(p1) == 0 or len(p2) == 0:
|
if len(p1) == 0 or len(p2) == 0:
|
||||||
self.setPath(QtGui.QPainterPath())
|
self.setPath(QtGui.QPainterPath())
|
||||||
return
|
return
|
||||||
|
@ -117,16 +117,20 @@ class TickSliderItem(GraphicsWidget):
|
|||||||
self.resetTransform()
|
self.resetTransform()
|
||||||
ort = orientation
|
ort = orientation
|
||||||
if ort == 'top':
|
if ort == 'top':
|
||||||
self.scale(1, -1)
|
transform = QtGui.QTransform.fromScale(1, -1)
|
||||||
self.translate(0, -self.height())
|
transform.translate(0, -self.height())
|
||||||
|
self.setTransform(transform)
|
||||||
elif ort == 'left':
|
elif ort == 'left':
|
||||||
self.rotate(270)
|
transform = QtGui.QTransform()
|
||||||
self.scale(1, -1)
|
transform.rotate(270)
|
||||||
self.translate(-self.height(), -self.maxDim)
|
transform.scale(1, -1)
|
||||||
|
transform.translate(-self.height(), -self.maxDim)
|
||||||
|
self.setTransform(transform)
|
||||||
elif ort == 'right':
|
elif ort == 'right':
|
||||||
self.rotate(270)
|
transform = QtGui.QTransform()
|
||||||
self.translate(-self.height(), 0)
|
transform.rotate(270)
|
||||||
#self.setPos(0, -self.height())
|
transform.translate(-self.height(), 0)
|
||||||
|
self.setTransform(transform)
|
||||||
elif ort != 'bottom':
|
elif ort != 'bottom':
|
||||||
raise Exception("%s is not a valid orientation. Options are 'left', 'right', 'top', and 'bottom'" %str(ort))
|
raise Exception("%s is not a valid orientation. Options are 'left', 'right', 'top', and 'bottom'" %str(ort))
|
||||||
|
|
||||||
@ -784,10 +788,14 @@ class GradientEditorItem(TickSliderItem):
|
|||||||
self.sigGradientChangeFinished.emit(self)
|
self.sigGradientChangeFinished.emit(self)
|
||||||
|
|
||||||
|
|
||||||
class Tick(QtGui.QGraphicsObject): ## NOTE: Making this a subclass of GraphicsObject instead results in
|
class Tick(QtGui.QGraphicsWidget): ## NOTE: Making this a subclass of GraphicsObject instead results in
|
||||||
## activating this bug: https://bugreports.qt-project.org/browse/PYSIDE-86
|
## activating this bug: https://bugreports.qt-project.org/browse/PYSIDE-86
|
||||||
## private class
|
## private class
|
||||||
|
|
||||||
|
# When making Tick a subclass of QtGui.QGraphicsObject as origin,
|
||||||
|
# ..GraphicsScene.items(self, *args) will get Tick object as a
|
||||||
|
# class of QtGui.QMultimediaWidgets.QGraphicsVideoItem in python2.7-PyQt5(5.4.0)
|
||||||
|
|
||||||
sigMoving = QtCore.Signal(object)
|
sigMoving = QtCore.Signal(object)
|
||||||
sigMoved = QtCore.Signal(object)
|
sigMoved = QtCore.Signal(object)
|
||||||
|
|
||||||
|
@ -63,7 +63,6 @@ class InfiniteLine(GraphicsObject):
|
|||||||
self.setPen(pen)
|
self.setPen(pen)
|
||||||
self.setHoverPen(color=(255,0,0), width=self.pen.width())
|
self.setHoverPen(color=(255,0,0), width=self.pen.width())
|
||||||
self.currentPen = self.pen
|
self.currentPen = self.pen
|
||||||
#self.setFlag(self.ItemSendsScenePositionChanges)
|
|
||||||
|
|
||||||
def setMovable(self, m):
|
def setMovable(self, m):
|
||||||
"""Set whether the line is movable by the user."""
|
"""Set whether the line is movable by the user."""
|
||||||
@ -193,7 +192,6 @@ class InfiniteLine(GraphicsObject):
|
|||||||
br = self.boundingRect()
|
br = self.boundingRect()
|
||||||
p.setPen(self.currentPen)
|
p.setPen(self.currentPen)
|
||||||
p.drawLine(Point(br.right(), 0), Point(br.left(), 0))
|
p.drawLine(Point(br.right(), 0), Point(br.left(), 0))
|
||||||
#p.drawRect(self.boundingRect())
|
|
||||||
|
|
||||||
def dataBounds(self, axis, frac=1.0, orthoRange=None):
|
def dataBounds(self, axis, frac=1.0, orthoRange=None):
|
||||||
if axis == 0:
|
if axis == 0:
|
||||||
@ -212,15 +210,11 @@ class InfiniteLine(GraphicsObject):
|
|||||||
if not self.moving:
|
if not self.moving:
|
||||||
return
|
return
|
||||||
|
|
||||||
#pressDelta = self.mapToParent(ev.buttonDownPos()) - Point(self.p)
|
|
||||||
self.setPos(self.cursorOffset + self.mapToParent(ev.pos()))
|
self.setPos(self.cursorOffset + self.mapToParent(ev.pos()))
|
||||||
self.sigDragged.emit(self)
|
self.sigDragged.emit(self)
|
||||||
if ev.isFinish():
|
if ev.isFinish():
|
||||||
self.moving = False
|
self.moving = False
|
||||||
self.sigPositionChangeFinished.emit(self)
|
self.sigPositionChangeFinished.emit(self)
|
||||||
#else:
|
|
||||||
#print ev
|
|
||||||
|
|
||||||
|
|
||||||
def mouseClickEvent(self, ev):
|
def mouseClickEvent(self, ev):
|
||||||
if self.moving and ev.button() == QtCore.Qt.RightButton:
|
if self.moving and ev.button() == QtCore.Qt.RightButton:
|
||||||
@ -246,30 +240,3 @@ class InfiniteLine(GraphicsObject):
|
|||||||
else:
|
else:
|
||||||
self.currentPen = self.pen
|
self.currentPen = self.pen
|
||||||
self.update()
|
self.update()
|
||||||
|
|
||||||
#def hoverEnterEvent(self, ev):
|
|
||||||
#print "line hover enter"
|
|
||||||
#ev.ignore()
|
|
||||||
#self.updateHoverPen()
|
|
||||||
|
|
||||||
#def hoverMoveEvent(self, ev):
|
|
||||||
#print "line hover move"
|
|
||||||
#ev.ignore()
|
|
||||||
#self.updateHoverPen()
|
|
||||||
|
|
||||||
#def hoverLeaveEvent(self, ev):
|
|
||||||
#print "line hover leave"
|
|
||||||
#ev.ignore()
|
|
||||||
#self.updateHoverPen(False)
|
|
||||||
|
|
||||||
#def updateHoverPen(self, hover=None):
|
|
||||||
#if hover is None:
|
|
||||||
#scene = self.scene()
|
|
||||||
#hover = scene.claimEvent(self, QtCore.Qt.LeftButton, scene.Drag)
|
|
||||||
|
|
||||||
#if hover:
|
|
||||||
#self.currentPen = fn.mkPen(255, 0,0)
|
|
||||||
#else:
|
|
||||||
#self.currentPen = self.pen
|
|
||||||
#self.update()
|
|
||||||
|
|
||||||
|
@ -16,14 +16,16 @@ This class is very heavily featured:
|
|||||||
- Control panel with a huge feature set including averaging, decimation,
|
- Control panel with a huge feature set including averaging, decimation,
|
||||||
display, power spectrum, svg/png export, plot linking, and more.
|
display, power spectrum, svg/png export, plot linking, and more.
|
||||||
"""
|
"""
|
||||||
from ...Qt import QtGui, QtCore, QtSvg, USE_PYSIDE
|
from ...Qt import QtGui, QtCore, QT_LIB
|
||||||
from ... import pixmaps
|
from ... import pixmaps
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
if USE_PYSIDE:
|
if QT_LIB == 'PyQt4':
|
||||||
from .plotConfigTemplate_pyside import *
|
|
||||||
else:
|
|
||||||
from .plotConfigTemplate_pyqt import *
|
from .plotConfigTemplate_pyqt import *
|
||||||
|
elif QT_LIB == 'PySide':
|
||||||
|
from .plotConfigTemplate_pyside import *
|
||||||
|
elif QT_LIB == 'PyQt5':
|
||||||
|
from .plotConfigTemplate_pyqt5 import *
|
||||||
|
|
||||||
from ... import functions as fn
|
from ... import functions as fn
|
||||||
from ...widgets.FileDialog import FileDialog
|
from ...widgets.FileDialog import FileDialog
|
||||||
@ -787,42 +789,9 @@ class PlotItem(GraphicsWidget):
|
|||||||
fileName = str(fileName)
|
fileName = str(fileName)
|
||||||
PlotItem.lastFileDir = os.path.dirname(fileName)
|
PlotItem.lastFileDir = os.path.dirname(fileName)
|
||||||
|
|
||||||
self.svg = QtSvg.QSvgGenerator()
|
from ...exporters import SVGExporter
|
||||||
self.svg.setFileName(fileName)
|
ex = SVGExporter(self)
|
||||||
res = 120.
|
ex.export(fileName)
|
||||||
view = self.scene().views()[0]
|
|
||||||
bounds = view.viewport().rect()
|
|
||||||
bounds = QtCore.QRectF(0, 0, bounds.width(), bounds.height())
|
|
||||||
|
|
||||||
self.svg.setResolution(res)
|
|
||||||
self.svg.setViewBox(bounds)
|
|
||||||
|
|
||||||
self.svg.setSize(QtCore.QSize(bounds.width(), bounds.height()))
|
|
||||||
|
|
||||||
painter = QtGui.QPainter(self.svg)
|
|
||||||
view.render(painter, bounds)
|
|
||||||
|
|
||||||
painter.end()
|
|
||||||
|
|
||||||
## Workaround to set pen widths correctly
|
|
||||||
import re
|
|
||||||
data = open(fileName).readlines()
|
|
||||||
for i in range(len(data)):
|
|
||||||
line = data[i]
|
|
||||||
m = re.match(r'(<g .*)stroke-width="1"(.*transform="matrix\(([^\)]+)\)".*)', line)
|
|
||||||
if m is not None:
|
|
||||||
#print "Matched group:", line
|
|
||||||
g = m.groups()
|
|
||||||
matrix = list(map(float, g[2].split(',')))
|
|
||||||
#print "matrix:", matrix
|
|
||||||
scale = max(abs(matrix[0]), abs(matrix[3]))
|
|
||||||
if scale == 0 or scale == 1.0:
|
|
||||||
continue
|
|
||||||
data[i] = g[0] + ' stroke-width="%0.2g" ' % (1.0/scale) + g[1] + '\n'
|
|
||||||
#print "old line:", line
|
|
||||||
#print "new line:", data[i]
|
|
||||||
open(fileName, 'w').write(''.join(data))
|
|
||||||
|
|
||||||
|
|
||||||
def writeImage(self, fileName=None):
|
def writeImage(self, fileName=None):
|
||||||
if fileName is None:
|
if fileName is None:
|
||||||
|
169
pyqtgraph/graphicsItems/PlotItem/plotConfigTemplate_pyqt5.py
Normal file
169
pyqtgraph/graphicsItems/PlotItem/plotConfigTemplate_pyqt5.py
Normal file
@ -0,0 +1,169 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Form implementation generated from reading ui file './pyqtgraph/graphicsItems/PlotItem/plotConfigTemplate.ui'
|
||||||
|
#
|
||||||
|
# Created: Wed Mar 26 15:09:28 2014
|
||||||
|
# by: PyQt5 UI code generator 5.0.1
|
||||||
|
#
|
||||||
|
# WARNING! All changes made in this file will be lost!
|
||||||
|
|
||||||
|
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||||
|
|
||||||
|
class Ui_Form(object):
|
||||||
|
def setupUi(self, Form):
|
||||||
|
Form.setObjectName("Form")
|
||||||
|
Form.resize(481, 840)
|
||||||
|
self.averageGroup = QtWidgets.QGroupBox(Form)
|
||||||
|
self.averageGroup.setGeometry(QtCore.QRect(0, 640, 242, 182))
|
||||||
|
self.averageGroup.setCheckable(True)
|
||||||
|
self.averageGroup.setChecked(False)
|
||||||
|
self.averageGroup.setObjectName("averageGroup")
|
||||||
|
self.gridLayout_5 = QtWidgets.QGridLayout(self.averageGroup)
|
||||||
|
self.gridLayout_5.setContentsMargins(0, 0, 0, 0)
|
||||||
|
self.gridLayout_5.setSpacing(0)
|
||||||
|
self.gridLayout_5.setObjectName("gridLayout_5")
|
||||||
|
self.avgParamList = QtWidgets.QListWidget(self.averageGroup)
|
||||||
|
self.avgParamList.setObjectName("avgParamList")
|
||||||
|
self.gridLayout_5.addWidget(self.avgParamList, 0, 0, 1, 1)
|
||||||
|
self.decimateGroup = QtWidgets.QFrame(Form)
|
||||||
|
self.decimateGroup.setGeometry(QtCore.QRect(10, 140, 191, 171))
|
||||||
|
self.decimateGroup.setObjectName("decimateGroup")
|
||||||
|
self.gridLayout_4 = QtWidgets.QGridLayout(self.decimateGroup)
|
||||||
|
self.gridLayout_4.setContentsMargins(0, 0, 0, 0)
|
||||||
|
self.gridLayout_4.setSpacing(0)
|
||||||
|
self.gridLayout_4.setObjectName("gridLayout_4")
|
||||||
|
self.clipToViewCheck = QtWidgets.QCheckBox(self.decimateGroup)
|
||||||
|
self.clipToViewCheck.setObjectName("clipToViewCheck")
|
||||||
|
self.gridLayout_4.addWidget(self.clipToViewCheck, 7, 0, 1, 3)
|
||||||
|
self.maxTracesCheck = QtWidgets.QCheckBox(self.decimateGroup)
|
||||||
|
self.maxTracesCheck.setObjectName("maxTracesCheck")
|
||||||
|
self.gridLayout_4.addWidget(self.maxTracesCheck, 8, 0, 1, 2)
|
||||||
|
self.downsampleCheck = QtWidgets.QCheckBox(self.decimateGroup)
|
||||||
|
self.downsampleCheck.setObjectName("downsampleCheck")
|
||||||
|
self.gridLayout_4.addWidget(self.downsampleCheck, 0, 0, 1, 3)
|
||||||
|
self.peakRadio = QtWidgets.QRadioButton(self.decimateGroup)
|
||||||
|
self.peakRadio.setChecked(True)
|
||||||
|
self.peakRadio.setObjectName("peakRadio")
|
||||||
|
self.gridLayout_4.addWidget(self.peakRadio, 6, 1, 1, 2)
|
||||||
|
self.maxTracesSpin = QtWidgets.QSpinBox(self.decimateGroup)
|
||||||
|
self.maxTracesSpin.setObjectName("maxTracesSpin")
|
||||||
|
self.gridLayout_4.addWidget(self.maxTracesSpin, 8, 2, 1, 1)
|
||||||
|
self.forgetTracesCheck = QtWidgets.QCheckBox(self.decimateGroup)
|
||||||
|
self.forgetTracesCheck.setObjectName("forgetTracesCheck")
|
||||||
|
self.gridLayout_4.addWidget(self.forgetTracesCheck, 9, 0, 1, 3)
|
||||||
|
self.meanRadio = QtWidgets.QRadioButton(self.decimateGroup)
|
||||||
|
self.meanRadio.setObjectName("meanRadio")
|
||||||
|
self.gridLayout_4.addWidget(self.meanRadio, 3, 1, 1, 2)
|
||||||
|
self.subsampleRadio = QtWidgets.QRadioButton(self.decimateGroup)
|
||||||
|
self.subsampleRadio.setObjectName("subsampleRadio")
|
||||||
|
self.gridLayout_4.addWidget(self.subsampleRadio, 2, 1, 1, 2)
|
||||||
|
self.autoDownsampleCheck = QtWidgets.QCheckBox(self.decimateGroup)
|
||||||
|
self.autoDownsampleCheck.setChecked(True)
|
||||||
|
self.autoDownsampleCheck.setObjectName("autoDownsampleCheck")
|
||||||
|
self.gridLayout_4.addWidget(self.autoDownsampleCheck, 1, 2, 1, 1)
|
||||||
|
spacerItem = QtWidgets.QSpacerItem(30, 20, QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Minimum)
|
||||||
|
self.gridLayout_4.addItem(spacerItem, 2, 0, 1, 1)
|
||||||
|
self.downsampleSpin = QtWidgets.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, 1, 1, 1, 1)
|
||||||
|
self.transformGroup = QtWidgets.QFrame(Form)
|
||||||
|
self.transformGroup.setGeometry(QtCore.QRect(0, 0, 154, 79))
|
||||||
|
self.transformGroup.setObjectName("transformGroup")
|
||||||
|
self.gridLayout = QtWidgets.QGridLayout(self.transformGroup)
|
||||||
|
self.gridLayout.setObjectName("gridLayout")
|
||||||
|
self.fftCheck = QtWidgets.QCheckBox(self.transformGroup)
|
||||||
|
self.fftCheck.setObjectName("fftCheck")
|
||||||
|
self.gridLayout.addWidget(self.fftCheck, 0, 0, 1, 1)
|
||||||
|
self.logXCheck = QtWidgets.QCheckBox(self.transformGroup)
|
||||||
|
self.logXCheck.setObjectName("logXCheck")
|
||||||
|
self.gridLayout.addWidget(self.logXCheck, 1, 0, 1, 1)
|
||||||
|
self.logYCheck = QtWidgets.QCheckBox(self.transformGroup)
|
||||||
|
self.logYCheck.setObjectName("logYCheck")
|
||||||
|
self.gridLayout.addWidget(self.logYCheck, 2, 0, 1, 1)
|
||||||
|
self.pointsGroup = QtWidgets.QGroupBox(Form)
|
||||||
|
self.pointsGroup.setGeometry(QtCore.QRect(10, 550, 234, 58))
|
||||||
|
self.pointsGroup.setCheckable(True)
|
||||||
|
self.pointsGroup.setObjectName("pointsGroup")
|
||||||
|
self.verticalLayout_5 = QtWidgets.QVBoxLayout(self.pointsGroup)
|
||||||
|
self.verticalLayout_5.setObjectName("verticalLayout_5")
|
||||||
|
self.autoPointsCheck = QtWidgets.QCheckBox(self.pointsGroup)
|
||||||
|
self.autoPointsCheck.setChecked(True)
|
||||||
|
self.autoPointsCheck.setObjectName("autoPointsCheck")
|
||||||
|
self.verticalLayout_5.addWidget(self.autoPointsCheck)
|
||||||
|
self.gridGroup = QtWidgets.QFrame(Form)
|
||||||
|
self.gridGroup.setGeometry(QtCore.QRect(10, 460, 221, 81))
|
||||||
|
self.gridGroup.setObjectName("gridGroup")
|
||||||
|
self.gridLayout_2 = QtWidgets.QGridLayout(self.gridGroup)
|
||||||
|
self.gridLayout_2.setObjectName("gridLayout_2")
|
||||||
|
self.xGridCheck = QtWidgets.QCheckBox(self.gridGroup)
|
||||||
|
self.xGridCheck.setObjectName("xGridCheck")
|
||||||
|
self.gridLayout_2.addWidget(self.xGridCheck, 0, 0, 1, 2)
|
||||||
|
self.yGridCheck = QtWidgets.QCheckBox(self.gridGroup)
|
||||||
|
self.yGridCheck.setObjectName("yGridCheck")
|
||||||
|
self.gridLayout_2.addWidget(self.yGridCheck, 1, 0, 1, 2)
|
||||||
|
self.gridAlphaSlider = QtWidgets.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 = QtWidgets.QLabel(self.gridGroup)
|
||||||
|
self.label.setObjectName("label")
|
||||||
|
self.gridLayout_2.addWidget(self.label, 2, 0, 1, 1)
|
||||||
|
self.alphaGroup = QtWidgets.QGroupBox(Form)
|
||||||
|
self.alphaGroup.setGeometry(QtCore.QRect(10, 390, 234, 60))
|
||||||
|
self.alphaGroup.setCheckable(True)
|
||||||
|
self.alphaGroup.setObjectName("alphaGroup")
|
||||||
|
self.horizontalLayout = QtWidgets.QHBoxLayout(self.alphaGroup)
|
||||||
|
self.horizontalLayout.setObjectName("horizontalLayout")
|
||||||
|
self.autoAlphaCheck = QtWidgets.QCheckBox(self.alphaGroup)
|
||||||
|
self.autoAlphaCheck.setChecked(False)
|
||||||
|
self.autoAlphaCheck.setObjectName("autoAlphaCheck")
|
||||||
|
self.horizontalLayout.addWidget(self.autoAlphaCheck)
|
||||||
|
self.alphaSlider = QtWidgets.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):
|
||||||
|
_translate = QtCore.QCoreApplication.translate
|
||||||
|
Form.setWindowTitle(_translate("Form", "Form"))
|
||||||
|
self.averageGroup.setToolTip(_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)."))
|
||||||
|
self.averageGroup.setTitle(_translate("Form", "Average"))
|
||||||
|
self.clipToViewCheck.setToolTip(_translate("Form", "Plot only the portion of each curve that is visible. This assumes X values are uniformly spaced."))
|
||||||
|
self.clipToViewCheck.setText(_translate("Form", "Clip to View"))
|
||||||
|
self.maxTracesCheck.setToolTip(_translate("Form", "If multiple curves are displayed in this plot, check this box to limit the number of traces that are displayed."))
|
||||||
|
self.maxTracesCheck.setText(_translate("Form", "Max Traces:"))
|
||||||
|
self.downsampleCheck.setText(_translate("Form", "Downsample"))
|
||||||
|
self.peakRadio.setToolTip(_translate("Form", "Downsample by drawing a saw wave that follows the min and max of the original data. This method produces the best visual representation of the data but is slower."))
|
||||||
|
self.peakRadio.setText(_translate("Form", "Peak"))
|
||||||
|
self.maxTracesSpin.setToolTip(_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."))
|
||||||
|
self.forgetTracesCheck.setToolTip(_translate("Form", "If MaxTraces is checked, remove curves from memory after they are hidden (saves memory, but traces can not be un-hidden)."))
|
||||||
|
self.forgetTracesCheck.setText(_translate("Form", "Forget hidden traces"))
|
||||||
|
self.meanRadio.setToolTip(_translate("Form", "Downsample by taking the mean of N samples."))
|
||||||
|
self.meanRadio.setText(_translate("Form", "Mean"))
|
||||||
|
self.subsampleRadio.setToolTip(_translate("Form", "Downsample by taking the first of N samples. This method is fastest and least accurate."))
|
||||||
|
self.subsampleRadio.setText(_translate("Form", "Subsample"))
|
||||||
|
self.autoDownsampleCheck.setToolTip(_translate("Form", "Automatically downsample data based on the visible range. This assumes X values are uniformly spaced."))
|
||||||
|
self.autoDownsampleCheck.setText(_translate("Form", "Auto"))
|
||||||
|
self.downsampleSpin.setToolTip(_translate("Form", "Downsample data before plotting. (plot every Nth sample)"))
|
||||||
|
self.downsampleSpin.setSuffix(_translate("Form", "x"))
|
||||||
|
self.fftCheck.setText(_translate("Form", "Power Spectrum (FFT)"))
|
||||||
|
self.logXCheck.setText(_translate("Form", "Log X"))
|
||||||
|
self.logYCheck.setText(_translate("Form", "Log Y"))
|
||||||
|
self.pointsGroup.setTitle(_translate("Form", "Points"))
|
||||||
|
self.autoPointsCheck.setText(_translate("Form", "Auto"))
|
||||||
|
self.xGridCheck.setText(_translate("Form", "Show X Grid"))
|
||||||
|
self.yGridCheck.setText(_translate("Form", "Show Y Grid"))
|
||||||
|
self.label.setText(_translate("Form", "Opacity"))
|
||||||
|
self.alphaGroup.setTitle(_translate("Form", "Alpha"))
|
||||||
|
self.autoAlphaCheck.setText(_translate("Form", "Auto"))
|
||||||
|
|
@ -1020,7 +1020,7 @@ class ROI(GraphicsObject):
|
|||||||
#print " dataBounds:", dataBounds
|
#print " dataBounds:", dataBounds
|
||||||
|
|
||||||
## Intersect transformed ROI bounds with data bounds
|
## Intersect transformed ROI bounds with data bounds
|
||||||
intBounds = dataBounds.intersect(QtCore.QRectF(0, 0, dShape[0], dShape[1]))
|
intBounds = dataBounds.intersected(QtCore.QRectF(0, 0, dShape[0], dShape[1]))
|
||||||
#print " intBounds:", intBounds
|
#print " intBounds:", intBounds
|
||||||
|
|
||||||
## Determine index values to use when referencing the array.
|
## Determine index values to use when referencing the array.
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
from ..Qt import QtGui, QtCore, USE_PYSIDE
|
from ..Qt import QtGui, QtCore, USE_PYSIDE, USE_PYQT5
|
||||||
from ..Point import Point
|
from ..Point import Point
|
||||||
from .. import functions as fn
|
from .. import functions as fn
|
||||||
from .GraphicsItem import GraphicsItem
|
from .GraphicsItem import GraphicsItem
|
||||||
@ -758,7 +758,7 @@ class ScatterPlotItem(GraphicsObject):
|
|||||||
self.data['targetRect'][updateMask] = list(imap(QtCore.QRectF, updatePts[0,:], updatePts[1,:], width, width))
|
self.data['targetRect'][updateMask] = list(imap(QtCore.QRectF, updatePts[0,:], updatePts[1,:], width, width))
|
||||||
|
|
||||||
data = self.data[viewMask]
|
data = self.data[viewMask]
|
||||||
if USE_PYSIDE:
|
if USE_PYSIDE or USE_PYQT5:
|
||||||
list(imap(p.drawPixmap, data['targetRect'], repeat(atlas), data['sourceRect']))
|
list(imap(p.drawPixmap, data['targetRect'], repeat(atlas), data['sourceRect']))
|
||||||
else:
|
else:
|
||||||
p.drawPixmapFragments(data['targetRect'].tolist(), data['sourceRect'].tolist(), atlas)
|
p.drawPixmapFragments(data['targetRect'].tolist(), data['sourceRect'].tolist(), atlas)
|
||||||
|
@ -1,11 +1,13 @@
|
|||||||
from ...Qt import QtCore, QtGui, USE_PYSIDE
|
from ...Qt import QtCore, QtGui, QT_LIB
|
||||||
from ...python2_3 import asUnicode
|
from ...python2_3 import asUnicode
|
||||||
from ...WidgetGroup import WidgetGroup
|
from ...WidgetGroup import WidgetGroup
|
||||||
|
|
||||||
if USE_PYSIDE:
|
if QT_LIB == 'PyQt4':
|
||||||
from .axisCtrlTemplate_pyside import Ui_Form as AxisCtrlTemplate
|
|
||||||
else:
|
|
||||||
from .axisCtrlTemplate_pyqt import Ui_Form as AxisCtrlTemplate
|
from .axisCtrlTemplate_pyqt import Ui_Form as AxisCtrlTemplate
|
||||||
|
elif QT_LIB == 'PySide':
|
||||||
|
from .axisCtrlTemplate_pyside import Ui_Form as AxisCtrlTemplate
|
||||||
|
elif QT_LIB == 'PyQt5':
|
||||||
|
from .axisCtrlTemplate_pyqt5 import Ui_Form as AxisCtrlTemplate
|
||||||
|
|
||||||
import weakref
|
import weakref
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
#
|
#
|
||||||
# WARNING! All changes made in this file will be lost!
|
# WARNING! All changes made in this file will be lost!
|
||||||
|
|
||||||
from PyQt4 import QtCore, QtGui
|
from ...Qt import QtCore, QtGui
|
||||||
|
|
||||||
try:
|
try:
|
||||||
_fromUtf8 = QtCore.QString.fromUtf8
|
_fromUtf8 = QtCore.QString.fromUtf8
|
||||||
|
89
pyqtgraph/graphicsItems/ViewBox/axisCtrlTemplate_pyqt5.py
Normal file
89
pyqtgraph/graphicsItems/ViewBox/axisCtrlTemplate_pyqt5.py
Normal file
@ -0,0 +1,89 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Form implementation generated from reading ui file './pyqtgraph/graphicsItems/ViewBox/axisCtrlTemplate.ui'
|
||||||
|
#
|
||||||
|
# Created: Wed Mar 26 15:09:28 2014
|
||||||
|
# by: PyQt5 UI code generator 5.0.1
|
||||||
|
#
|
||||||
|
# WARNING! All changes made in this file will be lost!
|
||||||
|
|
||||||
|
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||||
|
|
||||||
|
class Ui_Form(object):
|
||||||
|
def setupUi(self, Form):
|
||||||
|
Form.setObjectName("Form")
|
||||||
|
Form.resize(186, 154)
|
||||||
|
Form.setMaximumSize(QtCore.QSize(200, 16777215))
|
||||||
|
self.gridLayout = QtWidgets.QGridLayout(Form)
|
||||||
|
self.gridLayout.setContentsMargins(0, 0, 0, 0)
|
||||||
|
self.gridLayout.setSpacing(0)
|
||||||
|
self.gridLayout.setObjectName("gridLayout")
|
||||||
|
self.label = QtWidgets.QLabel(Form)
|
||||||
|
self.label.setObjectName("label")
|
||||||
|
self.gridLayout.addWidget(self.label, 7, 0, 1, 2)
|
||||||
|
self.linkCombo = QtWidgets.QComboBox(Form)
|
||||||
|
self.linkCombo.setSizeAdjustPolicy(QtWidgets.QComboBox.AdjustToContents)
|
||||||
|
self.linkCombo.setObjectName("linkCombo")
|
||||||
|
self.gridLayout.addWidget(self.linkCombo, 7, 2, 1, 2)
|
||||||
|
self.autoPercentSpin = QtWidgets.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 = QtWidgets.QRadioButton(Form)
|
||||||
|
self.autoRadio.setChecked(True)
|
||||||
|
self.autoRadio.setObjectName("autoRadio")
|
||||||
|
self.gridLayout.addWidget(self.autoRadio, 2, 0, 1, 2)
|
||||||
|
self.manualRadio = QtWidgets.QRadioButton(Form)
|
||||||
|
self.manualRadio.setObjectName("manualRadio")
|
||||||
|
self.gridLayout.addWidget(self.manualRadio, 1, 0, 1, 2)
|
||||||
|
self.minText = QtWidgets.QLineEdit(Form)
|
||||||
|
self.minText.setObjectName("minText")
|
||||||
|
self.gridLayout.addWidget(self.minText, 1, 2, 1, 1)
|
||||||
|
self.maxText = QtWidgets.QLineEdit(Form)
|
||||||
|
self.maxText.setObjectName("maxText")
|
||||||
|
self.gridLayout.addWidget(self.maxText, 1, 3, 1, 1)
|
||||||
|
self.invertCheck = QtWidgets.QCheckBox(Form)
|
||||||
|
self.invertCheck.setObjectName("invertCheck")
|
||||||
|
self.gridLayout.addWidget(self.invertCheck, 5, 0, 1, 4)
|
||||||
|
self.mouseCheck = QtWidgets.QCheckBox(Form)
|
||||||
|
self.mouseCheck.setChecked(True)
|
||||||
|
self.mouseCheck.setObjectName("mouseCheck")
|
||||||
|
self.gridLayout.addWidget(self.mouseCheck, 6, 0, 1, 4)
|
||||||
|
self.visibleOnlyCheck = QtWidgets.QCheckBox(Form)
|
||||||
|
self.visibleOnlyCheck.setObjectName("visibleOnlyCheck")
|
||||||
|
self.gridLayout.addWidget(self.visibleOnlyCheck, 3, 2, 1, 2)
|
||||||
|
self.autoPanCheck = QtWidgets.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):
|
||||||
|
_translate = QtCore.QCoreApplication.translate
|
||||||
|
Form.setWindowTitle(_translate("Form", "Form"))
|
||||||
|
self.label.setText(_translate("Form", "Link Axis:"))
|
||||||
|
self.linkCombo.setToolTip(_translate("Form", "<html><head/><body><p>Links this axis with another view. When linked, both views will display the same data range.</p></body></html>"))
|
||||||
|
self.autoPercentSpin.setToolTip(_translate("Form", "<html><head/><body><p>Percent of data to be visible when auto-scaling. It may be useful to decrease this value for data with spiky noise.</p></body></html>"))
|
||||||
|
self.autoPercentSpin.setSuffix(_translate("Form", "%"))
|
||||||
|
self.autoRadio.setToolTip(_translate("Form", "<html><head/><body><p>Automatically resize this axis whenever the displayed data is changed.</p></body></html>"))
|
||||||
|
self.autoRadio.setText(_translate("Form", "Auto"))
|
||||||
|
self.manualRadio.setToolTip(_translate("Form", "<html><head/><body><p>Set the range for this axis manually. This disables automatic scaling. </p></body></html>"))
|
||||||
|
self.manualRadio.setText(_translate("Form", "Manual"))
|
||||||
|
self.minText.setToolTip(_translate("Form", "<html><head/><body><p>Minimum value to display for this axis.</p></body></html>"))
|
||||||
|
self.minText.setText(_translate("Form", "0"))
|
||||||
|
self.maxText.setToolTip(_translate("Form", "<html><head/><body><p>Maximum value to display for this axis.</p></body></html>"))
|
||||||
|
self.maxText.setText(_translate("Form", "0"))
|
||||||
|
self.invertCheck.setToolTip(_translate("Form", "<html><head/><body><p>Inverts the display of this axis. (+y points downward instead of upward)</p></body></html>"))
|
||||||
|
self.invertCheck.setText(_translate("Form", "Invert Axis"))
|
||||||
|
self.mouseCheck.setToolTip(_translate("Form", "<html><head/><body><p>Enables mouse interaction (panning, scaling) for this axis.</p></body></html>"))
|
||||||
|
self.mouseCheck.setText(_translate("Form", "Mouse Enabled"))
|
||||||
|
self.visibleOnlyCheck.setToolTip(_translate("Form", "<html><head/><body><p>When checked, the axis will only auto-scale to data that is visible along the orthogonal axis.</p></body></html>"))
|
||||||
|
self.visibleOnlyCheck.setText(_translate("Form", "Visible Data Only"))
|
||||||
|
self.autoPanCheck.setToolTip(_translate("Form", "<html><head/><body><p>When checked, the axis will automatically pan to center on the current data, but the scale along this axis will not change.</p></body></html>"))
|
||||||
|
self.autoPanCheck.setText(_translate("Form", "Auto Pan Only"))
|
||||||
|
|
@ -12,7 +12,7 @@ Widget used for displaying 2D or 3D data. Features:
|
|||||||
- ROI plotting
|
- ROI plotting
|
||||||
- Image normalization through a variety of methods
|
- Image normalization through a variety of methods
|
||||||
"""
|
"""
|
||||||
import os, sys
|
import os
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
from ..Qt import QtCore, QtGui, USE_PYSIDE
|
from ..Qt import QtCore, QtGui, USE_PYSIDE
|
||||||
@ -145,13 +145,13 @@ class ImageView(QtGui.QWidget):
|
|||||||
self.view.addItem(self.roi)
|
self.view.addItem(self.roi)
|
||||||
self.roi.hide()
|
self.roi.hide()
|
||||||
self.normRoi = PlotROI(10)
|
self.normRoi = PlotROI(10)
|
||||||
self.normRoi.setPen(QtGui.QPen(QtGui.QColor(255,255,0)))
|
self.normRoi.setPen('y')
|
||||||
self.normRoi.setZValue(20)
|
self.normRoi.setZValue(20)
|
||||||
self.view.addItem(self.normRoi)
|
self.view.addItem(self.normRoi)
|
||||||
self.normRoi.hide()
|
self.normRoi.hide()
|
||||||
self.roiCurve = self.ui.roiPlot.plot()
|
self.roiCurve = self.ui.roiPlot.plot()
|
||||||
self.timeLine = InfiniteLine(0, movable=True)
|
self.timeLine = InfiniteLine(0, movable=True)
|
||||||
self.timeLine.setPen(QtGui.QPen(QtGui.QColor(255, 255, 0, 200)))
|
self.timeLine.setPen((255, 255, 0, 200))
|
||||||
self.timeLine.setZValue(1)
|
self.timeLine.setZValue(1)
|
||||||
self.ui.roiPlot.addItem(self.timeLine)
|
self.ui.roiPlot.addItem(self.timeLine)
|
||||||
self.ui.splitter.setSizes([self.height()-35, 35])
|
self.ui.splitter.setSizes([self.height()-35, 35])
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
#
|
#
|
||||||
# WARNING! All changes made in this file will be lost!
|
# WARNING! All changes made in this file will be lost!
|
||||||
|
|
||||||
from PyQt4 import QtCore, QtGui
|
from ..Qt import QtCore, QtGui
|
||||||
|
|
||||||
try:
|
try:
|
||||||
_fromUtf8 = QtCore.QString.fromUtf8
|
_fromUtf8 = QtCore.QString.fromUtf8
|
||||||
|
156
pyqtgraph/imageview/ImageViewTemplate_pyqt5.py
Normal file
156
pyqtgraph/imageview/ImageViewTemplate_pyqt5.py
Normal file
@ -0,0 +1,156 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Form implementation generated from reading ui file './pyqtgraph/imageview/ImageViewTemplate.ui'
|
||||||
|
#
|
||||||
|
# Created: Wed Mar 26 15:09:28 2014
|
||||||
|
# by: PyQt5 UI code generator 5.0.1
|
||||||
|
#
|
||||||
|
# WARNING! All changes made in this file will be lost!
|
||||||
|
|
||||||
|
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||||
|
|
||||||
|
class Ui_Form(object):
|
||||||
|
def setupUi(self, Form):
|
||||||
|
Form.setObjectName("Form")
|
||||||
|
Form.resize(726, 588)
|
||||||
|
self.gridLayout_3 = QtWidgets.QGridLayout(Form)
|
||||||
|
self.gridLayout_3.setContentsMargins(0, 0, 0, 0)
|
||||||
|
self.gridLayout_3.setSpacing(0)
|
||||||
|
self.gridLayout_3.setObjectName("gridLayout_3")
|
||||||
|
self.splitter = QtWidgets.QSplitter(Form)
|
||||||
|
self.splitter.setOrientation(QtCore.Qt.Vertical)
|
||||||
|
self.splitter.setObjectName("splitter")
|
||||||
|
self.layoutWidget = QtWidgets.QWidget(self.splitter)
|
||||||
|
self.layoutWidget.setObjectName("layoutWidget")
|
||||||
|
self.gridLayout = QtWidgets.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 = QtWidgets.QPushButton(self.layoutWidget)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.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 = QtWidgets.QPushButton(self.layoutWidget)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.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 = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.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 = QtWidgets.QGroupBox(Form)
|
||||||
|
self.normGroup.setObjectName("normGroup")
|
||||||
|
self.gridLayout_2 = QtWidgets.QGridLayout(self.normGroup)
|
||||||
|
self.gridLayout_2.setContentsMargins(0, 0, 0, 0)
|
||||||
|
self.gridLayout_2.setSpacing(0)
|
||||||
|
self.gridLayout_2.setObjectName("gridLayout_2")
|
||||||
|
self.normSubtractRadio = QtWidgets.QRadioButton(self.normGroup)
|
||||||
|
self.normSubtractRadio.setObjectName("normSubtractRadio")
|
||||||
|
self.gridLayout_2.addWidget(self.normSubtractRadio, 0, 2, 1, 1)
|
||||||
|
self.normDivideRadio = QtWidgets.QRadioButton(self.normGroup)
|
||||||
|
self.normDivideRadio.setChecked(False)
|
||||||
|
self.normDivideRadio.setObjectName("normDivideRadio")
|
||||||
|
self.gridLayout_2.addWidget(self.normDivideRadio, 0, 1, 1, 1)
|
||||||
|
self.label_5 = QtWidgets.QLabel(self.normGroup)
|
||||||
|
font = QtGui.QFont()
|
||||||
|
font.setBold(True)
|
||||||
|
font.setWeight(75)
|
||||||
|
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 = QtWidgets.QLabel(self.normGroup)
|
||||||
|
font = QtGui.QFont()
|
||||||
|
font.setBold(True)
|
||||||
|
font.setWeight(75)
|
||||||
|
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 = QtWidgets.QLabel(self.normGroup)
|
||||||
|
font = QtGui.QFont()
|
||||||
|
font.setBold(True)
|
||||||
|
font.setWeight(75)
|
||||||
|
self.label_4.setFont(font)
|
||||||
|
self.label_4.setObjectName("label_4")
|
||||||
|
self.gridLayout_2.addWidget(self.label_4, 2, 0, 1, 1)
|
||||||
|
self.normROICheck = QtWidgets.QCheckBox(self.normGroup)
|
||||||
|
self.normROICheck.setObjectName("normROICheck")
|
||||||
|
self.gridLayout_2.addWidget(self.normROICheck, 1, 1, 1, 1)
|
||||||
|
self.normXBlurSpin = QtWidgets.QDoubleSpinBox(self.normGroup)
|
||||||
|
self.normXBlurSpin.setObjectName("normXBlurSpin")
|
||||||
|
self.gridLayout_2.addWidget(self.normXBlurSpin, 2, 2, 1, 1)
|
||||||
|
self.label_8 = QtWidgets.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 = QtWidgets.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 = QtWidgets.QDoubleSpinBox(self.normGroup)
|
||||||
|
self.normYBlurSpin.setObjectName("normYBlurSpin")
|
||||||
|
self.gridLayout_2.addWidget(self.normYBlurSpin, 2, 4, 1, 1)
|
||||||
|
self.label_10 = QtWidgets.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 = QtWidgets.QRadioButton(self.normGroup)
|
||||||
|
self.normOffRadio.setChecked(True)
|
||||||
|
self.normOffRadio.setObjectName("normOffRadio")
|
||||||
|
self.gridLayout_2.addWidget(self.normOffRadio, 0, 3, 1, 1)
|
||||||
|
self.normTimeRangeCheck = QtWidgets.QCheckBox(self.normGroup)
|
||||||
|
self.normTimeRangeCheck.setObjectName("normTimeRangeCheck")
|
||||||
|
self.gridLayout_2.addWidget(self.normTimeRangeCheck, 1, 3, 1, 1)
|
||||||
|
self.normFrameCheck = QtWidgets.QCheckBox(self.normGroup)
|
||||||
|
self.normFrameCheck.setObjectName("normFrameCheck")
|
||||||
|
self.gridLayout_2.addWidget(self.normFrameCheck, 1, 2, 1, 1)
|
||||||
|
self.normTBlurSpin = QtWidgets.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):
|
||||||
|
_translate = QtCore.QCoreApplication.translate
|
||||||
|
Form.setWindowTitle(_translate("Form", "Form"))
|
||||||
|
self.roiBtn.setText(_translate("Form", "ROI"))
|
||||||
|
self.normBtn.setText(_translate("Form", "Norm"))
|
||||||
|
self.normGroup.setTitle(_translate("Form", "Normalization"))
|
||||||
|
self.normSubtractRadio.setText(_translate("Form", "Subtract"))
|
||||||
|
self.normDivideRadio.setText(_translate("Form", "Divide"))
|
||||||
|
self.label_5.setText(_translate("Form", "Operation:"))
|
||||||
|
self.label_3.setText(_translate("Form", "Mean:"))
|
||||||
|
self.label_4.setText(_translate("Form", "Blur:"))
|
||||||
|
self.normROICheck.setText(_translate("Form", "ROI"))
|
||||||
|
self.label_8.setText(_translate("Form", "X"))
|
||||||
|
self.label_9.setText(_translate("Form", "Y"))
|
||||||
|
self.label_10.setText(_translate("Form", "T"))
|
||||||
|
self.normOffRadio.setText(_translate("Form", "Off"))
|
||||||
|
self.normTimeRangeCheck.setText(_translate("Form", "Time range"))
|
||||||
|
self.normFrameCheck.setText(_translate("Form", "Frame"))
|
||||||
|
|
||||||
|
from ..widgets.HistogramLUTWidget import HistogramLUTWidget
|
||||||
|
from ..widgets.PlotWidget import PlotWidget
|
||||||
|
from ..widgets.GraphicsView import GraphicsView
|
@ -1,4 +1,4 @@
|
|||||||
from ..Qt import QtCore, QtGui, QtOpenGL
|
from ..Qt import QtCore, QtGui, QtOpenGL, USE_PYQT5
|
||||||
from OpenGL.GL import *
|
from OpenGL.GL import *
|
||||||
import OpenGL.GL.framebufferobjects as glfbo
|
import OpenGL.GL.framebufferobjects as glfbo
|
||||||
import numpy as np
|
import numpy as np
|
||||||
@ -324,10 +324,17 @@ class GLViewWidget(QtOpenGL.QGLWidget):
|
|||||||
|
|
||||||
|
|
||||||
def wheelEvent(self, ev):
|
def wheelEvent(self, ev):
|
||||||
if (ev.modifiers() & QtCore.Qt.ControlModifier):
|
delta = 0
|
||||||
self.opts['fov'] *= 0.999**ev.delta()
|
if not USE_PYQT5:
|
||||||
|
delta = ev.delta()
|
||||||
else:
|
else:
|
||||||
self.opts['distance'] *= 0.999**ev.delta()
|
delta = ev.angleDelta().x()
|
||||||
|
if delta == 0:
|
||||||
|
delta = ev.angleDelta().y()
|
||||||
|
if (ev.modifiers() & QtCore.Qt.ControlModifier):
|
||||||
|
self.opts['fov'] *= 0.999**delta
|
||||||
|
else:
|
||||||
|
self.opts['distance'] *= 0.999**delta
|
||||||
self.update()
|
self.update()
|
||||||
|
|
||||||
def keyPressEvent(self, ev):
|
def keyPressEvent(self, ev):
|
||||||
|
@ -1,11 +1,16 @@
|
|||||||
from ..Qt import QtGui, QtCore, USE_PYSIDE
|
from ..Qt import QtGui, QtCore, USE_PYSIDE, USE_PYQT5
|
||||||
import matplotlib
|
import matplotlib
|
||||||
|
|
||||||
if USE_PYSIDE:
|
if not USE_PYQT5:
|
||||||
|
if USE_PYSIDE:
|
||||||
matplotlib.rcParams['backend.qt4']='PySide'
|
matplotlib.rcParams['backend.qt4']='PySide'
|
||||||
|
|
||||||
from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas
|
from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas
|
||||||
from matplotlib.backends.backend_qt4agg import NavigationToolbar2QTAgg as NavigationToolbar
|
from matplotlib.backends.backend_qt4agg import NavigationToolbar2QTAgg as NavigationToolbar
|
||||||
|
else:
|
||||||
|
from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas
|
||||||
|
from matplotlib.backends.backend_qt5agg import NavigationToolbar2QT as NavigationToolbar
|
||||||
|
|
||||||
from matplotlib.figure import Figure
|
from matplotlib.figure import Figure
|
||||||
|
|
||||||
class MatplotlibWidget(QtGui.QWidget):
|
class MatplotlibWidget(QtGui.QWidget):
|
||||||
|
2
tools/pyuic5
Executable file
2
tools/pyuic5
Executable file
@ -0,0 +1,2 @@
|
|||||||
|
#!/usr/bin/python3
|
||||||
|
import PyQt5.uic.pyuic
|
@ -4,6 +4,7 @@ import os, sys
|
|||||||
|
|
||||||
pyqtuic = 'pyuic4'
|
pyqtuic = 'pyuic4'
|
||||||
pysideuic = 'pyside-uic'
|
pysideuic = 'pyside-uic'
|
||||||
|
pyqt5uic = 'pyuic5'
|
||||||
|
|
||||||
for path, sd, files in os.walk('.'):
|
for path, sd, files in os.walk('.'):
|
||||||
for f in files:
|
for f in files:
|
||||||
@ -21,3 +22,9 @@ for path, sd, files in os.walk('.'):
|
|||||||
if not os.path.exists(py) or os.stat(ui).st_mtime > os.stat(py).st_mtime:
|
if not os.path.exists(py) or os.stat(ui).st_mtime > os.stat(py).st_mtime:
|
||||||
os.system('%s %s > %s' % (pysideuic, ui, py))
|
os.system('%s %s > %s' % (pysideuic, ui, py))
|
||||||
print(py)
|
print(py)
|
||||||
|
|
||||||
|
py = os.path.join(path, base + '_pyqt5.py')
|
||||||
|
if not os.path.exists(py) or os.stat(ui).st_mtime > os.stat(py).st_mtime:
|
||||||
|
os.system('%s %s > %s' % (pyqt5uic, ui, py))
|
||||||
|
print(py)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user