minor Canvas updates
This commit is contained in:
parent
c1963759a1
commit
59ad54c55e
@ -43,6 +43,7 @@ class Canvas(QtGui.QWidget):
|
||||
self.multiSelectBox.hide()
|
||||
self.multiSelectBox.setZValue(1e6)
|
||||
self.ui.mirrorSelectionBtn.hide()
|
||||
self.ui.reflectSelectionBtn.hide()
|
||||
self.ui.resetTransformsBtn.hide()
|
||||
|
||||
self.redirect = None ## which canvas to redirect items to
|
||||
@ -75,6 +76,7 @@ class Canvas(QtGui.QWidget):
|
||||
self.multiSelectBox.sigRegionChanged.connect(self.multiSelectBoxChanged)
|
||||
self.multiSelectBox.sigRegionChangeFinished.connect(self.multiSelectBoxChangeFinished)
|
||||
self.ui.mirrorSelectionBtn.clicked.connect(self.mirrorSelectionClicked)
|
||||
self.ui.reflectSelectionBtn.clicked.connect(self.reflectSelectionClicked)
|
||||
self.ui.resetTransformsBtn.clicked.connect(self.resetTransformsClicked)
|
||||
|
||||
self.resizeEvent()
|
||||
@ -211,6 +213,7 @@ class Canvas(QtGui.QWidget):
|
||||
#item.ctrlWidget().show()
|
||||
self.multiSelectBox.hide()
|
||||
self.ui.mirrorSelectionBtn.hide()
|
||||
self.ui.reflectSelectionBtn.hide()
|
||||
self.ui.resetTransformsBtn.hide()
|
||||
elif len(sel) > 1:
|
||||
self.showMultiSelectBox()
|
||||
@ -265,6 +268,7 @@ class Canvas(QtGui.QWidget):
|
||||
self.multiSelectBox.show()
|
||||
|
||||
self.ui.mirrorSelectionBtn.show()
|
||||
self.ui.reflectSelectionBtn.show()
|
||||
self.ui.resetTransformsBtn.show()
|
||||
#self.multiSelectBoxBase = self.multiSelectBox.getState().copy()
|
||||
|
||||
@ -272,6 +276,11 @@ class Canvas(QtGui.QWidget):
|
||||
for ci in self.selectedItems():
|
||||
ci.mirrorY()
|
||||
self.showMultiSelectBox()
|
||||
|
||||
def reflectSelectionClicked(self):
|
||||
for ci in self.selectedItems():
|
||||
ci.mirrorXY()
|
||||
self.showMultiSelectBox()
|
||||
|
||||
def resetTransformsClicked(self):
|
||||
for i in self.selectedItems():
|
||||
|
@ -73,6 +73,7 @@ class CanvasItem(QtCore.QObject):
|
||||
self.transformGui.setupUi(self.transformWidget)
|
||||
self.layout.addWidget(self.transformWidget, 3, 0, 1, 2)
|
||||
self.transformGui.mirrorImageBtn.clicked.connect(self.mirrorY)
|
||||
self.transformGui.reflectImageBtn.clicked.connect(self.mirrorXY)
|
||||
|
||||
self.layout.addWidget(self.resetTransformBtn, 1, 0, 1, 2)
|
||||
self.layout.addWidget(self.copyBtn, 2, 0, 1, 1)
|
||||
@ -221,6 +222,18 @@ class CanvasItem(QtCore.QObject):
|
||||
#self.selectBoxFromUser()
|
||||
#return
|
||||
|
||||
def mirrorXY(self):
|
||||
if not self.isMovable():
|
||||
return
|
||||
self.rotate(180.)
|
||||
# inv = pg.Transform()
|
||||
# inv.scale(-1, -1)
|
||||
# self.userTransform = self.userTransform * inv #flip lr/ud
|
||||
# s=self.updateTransform()
|
||||
# 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()
|
||||
@ -307,7 +320,6 @@ class CanvasItem(QtCore.QObject):
|
||||
def updateTransform(self):
|
||||
"""Regenerate the item position from the base, user, and temp transforms"""
|
||||
transform = self.baseTransform * self.userTransform * self.tempTransform ## order is important
|
||||
|
||||
s = transform.saveState()
|
||||
self._graphicsItem.setPos(*s['pos'])
|
||||
|
||||
@ -316,6 +328,7 @@ class CanvasItem(QtCore.QObject):
|
||||
self.itemScale.setYScale(s['scale'][1])
|
||||
|
||||
self.displayTransform(transform)
|
||||
return(s) # return the transform state
|
||||
|
||||
def displayTransform(self, transform):
|
||||
"""Updates transform numbers in the ctrl widget."""
|
||||
|
@ -1,8 +1,8 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Form implementation generated from reading ui file 'CanvasTemplate.ui'
|
||||
# Form implementation generated from reading ui file './lib/util/pyqtgraph/canvas/CanvasTemplate.ui'
|
||||
#
|
||||
# Created: Sun Dec 18 20:04:41 2011
|
||||
# Created: Wed Apr 18 13:40:19 2012
|
||||
# by: PyQt4 UI code generator 4.8.3
|
||||
#
|
||||
# WARNING! All changes made in this file will be lost!
|
||||
@ -17,7 +17,7 @@ except AttributeError:
|
||||
class Ui_Form(object):
|
||||
def setupUi(self, Form):
|
||||
Form.setObjectName(_fromUtf8("Form"))
|
||||
Form.resize(466, 422)
|
||||
Form.resize(490, 414)
|
||||
self.gridLayout = QtGui.QGridLayout(Form)
|
||||
self.gridLayout.setMargin(0)
|
||||
self.gridLayout.setSpacing(0)
|
||||
@ -32,6 +32,12 @@ class Ui_Form(object):
|
||||
self.gridLayout_2 = QtGui.QGridLayout(self.layoutWidget)
|
||||
self.gridLayout_2.setMargin(0)
|
||||
self.gridLayout_2.setObjectName(_fromUtf8("gridLayout_2"))
|
||||
self.storeSvgBtn = QtGui.QPushButton(self.layoutWidget)
|
||||
self.storeSvgBtn.setObjectName(_fromUtf8("storeSvgBtn"))
|
||||
self.gridLayout_2.addWidget(self.storeSvgBtn, 1, 0, 1, 1)
|
||||
self.storePngBtn = QtGui.QPushButton(self.layoutWidget)
|
||||
self.storePngBtn.setObjectName(_fromUtf8("storePngBtn"))
|
||||
self.gridLayout_2.addWidget(self.storePngBtn, 1, 1, 1, 1)
|
||||
self.autoRangeBtn = QtGui.QPushButton(self.layoutWidget)
|
||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
@ -40,6 +46,16 @@ class Ui_Form(object):
|
||||
self.autoRangeBtn.setSizePolicy(sizePolicy)
|
||||
self.autoRangeBtn.setObjectName(_fromUtf8("autoRangeBtn"))
|
||||
self.gridLayout_2.addWidget(self.autoRangeBtn, 3, 0, 1, 2)
|
||||
self.horizontalLayout = QtGui.QHBoxLayout()
|
||||
self.horizontalLayout.setSpacing(0)
|
||||
self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout"))
|
||||
self.redirectCheck = QtGui.QCheckBox(self.layoutWidget)
|
||||
self.redirectCheck.setObjectName(_fromUtf8("redirectCheck"))
|
||||
self.horizontalLayout.addWidget(self.redirectCheck)
|
||||
self.redirectCombo = CanvasCombo(self.layoutWidget)
|
||||
self.redirectCombo.setObjectName(_fromUtf8("redirectCombo"))
|
||||
self.horizontalLayout.addWidget(self.redirectCombo)
|
||||
self.gridLayout_2.addLayout(self.horizontalLayout, 6, 0, 1, 2)
|
||||
self.itemList = TreeWidget(self.layoutWidget)
|
||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
@ -53,29 +69,16 @@ class Ui_Form(object):
|
||||
self.ctrlLayout = QtGui.QGridLayout()
|
||||
self.ctrlLayout.setSpacing(0)
|
||||
self.ctrlLayout.setObjectName(_fromUtf8("ctrlLayout"))
|
||||
self.gridLayout_2.addLayout(self.ctrlLayout, 10, 0, 1, 2)
|
||||
self.storeSvgBtn = QtGui.QPushButton(self.layoutWidget)
|
||||
self.storeSvgBtn.setObjectName(_fromUtf8("storeSvgBtn"))
|
||||
self.gridLayout_2.addWidget(self.storeSvgBtn, 1, 0, 1, 1)
|
||||
self.storePngBtn = QtGui.QPushButton(self.layoutWidget)
|
||||
self.storePngBtn.setObjectName(_fromUtf8("storePngBtn"))
|
||||
self.gridLayout_2.addWidget(self.storePngBtn, 1, 1, 1, 1)
|
||||
self.horizontalLayout = QtGui.QHBoxLayout()
|
||||
self.horizontalLayout.setSpacing(0)
|
||||
self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout"))
|
||||
self.redirectCheck = QtGui.QCheckBox(self.layoutWidget)
|
||||
self.redirectCheck.setObjectName(_fromUtf8("redirectCheck"))
|
||||
self.horizontalLayout.addWidget(self.redirectCheck)
|
||||
self.redirectCombo = CanvasCombo(self.layoutWidget)
|
||||
self.redirectCombo.setObjectName(_fromUtf8("redirectCombo"))
|
||||
self.horizontalLayout.addWidget(self.redirectCombo)
|
||||
self.gridLayout_2.addLayout(self.horizontalLayout, 6, 0, 1, 2)
|
||||
self.mirrorSelectionBtn = QtGui.QPushButton(self.layoutWidget)
|
||||
self.mirrorSelectionBtn.setObjectName(_fromUtf8("mirrorSelectionBtn"))
|
||||
self.gridLayout_2.addWidget(self.mirrorSelectionBtn, 8, 0, 1, 1)
|
||||
self.gridLayout_2.addLayout(self.ctrlLayout, 11, 0, 1, 2)
|
||||
self.resetTransformsBtn = QtGui.QPushButton(self.layoutWidget)
|
||||
self.resetTransformsBtn.setObjectName(_fromUtf8("resetTransformsBtn"))
|
||||
self.gridLayout_2.addWidget(self.resetTransformsBtn, 8, 1, 1, 1)
|
||||
self.gridLayout_2.addWidget(self.resetTransformsBtn, 8, 0, 1, 1)
|
||||
self.mirrorSelectionBtn = QtGui.QPushButton(self.layoutWidget)
|
||||
self.mirrorSelectionBtn.setObjectName(_fromUtf8("mirrorSelectionBtn"))
|
||||
self.gridLayout_2.addWidget(self.mirrorSelectionBtn, 4, 0, 1, 1)
|
||||
self.reflectSelectionBtn = QtGui.QPushButton(self.layoutWidget)
|
||||
self.reflectSelectionBtn.setObjectName(_fromUtf8("reflectSelectionBtn"))
|
||||
self.gridLayout_2.addWidget(self.reflectSelectionBtn, 4, 1, 1, 1)
|
||||
self.gridLayout.addWidget(self.splitter, 0, 0, 1, 1)
|
||||
|
||||
self.retranslateUi(Form)
|
||||
@ -83,13 +86,14 @@ class Ui_Form(object):
|
||||
|
||||
def retranslateUi(self, Form):
|
||||
Form.setWindowTitle(QtGui.QApplication.translate("Form", "Form", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.autoRangeBtn.setText(QtGui.QApplication.translate("Form", "Auto Range", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.storeSvgBtn.setText(QtGui.QApplication.translate("Form", "Store SVG", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.storePngBtn.setText(QtGui.QApplication.translate("Form", "Store PNG", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.autoRangeBtn.setText(QtGui.QApplication.translate("Form", "Auto Range", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.redirectCheck.setToolTip(QtGui.QApplication.translate("Form", "Check to display all local items in a remote canvas.", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.redirectCheck.setText(QtGui.QApplication.translate("Form", "Redirect", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.mirrorSelectionBtn.setText(QtGui.QApplication.translate("Form", "Mirror Selection", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.resetTransformsBtn.setText(QtGui.QApplication.translate("Form", "Reset Transforms", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.mirrorSelectionBtn.setText(QtGui.QApplication.translate("Form", "Mirror Selection", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.reflectSelectionBtn.setText(QtGui.QApplication.translate("Form", "MirrorXY", None, QtGui.QApplication.UnicodeUTF8))
|
||||
|
||||
from pyqtgraph.widgets.GraphicsView import GraphicsView
|
||||
from CanvasManager import CanvasCombo
|
||||
|
@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>466</width>
|
||||
<height>422</height>
|
||||
<width>490</width>
|
||||
<height>414</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@ -28,44 +28,6 @@
|
||||
<widget class="GraphicsView" name="view"/>
|
||||
<widget class="QWidget" name="layoutWidget">
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="3" column="0" colspan="2">
|
||||
<widget class="QPushButton" name="autoRangeBtn">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>1</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Auto Range</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0" colspan="2">
|
||||
<widget class="TreeWidget" name="itemList">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>100</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="headerHidden">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string notr="true">1</string>
|
||||
</property>
|
||||
</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="1" column="0">
|
||||
<widget class="QPushButton" name="storeSvgBtn">
|
||||
<property name="text">
|
||||
@ -80,6 +42,19 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="2">
|
||||
<widget class="QPushButton" name="autoRangeBtn">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>1</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Auto Range</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0" colspan="2">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<property name="spacing">
|
||||
@ -100,17 +75,49 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="7" column="0" colspan="2">
|
||||
<widget class="TreeWidget" name="itemList">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>100</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="headerHidden">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string notr="true">1</string>
|
||||
</property>
|
||||
</column>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="0" colspan="2">
|
||||
<layout class="QGridLayout" name="ctrlLayout">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="8" column="0">
|
||||
<widget class="QPushButton" name="resetTransformsBtn">
|
||||
<property name="text">
|
||||
<string>Reset Transforms</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QPushButton" name="mirrorSelectionBtn">
|
||||
<property name="text">
|
||||
<string>Mirror Selection</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="1">
|
||||
<widget class="QPushButton" name="resetTransformsBtn">
|
||||
<item row="4" column="1">
|
||||
<widget class="QPushButton" name="reflectSelectionBtn">
|
||||
<property name="text">
|
||||
<string>Reset Transforms</string>
|
||||
<string>MirrorXY</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -1,8 +1,8 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Form implementation generated from reading ui file 'TransformGuiTemplate.ui'
|
||||
# Form implementation generated from reading ui file './lib/util/pyqtgraph/canvas/TransformGuiTemplate.ui'
|
||||
#
|
||||
# Created: Sun Dec 18 20:04:40 2011
|
||||
# Created: Wed Apr 18 13:40:19 2012
|
||||
# by: PyQt4 UI code generator 4.8.3
|
||||
#
|
||||
# WARNING! All changes made in this file will be lost!
|
||||
@ -17,7 +17,7 @@ except AttributeError:
|
||||
class Ui_Form(object):
|
||||
def setupUi(self, Form):
|
||||
Form.setObjectName(_fromUtf8("Form"))
|
||||
Form.resize(169, 82)
|
||||
Form.resize(224, 117)
|
||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Preferred)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
@ -36,10 +36,16 @@ class Ui_Form(object):
|
||||
self.scaleLabel = QtGui.QLabel(Form)
|
||||
self.scaleLabel.setObjectName(_fromUtf8("scaleLabel"))
|
||||
self.verticalLayout.addWidget(self.scaleLabel)
|
||||
self.horizontalLayout = QtGui.QHBoxLayout()
|
||||
self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout"))
|
||||
self.mirrorImageBtn = QtGui.QPushButton(Form)
|
||||
self.mirrorImageBtn.setToolTip(_fromUtf8(""))
|
||||
self.mirrorImageBtn.setObjectName(_fromUtf8("mirrorImageBtn"))
|
||||
self.verticalLayout.addWidget(self.mirrorImageBtn)
|
||||
self.horizontalLayout.addWidget(self.mirrorImageBtn)
|
||||
self.reflectImageBtn = QtGui.QPushButton(Form)
|
||||
self.reflectImageBtn.setObjectName(_fromUtf8("reflectImageBtn"))
|
||||
self.horizontalLayout.addWidget(self.reflectImageBtn)
|
||||
self.verticalLayout.addLayout(self.horizontalLayout)
|
||||
|
||||
self.retranslateUi(Form)
|
||||
QtCore.QMetaObject.connectSlotsByName(Form)
|
||||
@ -50,4 +56,5 @@ class Ui_Form(object):
|
||||
self.rotateLabel.setText(QtGui.QApplication.translate("Form", "Rotate:", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.scaleLabel.setText(QtGui.QApplication.translate("Form", "Scale:", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.mirrorImageBtn.setText(QtGui.QApplication.translate("Form", "Mirror", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.reflectImageBtn.setText(QtGui.QApplication.translate("Form", "Reflect", None, QtGui.QApplication.UnicodeUTF8))
|
||||
|
||||
|
@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>169</width>
|
||||
<height>82</height>
|
||||
<width>224</width>
|
||||
<height>117</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
@ -48,14 +48,25 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="mirrorImageBtn">
|
||||
<property name="toolTip">
|
||||
<string extracomment="Mirror the item across the global Y axis"/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Mirror</string>
|
||||
</property>
|
||||
</widget>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QPushButton" name="mirrorImageBtn">
|
||||
<property name="toolTip">
|
||||
<string extracomment="Mirror the item across the global Y axis"/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Mirror</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="reflectImageBtn">
|
||||
<property name="text">
|
||||
<string>Reflect</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
|
Loading…
Reference in New Issue
Block a user