Merge pull request #558 from acq4/canvas-updates

Clean up canvas codebase
This commit is contained in:
Luke Campagnola 2017-09-13 21:34:07 -07:00 committed by GitHub
commit daedbf68db
6 changed files with 232 additions and 365 deletions

View File

@ -19,9 +19,11 @@ elif QT_LIB == 'PyQt5':
import numpy as np
from .. import debug
import weakref
import gc
from .CanvasManager import CanvasManager
from .CanvasItem import CanvasItem, GroupCanvasItem
class Canvas(QtGui.QWidget):
sigSelectionChanged = QtCore.Signal(object, object)
@ -32,7 +34,6 @@ class Canvas(QtGui.QWidget):
QtGui.QWidget.__init__(self, parent)
self.ui = Ui_Form()
self.ui.setupUi(self)
#self.view = self.ui.view
self.view = ViewBox()
self.ui.view.setCentralItem(self.view)
self.itemList = self.ui.itemList
@ -49,9 +50,7 @@ class Canvas(QtGui.QWidget):
self.redirect = None ## which canvas to redirect items to
self.items = []
#self.view.enableMouse()
self.view.setAspectLocked(True)
#self.view.invertY()
grid = GridItem()
self.grid = CanvasItem(grid, name='Grid', movable=False)
@ -69,8 +68,6 @@ class Canvas(QtGui.QWidget):
self.ui.itemList.sigItemMoved.connect(self.treeItemMoved)
self.ui.itemList.itemSelectionChanged.connect(self.treeItemSelected)
self.ui.autoRangeBtn.clicked.connect(self.autoRange)
#self.ui.storeSvgBtn.clicked.connect(self.storeSvg)
#self.ui.storePngBtn.clicked.connect(self.storePng)
self.ui.redirectCheck.toggled.connect(self.updateRedirect)
self.ui.redirectCombo.currentIndexChanged.connect(self.updateRedirect)
self.multiSelectBox.sigRegionChanged.connect(self.multiSelectBoxChanged)
@ -88,22 +85,12 @@ class Canvas(QtGui.QWidget):
self.ui.redirectCombo.setHostName(self.registeredName)
self.menu = QtGui.QMenu()
#self.menu.setTitle("Image")
remAct = QtGui.QAction("Remove item", self.menu)
remAct.triggered.connect(self.removeClicked)
self.menu.addAction(remAct)
self.menu.remAct = remAct
self.ui.itemList.contextMenuEvent = self.itemListContextMenuEvent
#def storeSvg(self):
#from pyqtgraph.GraphicsScene.exportDialog import ExportDialog
#ex = ExportDialog(self.ui.view)
#ex.show()
#def storePng(self):
#self.ui.view.writeImage()
def splitterMoved(self):
self.resizeEvent()
@ -136,7 +123,6 @@ class Canvas(QtGui.QWidget):
s2 = self.width()-s
self.ui.splitter.setSizes([s2, s])
def updateRedirect(self, *args):
### Decide whether/where to redirect items and make it so
cname = str(self.ui.redirectCombo.currentText())
@ -155,7 +141,6 @@ class Canvas(QtGui.QWidget):
else:
self.redirectItems(redirect)
def redirectItems(self, canvas):
for i in self.items:
if i is self.grid:
@ -172,11 +157,8 @@ class Canvas(QtGui.QWidget):
parent.removeChild(li)
canvas.addItem(i)
def reclaimItems(self):
items = self.items
#self.items = {'Grid': items['Grid']}
#del items['Grid']
self.items = [self.grid]
items.remove(self.grid)
@ -185,9 +167,6 @@ class Canvas(QtGui.QWidget):
self.addItem(i)
def treeItemChanged(self, item, col):
#gi = self.items.get(item.name, None)
#if gi is None:
#return
try:
citem = item.canvasItem()
except AttributeError:
@ -203,25 +182,16 @@ class Canvas(QtGui.QWidget):
def treeItemSelected(self):
sel = self.selectedItems()
#sel = []
#for listItem in self.itemList.selectedItems():
#if hasattr(listItem, 'canvasItem') and listItem.canvasItem is not None:
#sel.append(listItem.canvasItem)
#sel = [self.items[item.name] for item in sel]
if len(sel) == 0:
#self.selectWidget.hide()
return
multi = len(sel) > 1
for i in self.items:
#i.ctrlWidget().hide()
## updated the selected state of every item
i.selectionChanged(i in sel, multi)
if len(sel)==1:
#item = sel[0]
#item.ctrlWidget().show()
self.multiSelectBox.hide()
self.ui.mirrorSelectionBtn.hide()
self.ui.reflectSelectionBtn.hide()
@ -229,14 +199,6 @@ class Canvas(QtGui.QWidget):
elif len(sel) > 1:
self.showMultiSelectBox()
#if item.isMovable():
#self.selectBox.setPos(item.item.pos())
#self.selectBox.setSize(item.item.sceneBoundingRect().size())
#self.selectBox.show()
#else:
#self.selectBox.hide()
#self.emit(QtCore.SIGNAL('itemSelected'), self, item)
self.sigSelectionChanged.emit(self, sel)
def selectedItems(self):
@ -245,20 +207,10 @@ class Canvas(QtGui.QWidget):
"""
return [item.canvasItem() for item in self.itemList.selectedItems() if item.canvasItem() is not None]
#def selectedItem(self):
#sel = self.itemList.selectedItems()
#if sel is None or len(sel) < 1:
#return
#return self.items.get(sel[0].name, None)
def selectItem(self, item):
li = item.listItem
#li = self.getListItem(item.name())
#print "select", li
self.itemList.setCurrentItem(li)
def showMultiSelectBox(self):
## Get list of selected canvas items
items = self.selectedItems()
@ -281,7 +233,6 @@ class Canvas(QtGui.QWidget):
self.ui.mirrorSelectionBtn.show()
self.ui.reflectSelectionBtn.show()
self.ui.resetTransformsBtn.show()
#self.multiSelectBoxBase = self.multiSelectBox.getState().copy()
def mirrorSelectionClicked(self):
for ci in self.selectedItems():
@ -312,7 +263,6 @@ class Canvas(QtGui.QWidget):
ci.setTemporaryTransform(transform)
ci.sigTransformChanged.emit(ci)
def addGraphicsItem(self, item, **opts):
"""Add a new GraphicsItem to the scene at pos.
Common options are name, pos, scale, and z
@ -322,13 +272,11 @@ class Canvas(QtGui.QWidget):
self.addItem(citem)
return citem
def addGroup(self, name, **kargs):
group = GroupCanvasItem(name=name)
self.addItem(group, **kargs)
return group
def addItem(self, citem):
"""
Add an item to the canvas.
@ -363,7 +311,6 @@ class Canvas(QtGui.QWidget):
#name = newname
## find parent and add item to tree
#currentNode = self.itemList.invisibleRootItem()
insertLocation = 0
#print "Inserting node:", name
@ -413,11 +360,7 @@ class Canvas(QtGui.QWidget):
node.setCheckState(0, QtCore.Qt.Unchecked)
node.name = name
#if citem.opts['parent'] != None:
## insertLocation is incorrect in this case
parent.insertChild(insertLocation, node)
#else:
#root.insertChild(insertLocation, node)
citem.name = name
citem.listItem = node
@ -435,36 +378,6 @@ class Canvas(QtGui.QWidget):
if len(self.items) == 2:
self.autoRange()
#for n in name:
#nextnode = None
#for x in range(currentNode.childCount()):
#ch = currentNode.child(x)
#if hasattr(ch, 'name'): ## check Z-value of current item to determine insert location
#zval = ch.canvasItem.zValue()
#if zval > z:
###print " ->", x
#insertLocation = x+1
#if n == ch.text(0):
#nextnode = ch
#break
#if nextnode is None: ## If name doesn't exist, create it
#nextnode = QtGui.QTreeWidgetItem([n])
#nextnode.setFlags((nextnode.flags() | QtCore.Qt.ItemIsUserCheckable) & ~QtCore.Qt.ItemIsDropEnabled)
#nextnode.setCheckState(0, QtCore.Qt.Checked)
### Add node to correct position in list by Z-value
###print " ==>", insertLocation
#currentNode.insertChild(insertLocation, nextnode)
#if n == name[-1]: ## This is the leaf; add some extra properties.
#nextnode.name = name
#if n == name[0]: ## This is the root; make the item movable
#nextnode.setFlags(nextnode.flags() | QtCore.Qt.ItemIsDragEnabled)
#else:
#nextnode.setFlags(nextnode.flags() & ~QtCore.Qt.ItemIsDragEnabled)
#currentNode = nextnode
return citem
def treeItemMoved(self, item, parent, index):
@ -481,31 +394,6 @@ class Canvas(QtGui.QWidget):
for i in range(len(siblings)):
item = siblings[i]
item.setZValue(zvals[i])
#item = self.itemList.topLevelItem(i)
##ci = self.items[item.name]
#ci = item.canvasItem
#if ci is None:
#continue
#if ci.zValue() != zvals[i]:
#ci.setZValue(zvals[i])
#if self.itemList.topLevelItemCount() < 2:
#return
#name = item.name
#gi = self.items[name]
#if index == 0:
#next = self.itemList.topLevelItem(1)
#z = self.items[next.name].zValue()+1
#else:
#prev = self.itemList.topLevelItem(index-1)
#z = self.items[prev.name].zValue()-1
#gi.setZValue(z)
def itemVisibilityChanged(self, item):
listItem = item.listItem
@ -521,7 +409,6 @@ class Canvas(QtGui.QWidget):
if isinstance(item, QtGui.QTreeWidgetItem):
item = item.canvasItem()
if isinstance(item, CanvasItem):
item.setCanvas(None)
listItem = item.listItem
@ -532,26 +419,25 @@ class Canvas(QtGui.QWidget):
ctrl = item.ctrlWidget()
ctrl.hide()
self.ui.ctrlLayout.removeWidget(ctrl)
ctrl.setParent(None)
else:
if hasattr(item, '_canvasItem'):
self.removeItem(item._canvasItem)
else:
self.view.removeItem(item)
## disconnect signals, remove from list, etc..
gc.collect()
def clear(self):
while len(self.items) > 0:
self.removeItem(self.items[0])
def addToScene(self, item):
self.view.addItem(item)
def removeFromScene(self, item):
self.view.removeItem(item)
def listItems(self):
"""Return a dictionary of name:item pairs"""
return self.items
@ -559,15 +445,10 @@ class Canvas(QtGui.QWidget):
def getListItem(self, name):
return self.items[name]
#def scene(self):
#return self.view.scene()
def itemTransformChanged(self, item):
#self.emit(QtCore.SIGNAL('itemTransformChanged'), self, item)
self.sigItemTransformChanged.emit(self, item)
def itemTransformChangeFinished(self, item):
#self.emit(QtCore.SIGNAL('itemTransformChangeFinished'), self, item)
self.sigItemTransformChangeFinished.emit(self, item)
def itemListContextMenuEvent(self, ev):
@ -575,13 +456,13 @@ class Canvas(QtGui.QWidget):
self.menu.popup(ev.globalPos())
def removeClicked(self):
#self.removeItem(self.menuItem)
for item in self.selectedItems():
self.removeItem(item)
self.menuItem = None
import gc
gc.collect()
class SelectBox(ROI):
def __init__(self, scalable=False):
#QtGui.QGraphicsRectItem.__init__(self, 0, 0, size[0], size[1])
@ -593,14 +474,3 @@ class SelectBox(ROI):
self.addScaleHandle([0, 0], center, lockAspect=True)
self.addRotateHandle([0, 1], center)
self.addRotateHandle([1, 0], center)

View File

@ -1,4 +1,5 @@
# -*- coding: utf-8 -*-
import numpy as np
from ..Qt import QtGui, QtCore, QtSvg, QT_LIB
from ..graphicsItems.ROI import ROI
from .. import SRTTransform, ItemGroup
@ -87,14 +88,12 @@ class CanvasItem(QtCore.QObject):
self.alphaSlider.valueChanged.connect(self.alphaChanged)
self.alphaSlider.sliderPressed.connect(self.alphaPressed)
self.alphaSlider.sliderReleased.connect(self.alphaReleased)
#self.canvas.sigSelectionChanged.connect(self.selectionChanged)
self.resetTransformBtn.clicked.connect(self.resetTransformClicked)
self.copyBtn.clicked.connect(self.copyClicked)
self.pasteBtn.clicked.connect(self.pasteClicked)
self.setMovable(self.opts['movable']) ## update gui to reflect this option
if 'transform' in self.opts:
self.baseTransform = self.opts['transform']
else:
@ -114,7 +113,6 @@ class CanvasItem(QtCore.QObject):
## every CanvasItem implements its own individual selection box
## so that subclasses are free to make their own.
self.selectBox = SelectBox(scalable=self.opts['scalable'], rotatable=self.opts['rotatable'])
#self.canvas.scene().addItem(self.selectBox)
self.selectBox.hide()
self.selectBox.setZValue(1e6)
self.selectBox.sigRegionChanged.connect(self.selectBoxChanged) ## calls selectBoxMoved
@ -130,15 +128,6 @@ class CanvasItem(QtCore.QObject):
self.userTransform = SRTTransform() ## stores the total transform of the object
self.resetUserTransform()
## now happens inside resetUserTransform -> selectBoxToItem
# self.selectBoxBase = self.selectBox.getState().copy()
#print "Created canvas item", self
#print " base:", self.baseTransform
#print " user:", self.userTransform
#print " temp:", self.tempTransform
#print " bounds:", self.item.sceneBoundingRect()
def setMovable(self, m):
self.opts['movable'] = m
@ -240,7 +229,6 @@ class CanvasItem(QtCore.QObject):
# self.setTranslate(-2*s['pos'][0], -2*s['pos'][1])
# self.selectBoxFromUser()
def hasUserTransform(self):
#print self.userRotate, self.userTranslate
return not self.userTransform.isIdentity()
@ -252,10 +240,15 @@ class CanvasItem(QtCore.QObject):
alpha = val / 1023.
self._graphicsItem.setOpacity(alpha)
def setAlpha(self, alpha):
self.alphaSlider.setValue(int(np.clip(alpha * 1023, 0, 1023)))
def alpha(self):
return self.alphaSlider.value() / 1023.
def isMovable(self):
return self.opts['movable']
def selectBoxMoved(self):
"""The selection box has moved; get its transformation information and pass to the graphics item"""
self.userTransform = self.selectBox.getGlobalTransform(relativeTo=self.selectBoxBase)
@ -291,7 +284,6 @@ class CanvasItem(QtCore.QObject):
self.selectBoxFromUser()
self.updateTransform()
def setTemporaryTransform(self, transform):
self.tempTransform = transform
self.updateTransform()
@ -302,21 +294,6 @@ class CanvasItem(QtCore.QObject):
self.resetTemporaryTransform()
self.selectBoxFromUser() ## update the selection box to match the new userTransform
#st = self.userTransform.saveState()
#self.userTransform = self.userTransform * self.tempTransform ## order is important!
#### matrix multiplication affects the scale factors, need to reset
#if st['scale'][0] < 0 or st['scale'][1] < 0:
#nst = self.userTransform.saveState()
#self.userTransform.setScale([-nst['scale'][0], -nst['scale'][1]])
#self.resetTemporaryTransform()
#self.selectBoxFromUser()
#self.selectBoxChangeFinished()
def resetTemporaryTransform(self):
self.tempTransform = SRTTransform() ## don't use Transform.reset()--this transform might be used elsewhere.
self.updateTransform()
@ -339,20 +316,13 @@ class CanvasItem(QtCore.QObject):
def displayTransform(self, transform):
"""Updates transform numbers in the ctrl widget."""
tr = transform.saveState()
self.transformGui.translateLabel.setText("Translate: (%f, %f)" %(tr['pos'][0], tr['pos'][1]))
self.transformGui.rotateLabel.setText("Rotate: %f degrees" %tr['angle'])
self.transformGui.scaleLabel.setText("Scale: (%f, %f)" %(tr['scale'][0], tr['scale'][1]))
#self.transformGui.mirrorImageCheck.setChecked(False)
#if tr['scale'][0] < 0:
# self.transformGui.mirrorImageCheck.setChecked(True)
def resetUserTransform(self):
#self.userRotate = 0
#self.userTranslate = pg.Point(0,0)
self.userTransform.reset()
self.updateTransform()
@ -368,8 +338,6 @@ class CanvasItem(QtCore.QObject):
def restoreTransform(self, tr):
try:
#self.userTranslate = pg.Point(tr['trans'])
#self.userRotate = tr['rot']
self.userTransform = SRTTransform(tr)
self.updateTransform()
@ -377,16 +345,11 @@ class CanvasItem(QtCore.QObject):
self.sigTransformChanged.emit(self)
self.sigTransformChangeFinished.emit(self)
except:
#self.userTranslate = pg.Point([0,0])
#self.userRotate = 0
self.userTransform = SRTTransform()
debug.printExc("Failed to load transform:")
#print "set transform", self, self.userTranslate
def saveTransform(self):
"""Return a dict containing the current user transform"""
#print "save transform", self, self.userTranslate
#return {'trans': list(self.userTranslate), 'rot': self.userRotate}
return self.userTransform.saveState()
def selectBoxFromUser(self):
@ -405,7 +368,6 @@ class CanvasItem(QtCore.QObject):
#self.selectBox.setPos([x2, y2])
self.selectBox.blockSignals(False)
def selectBoxToItem(self):
"""Move/scale the selection box so it fits the item's bounding rect. (assumes item is not rotated)"""
self.itemRect = self._graphicsItem.boundingRect()
@ -425,11 +387,6 @@ class CanvasItem(QtCore.QObject):
if z is not None:
self._graphicsItem.setZValue(z)
#def selectionChanged(self, canvas, items):
#self.selected = len(items) == 1 and (items[0] is self)
#self.showSelectBox()
def selectionChanged(self, sel, multi):
"""
Inform the item that its selection state has changed.
@ -457,15 +414,11 @@ class CanvasItem(QtCore.QObject):
def hideSelectBox(self):
self.selectBox.hide()
def selectBoxChanged(self):
self.selectBoxMoved()
#self.updateTransform(self.selectBox)
#self.emit(QtCore.SIGNAL('transformChanged'), self)
self.sigTransformChanged.emit(self)
def selectBoxChangeFinished(self):
#self.emit(QtCore.SIGNAL('transformChangeFinished'), self)
self.sigTransformChangeFinished.emit(self)
def alphaPressed(self):
@ -500,6 +453,25 @@ class CanvasItem(QtCore.QObject):
def isVisible(self):
return self.opts['visible']
def saveState(self):
return {
'type': self.__class__.__name__,
'name': self.name,
'visible': self.isVisible(),
'alpha': self.alpha(),
'userTransform': self.saveTransform(),
'z': self.zValue(),
'scalable': self.opts['scalable'],
'rotatable': self.opts['rotatable'],
'movable': self.opts['movable'],
}
def restoreState(self, state):
self.setVisible(state['visible'])
self.setAlpha(state['alpha'])
self.restoreTransform(state['userTransform'])
self.setZValue(state['z'])
class GroupCanvasItem(CanvasItem):
"""

View File

@ -6,14 +6,14 @@
<rect>
<x>0</x>
<y>0</y>
<width>490</width>
<height>414</height>
<width>821</width>
<height>578</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<layout class="QGridLayout" name="gridLayout_2">
<property name="margin">
<number>0</number>
</property>
@ -26,9 +26,13 @@
<enum>Qt::Horizontal</enum>
</property>
<widget class="GraphicsView" name="view"/>
<widget class="QWidget" name="layoutWidget">
<layout class="QGridLayout" name="gridLayout_2">
<item row="2" column="0" colspan="2">
<widget class="QSplitter" name="vsplitter">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<widget class="QWidget" name="canvasCtrlWidget" native="true">
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0" colspan="2">
<widget class="QPushButton" name="autoRangeBtn">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
@ -41,7 +45,7 @@
</property>
</widget>
</item>
<item row="5" column="0" colspan="2">
<item row="1" column="0" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="spacing">
<number>0</number>
@ -61,7 +65,7 @@
</item>
</layout>
</item>
<item row="6" column="0" colspan="2">
<item row="2" column="0" colspan="2">
<widget class="TreeWidget" name="itemList">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
@ -79,28 +83,21 @@
</column>
</widget>
</item>
<item row="10" column="0" colspan="2">
<layout class="QGridLayout" name="ctrlLayout">
<property name="spacing">
<number>0</number>
</property>
</layout>
</item>
<item row="7" column="0">
<item row="3" column="0" colspan="2">
<widget class="QPushButton" name="resetTransformsBtn">
<property name="text">
<string>Reset Transforms</string>
</property>
</widget>
</item>
<item row="3" column="0">
<item row="4" column="0">
<widget class="QPushButton" name="mirrorSelectionBtn">
<property name="text">
<string>Mirror Selection</string>
</property>
</widget>
</item>
<item row="3" column="1">
<item row="4" column="1">
<widget class="QPushButton" name="reflectSelectionBtn">
<property name="text">
<string>MirrorXY</string>
@ -109,6 +106,17 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="canvasItemCtrl" native="true">
<layout class="QGridLayout" name="ctrlLayout">
<property name="margin">
<number>0</number>
</property>
<property name="spacing">
<number>0</number>
</property>
</layout>
</widget>
</widget>
</widget>
</item>
</layout>

View File

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'pyqtgraph/canvas/CanvasTemplate.ui'
# Form implementation generated from reading ui file 'CanvasTemplate.ui'
#
# Created by: PyQt4 UI code generator 4.11.4
#
@ -25,39 +25,42 @@ except AttributeError:
class Ui_Form(object):
def setupUi(self, Form):
Form.setObjectName(_fromUtf8("Form"))
Form.resize(490, 414)
self.gridLayout = QtGui.QGridLayout(Form)
self.gridLayout.setMargin(0)
self.gridLayout.setSpacing(0)
self.gridLayout.setObjectName(_fromUtf8("gridLayout"))
Form.resize(821, 578)
self.gridLayout_2 = QtGui.QGridLayout(Form)
self.gridLayout_2.setMargin(0)
self.gridLayout_2.setSpacing(0)
self.gridLayout_2.setObjectName(_fromUtf8("gridLayout_2"))
self.splitter = QtGui.QSplitter(Form)
self.splitter.setOrientation(QtCore.Qt.Horizontal)
self.splitter.setObjectName(_fromUtf8("splitter"))
self.view = GraphicsView(self.splitter)
self.view.setObjectName(_fromUtf8("view"))
self.layoutWidget = QtGui.QWidget(self.splitter)
self.layoutWidget.setObjectName(_fromUtf8("layoutWidget"))
self.gridLayout_2 = QtGui.QGridLayout(self.layoutWidget)
self.gridLayout_2.setObjectName(_fromUtf8("gridLayout_2"))
self.autoRangeBtn = QtGui.QPushButton(self.layoutWidget)
self.vsplitter = QtGui.QSplitter(self.splitter)
self.vsplitter.setOrientation(QtCore.Qt.Vertical)
self.vsplitter.setObjectName(_fromUtf8("vsplitter"))
self.canvasCtrlWidget = QtGui.QWidget(self.vsplitter)
self.canvasCtrlWidget.setObjectName(_fromUtf8("canvasCtrlWidget"))
self.gridLayout = QtGui.QGridLayout(self.canvasCtrlWidget)
self.gridLayout.setObjectName(_fromUtf8("gridLayout"))
self.autoRangeBtn = QtGui.QPushButton(self.canvasCtrlWidget)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(1)
sizePolicy.setHeightForWidth(self.autoRangeBtn.sizePolicy().hasHeightForWidth())
self.autoRangeBtn.setSizePolicy(sizePolicy)
self.autoRangeBtn.setObjectName(_fromUtf8("autoRangeBtn"))
self.gridLayout_2.addWidget(self.autoRangeBtn, 2, 0, 1, 2)
self.gridLayout.addWidget(self.autoRangeBtn, 0, 0, 1, 2)
self.horizontalLayout = QtGui.QHBoxLayout()
self.horizontalLayout.setSpacing(0)
self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout"))
self.redirectCheck = QtGui.QCheckBox(self.layoutWidget)
self.redirectCheck = QtGui.QCheckBox(self.canvasCtrlWidget)
self.redirectCheck.setObjectName(_fromUtf8("redirectCheck"))
self.horizontalLayout.addWidget(self.redirectCheck)
self.redirectCombo = CanvasCombo(self.layoutWidget)
self.redirectCombo = CanvasCombo(self.canvasCtrlWidget)
self.redirectCombo.setObjectName(_fromUtf8("redirectCombo"))
self.horizontalLayout.addWidget(self.redirectCombo)
self.gridLayout_2.addLayout(self.horizontalLayout, 5, 0, 1, 2)
self.itemList = TreeWidget(self.layoutWidget)
self.gridLayout.addLayout(self.horizontalLayout, 1, 0, 1, 2)
self.itemList = TreeWidget(self.canvasCtrlWidget)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(100)
@ -66,21 +69,23 @@ class Ui_Form(object):
self.itemList.setHeaderHidden(True)
self.itemList.setObjectName(_fromUtf8("itemList"))
self.itemList.headerItem().setText(0, _fromUtf8("1"))
self.gridLayout_2.addWidget(self.itemList, 6, 0, 1, 2)
self.ctrlLayout = QtGui.QGridLayout()
self.gridLayout.addWidget(self.itemList, 2, 0, 1, 2)
self.resetTransformsBtn = QtGui.QPushButton(self.canvasCtrlWidget)
self.resetTransformsBtn.setObjectName(_fromUtf8("resetTransformsBtn"))
self.gridLayout.addWidget(self.resetTransformsBtn, 3, 0, 1, 2)
self.mirrorSelectionBtn = QtGui.QPushButton(self.canvasCtrlWidget)
self.mirrorSelectionBtn.setObjectName(_fromUtf8("mirrorSelectionBtn"))
self.gridLayout.addWidget(self.mirrorSelectionBtn, 4, 0, 1, 1)
self.reflectSelectionBtn = QtGui.QPushButton(self.canvasCtrlWidget)
self.reflectSelectionBtn.setObjectName(_fromUtf8("reflectSelectionBtn"))
self.gridLayout.addWidget(self.reflectSelectionBtn, 4, 1, 1, 1)
self.canvasItemCtrl = QtGui.QWidget(self.vsplitter)
self.canvasItemCtrl.setObjectName(_fromUtf8("canvasItemCtrl"))
self.ctrlLayout = QtGui.QGridLayout(self.canvasItemCtrl)
self.ctrlLayout.setMargin(0)
self.ctrlLayout.setSpacing(0)
self.ctrlLayout.setObjectName(_fromUtf8("ctrlLayout"))
self.gridLayout_2.addLayout(self.ctrlLayout, 10, 0, 1, 2)
self.resetTransformsBtn = QtGui.QPushButton(self.layoutWidget)
self.resetTransformsBtn.setObjectName(_fromUtf8("resetTransformsBtn"))
self.gridLayout_2.addWidget(self.resetTransformsBtn, 7, 0, 1, 1)
self.mirrorSelectionBtn = QtGui.QPushButton(self.layoutWidget)
self.mirrorSelectionBtn.setObjectName(_fromUtf8("mirrorSelectionBtn"))
self.gridLayout_2.addWidget(self.mirrorSelectionBtn, 3, 0, 1, 1)
self.reflectSelectionBtn = QtGui.QPushButton(self.layoutWidget)
self.reflectSelectionBtn.setObjectName(_fromUtf8("reflectSelectionBtn"))
self.gridLayout_2.addWidget(self.reflectSelectionBtn, 3, 1, 1, 1)
self.gridLayout.addWidget(self.splitter, 0, 0, 1, 1)
self.gridLayout_2.addWidget(self.splitter, 0, 0, 1, 1)
self.retranslateUi(Form)
QtCore.QMetaObject.connectSlotsByName(Form)

View File

@ -1,8 +1,8 @@
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'pyqtgraph/canvas/CanvasTemplate.ui'
# Form implementation generated from reading ui file 'CanvasTemplate.ui'
#
# Created by: PyQt5 UI code generator 5.5.1
# Created by: PyQt5 UI code generator 5.7.1
#
# WARNING! All changes made in this file will be lost!
@ -11,39 +11,43 @@ 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")
Form.resize(821, 578)
self.gridLayout_2 = QtWidgets.QGridLayout(Form)
self.gridLayout_2.setContentsMargins(0, 0, 0, 0)
self.gridLayout_2.setSpacing(0)
self.gridLayout_2.setObjectName("gridLayout_2")
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.setObjectName("gridLayout_2")
self.autoRangeBtn = QtWidgets.QPushButton(self.layoutWidget)
self.vsplitter = QtWidgets.QSplitter(self.splitter)
self.vsplitter.setOrientation(QtCore.Qt.Vertical)
self.vsplitter.setObjectName("vsplitter")
self.canvasCtrlWidget = QtWidgets.QWidget(self.vsplitter)
self.canvasCtrlWidget.setObjectName("canvasCtrlWidget")
self.gridLayout = QtWidgets.QGridLayout(self.canvasCtrlWidget)
self.gridLayout.setContentsMargins(0, 0, 0, 0)
self.gridLayout.setObjectName("gridLayout")
self.autoRangeBtn = QtWidgets.QPushButton(self.canvasCtrlWidget)
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, 2, 0, 1, 2)
self.gridLayout.addWidget(self.autoRangeBtn, 0, 0, 1, 2)
self.horizontalLayout = QtWidgets.QHBoxLayout()
self.horizontalLayout.setSpacing(0)
self.horizontalLayout.setObjectName("horizontalLayout")
self.redirectCheck = QtWidgets.QCheckBox(self.layoutWidget)
self.redirectCheck = QtWidgets.QCheckBox(self.canvasCtrlWidget)
self.redirectCheck.setObjectName("redirectCheck")
self.horizontalLayout.addWidget(self.redirectCheck)
self.redirectCombo = CanvasCombo(self.layoutWidget)
self.redirectCombo = CanvasCombo(self.canvasCtrlWidget)
self.redirectCombo.setObjectName("redirectCombo")
self.horizontalLayout.addWidget(self.redirectCombo)
self.gridLayout_2.addLayout(self.horizontalLayout, 5, 0, 1, 2)
self.itemList = TreeWidget(self.layoutWidget)
self.gridLayout.addLayout(self.horizontalLayout, 1, 0, 1, 2)
self.itemList = TreeWidget(self.canvasCtrlWidget)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(100)
@ -52,21 +56,23 @@ class Ui_Form(object):
self.itemList.setHeaderHidden(True)
self.itemList.setObjectName("itemList")
self.itemList.headerItem().setText(0, "1")
self.gridLayout_2.addWidget(self.itemList, 6, 0, 1, 2)
self.ctrlLayout = QtWidgets.QGridLayout()
self.gridLayout.addWidget(self.itemList, 2, 0, 1, 2)
self.resetTransformsBtn = QtWidgets.QPushButton(self.canvasCtrlWidget)
self.resetTransformsBtn.setObjectName("resetTransformsBtn")
self.gridLayout.addWidget(self.resetTransformsBtn, 3, 0, 1, 2)
self.mirrorSelectionBtn = QtWidgets.QPushButton(self.canvasCtrlWidget)
self.mirrorSelectionBtn.setObjectName("mirrorSelectionBtn")
self.gridLayout.addWidget(self.mirrorSelectionBtn, 4, 0, 1, 1)
self.reflectSelectionBtn = QtWidgets.QPushButton(self.canvasCtrlWidget)
self.reflectSelectionBtn.setObjectName("reflectSelectionBtn")
self.gridLayout.addWidget(self.reflectSelectionBtn, 4, 1, 1, 1)
self.canvasItemCtrl = QtWidgets.QWidget(self.vsplitter)
self.canvasItemCtrl.setObjectName("canvasItemCtrl")
self.ctrlLayout = QtWidgets.QGridLayout(self.canvasItemCtrl)
self.ctrlLayout.setContentsMargins(0, 0, 0, 0)
self.ctrlLayout.setSpacing(0)
self.ctrlLayout.setObjectName("ctrlLayout")
self.gridLayout_2.addLayout(self.ctrlLayout, 10, 0, 1, 2)
self.resetTransformsBtn = QtWidgets.QPushButton(self.layoutWidget)
self.resetTransformsBtn.setObjectName("resetTransformsBtn")
self.gridLayout_2.addWidget(self.resetTransformsBtn, 7, 0, 1, 1)
self.mirrorSelectionBtn = QtWidgets.QPushButton(self.layoutWidget)
self.mirrorSelectionBtn.setObjectName("mirrorSelectionBtn")
self.gridLayout_2.addWidget(self.mirrorSelectionBtn, 3, 0, 1, 1)
self.reflectSelectionBtn = QtWidgets.QPushButton(self.layoutWidget)
self.reflectSelectionBtn.setObjectName("reflectSelectionBtn")
self.gridLayout_2.addWidget(self.reflectSelectionBtn, 3, 1, 1, 1)
self.gridLayout.addWidget(self.splitter, 0, 0, 1, 1)
self.gridLayout_2.addWidget(self.splitter, 0, 0, 1, 1)
self.retranslateUi(Form)
QtCore.QMetaObject.connectSlotsByName(Form)

View File

@ -1,8 +1,8 @@
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'pyqtgraph/canvas/CanvasTemplate.ui'
# Form implementation generated from reading ui file 'CanvasTemplate.ui'
#
# Created: Wed Nov 9 18:02:00 2016
# Created: Fri Mar 24 16:09:39 2017
# by: pyside-uic 0.2.15 running on PySide 1.2.2
#
# WARNING! All changes made in this file will be lost!
@ -12,40 +12,43 @@ from PySide import QtCore, QtGui
class Ui_Form(object):
def setupUi(self, Form):
Form.setObjectName("Form")
Form.resize(490, 414)
self.gridLayout = QtGui.QGridLayout(Form)
self.gridLayout.setContentsMargins(0, 0, 0, 0)
self.gridLayout.setSpacing(0)
self.gridLayout.setObjectName("gridLayout")
Form.resize(821, 578)
self.gridLayout_2 = QtGui.QGridLayout(Form)
self.gridLayout_2.setContentsMargins(0, 0, 0, 0)
self.gridLayout_2.setSpacing(0)
self.gridLayout_2.setObjectName("gridLayout_2")
self.splitter = QtGui.QSplitter(Form)
self.splitter.setOrientation(QtCore.Qt.Horizontal)
self.splitter.setObjectName("splitter")
self.view = GraphicsView(self.splitter)
self.view.setObjectName("view")
self.layoutWidget = QtGui.QWidget(self.splitter)
self.layoutWidget.setObjectName("layoutWidget")
self.gridLayout_2 = QtGui.QGridLayout(self.layoutWidget)
self.gridLayout_2.setContentsMargins(0, 0, 0, 0)
self.gridLayout_2.setObjectName("gridLayout_2")
self.autoRangeBtn = QtGui.QPushButton(self.layoutWidget)
self.vsplitter = QtGui.QSplitter(self.splitter)
self.vsplitter.setOrientation(QtCore.Qt.Vertical)
self.vsplitter.setObjectName("vsplitter")
self.canvasCtrlWidget = QtGui.QWidget(self.vsplitter)
self.canvasCtrlWidget.setObjectName("canvasCtrlWidget")
self.gridLayout = QtGui.QGridLayout(self.canvasCtrlWidget)
self.gridLayout.setContentsMargins(0, 0, 0, 0)
self.gridLayout.setObjectName("gridLayout")
self.autoRangeBtn = QtGui.QPushButton(self.canvasCtrlWidget)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(1)
sizePolicy.setHeightForWidth(self.autoRangeBtn.sizePolicy().hasHeightForWidth())
self.autoRangeBtn.setSizePolicy(sizePolicy)
self.autoRangeBtn.setObjectName("autoRangeBtn")
self.gridLayout_2.addWidget(self.autoRangeBtn, 2, 0, 1, 2)
self.gridLayout.addWidget(self.autoRangeBtn, 0, 0, 1, 2)
self.horizontalLayout = QtGui.QHBoxLayout()
self.horizontalLayout.setSpacing(0)
self.horizontalLayout.setObjectName("horizontalLayout")
self.redirectCheck = QtGui.QCheckBox(self.layoutWidget)
self.redirectCheck = QtGui.QCheckBox(self.canvasCtrlWidget)
self.redirectCheck.setObjectName("redirectCheck")
self.horizontalLayout.addWidget(self.redirectCheck)
self.redirectCombo = CanvasCombo(self.layoutWidget)
self.redirectCombo = CanvasCombo(self.canvasCtrlWidget)
self.redirectCombo.setObjectName("redirectCombo")
self.horizontalLayout.addWidget(self.redirectCombo)
self.gridLayout_2.addLayout(self.horizontalLayout, 5, 0, 1, 2)
self.itemList = TreeWidget(self.layoutWidget)
self.gridLayout.addLayout(self.horizontalLayout, 1, 0, 1, 2)
self.itemList = TreeWidget(self.canvasCtrlWidget)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(100)
@ -54,21 +57,24 @@ class Ui_Form(object):
self.itemList.setHeaderHidden(True)
self.itemList.setObjectName("itemList")
self.itemList.headerItem().setText(0, "1")
self.gridLayout_2.addWidget(self.itemList, 6, 0, 1, 2)
self.ctrlLayout = QtGui.QGridLayout()
self.ctrlLayout.setSpacing(0)
self.ctrlLayout.setObjectName("ctrlLayout")
self.gridLayout_2.addLayout(self.ctrlLayout, 10, 0, 1, 2)
self.resetTransformsBtn = QtGui.QPushButton(self.layoutWidget)
self.gridLayout.addWidget(self.itemList, 2, 0, 1, 2)
self.resetTransformsBtn = QtGui.QPushButton(self.canvasCtrlWidget)
self.resetTransformsBtn.setObjectName("resetTransformsBtn")
self.gridLayout_2.addWidget(self.resetTransformsBtn, 7, 0, 1, 1)
self.mirrorSelectionBtn = QtGui.QPushButton(self.layoutWidget)
self.gridLayout.addWidget(self.resetTransformsBtn, 3, 0, 1, 2)
self.mirrorSelectionBtn = QtGui.QPushButton(self.canvasCtrlWidget)
self.mirrorSelectionBtn.setObjectName("mirrorSelectionBtn")
self.gridLayout_2.addWidget(self.mirrorSelectionBtn, 3, 0, 1, 1)
self.reflectSelectionBtn = QtGui.QPushButton(self.layoutWidget)
self.gridLayout.addWidget(self.mirrorSelectionBtn, 4, 0, 1, 1)
self.reflectSelectionBtn = QtGui.QPushButton(self.canvasCtrlWidget)
self.reflectSelectionBtn.setObjectName("reflectSelectionBtn")
self.gridLayout_2.addWidget(self.reflectSelectionBtn, 3, 1, 1, 1)
self.gridLayout.addWidget(self.splitter, 0, 0, 1, 1)
self.gridLayout.addWidget(self.reflectSelectionBtn, 4, 1, 1, 1)
self.canvasItemCtrl = QtGui.QWidget(self.vsplitter)
self.canvasItemCtrl.setObjectName("canvasItemCtrl")
self.ctrlLayout = QtGui.QGridLayout(self.canvasItemCtrl)
self.ctrlLayout.setContentsMargins(0, 0, 0, 0)
self.ctrlLayout.setSpacing(0)
self.ctrlLayout.setContentsMargins(0, 0, 0, 0)
self.ctrlLayout.setObjectName("ctrlLayout")
self.gridLayout_2.addWidget(self.splitter, 0, 0, 1, 1)
self.retranslateUi(Form)
QtCore.QMetaObject.connectSlotsByName(Form)