Bugfixes:

- Corrected ImageItem.setRect transformation order  
  - PlotCurveItem uses nkPen for interpreting shadowPen arguments
  - PlotItem and PlotWidget wrap a few more missing methods from ViewBox
This commit is contained in:
Luke Campagnola 2012-03-17 12:10:51 -04:00
parent fbbe4ef946
commit cd24530eb1
4 changed files with 6 additions and 5 deletions

View File

@ -128,8 +128,8 @@ class ImageItem(GraphicsObject):
def setRect(self, rect): def setRect(self, rect):
"""Scale and translate the image to fit within rect.""" """Scale and translate the image to fit within rect."""
self.resetTransform() self.resetTransform()
self.scale(rect.width() / self.width(), rect.height() / self.height())
self.translate(rect.left(), rect.top()) self.translate(rect.left(), rect.top())
self.scale(rect.width() / self.width(), rect.height() / self.height())
def setImage(self, image=None, autoLevels=None, **kargs): def setImage(self, image=None, autoLevels=None, **kargs):
""" """

View File

@ -35,7 +35,8 @@ class PlotCurveItem(GraphicsObject):
else: else:
self.setPen(pen) self.setPen(pen)
self.shadowPen = shadowPen self.setShadowPen(shadowPen)
if y is not None: if y is not None:
self.updateData(y, x, copy) self.updateData(y, x, copy)
@ -159,7 +160,7 @@ class PlotCurveItem(GraphicsObject):
self.update() self.update()
def setShadowPen(self, pen): def setShadowPen(self, pen):
self.shadowPen = pen self.shadowPen = fn.mkPen(pen)
self.update() self.update()
def setDownsampling(self, ds): def setDownsampling(self, ds):

View File

@ -134,7 +134,7 @@ class PlotItem(GraphicsWidget):
for m in [ for m in [
'setXRange', 'setYRange', 'setXLink', 'setYLink', 'setXRange', 'setYRange', 'setXLink', 'setYLink',
'setRange', 'autoRange', 'viewRect', 'setMouseEnabled', 'setRange', 'autoRange', 'viewRect', 'setMouseEnabled',
'enableAutoRange', 'disableAutoRange']: 'enableAutoRange', 'disableAutoRange', 'setAspectLocked']:
setattr(self, m, getattr(self.vb, m)) setattr(self, m, getattr(self.vb, m))
self.items = [] self.items = []

View File

@ -23,7 +23,7 @@ class PlotWidget(GraphicsView):
self.plotItem = PlotItem(**kargs) self.plotItem = PlotItem(**kargs)
self.setCentralItem(self.plotItem) self.setCentralItem(self.plotItem)
## Explicitly wrap methods from plotItem ## Explicitly wrap methods from plotItem
for m in ['addItem', 'removeItem', 'autoRange', 'clear', 'setXRange', 'setYRange', 'setRange']: for m in ['addItem', 'removeItem', 'autoRange', 'clear', 'setXRange', 'setYRange', 'setRange', 'setAspectLocked', 'setMouseEnabled']:
setattr(self, m, getattr(self.plotItem, m)) setattr(self, m, getattr(self.plotItem, m))
#QtCore.QObject.connect(self.plotItem, QtCore.SIGNAL('viewChanged'), self.viewChanged) #QtCore.QObject.connect(self.plotItem, QtCore.SIGNAL('viewChanged'), self.viewChanged)
self.plotItem.sigRangeChanged.connect(self.viewRangeChanged) self.plotItem.sigRangeChanged.connect(self.viewRangeChanged)