Commit 83812ad5 authored by Luke Campagnola's avatar Luke Campagnola
Browse files

Bugfixes:

  - AxisItem did not update grid line length when plot stretches
  - Workaround for PySide/QByteArray memory leak
parent a59f4c20
......@@ -1109,10 +1109,15 @@ def arrayToQPath(x, y, connect='all'):
arr.data[lastInd:lastInd+4] = struct.pack('>i', 0)
#prof.mark('footer')
# create datastream object and stream into path
buf = QtCore.QByteArray(arr.data[12:lastInd+4]) # I think one unnecessary copy happens here
## Avoiding this method because QByteArray(str) leaks memory in PySide
#buf = QtCore.QByteArray(arr.data[12:lastInd+4]) # I think one unnecessary copy happens here
path.strn = arr.data[12:lastInd+4] # make sure data doesn't run away
buf = QtCore.QByteArray.fromRawData(path.strn)
#prof.mark('create buffer')
ds = QtCore.QDataStream(buf)
#prof.mark('create datastream')
ds >> path
#prof.mark('load')
......
......@@ -309,10 +309,18 @@ class AxisItem(GraphicsWidget):
oldView.sigXRangeChanged.disconnect(self.linkedViewChanged)
view.sigXRangeChanged.connect(self.linkedViewChanged)
def linkedViewChanged(self, view, newRange):
if oldView is not None:
oldView.sigResized.disconnect(self.linkedViewChanged)
view.sigResized.connect(self.linkedViewChanged)
def linkedViewChanged(self, view, newRange=None):
if self.orientation in ['right', 'left'] and view.yInverted():
if newRange is None:
newRange = view.viewRange()[1]
self.setRange(*newRange[::-1])
else:
if newRange is None:
newRange = view.viewRange()[0]
self.setRange(*newRange)
def boundingRect(self):
......
......@@ -50,6 +50,7 @@ class ViewBox(GraphicsWidget):
#sigActionPositionChanged = QtCore.Signal(object)
sigStateChanged = QtCore.Signal(object)
sigTransformChanged = QtCore.Signal(object)
sigResized = QtCore.Signal(object)
## mouse modes
PanMode = 3
......@@ -304,6 +305,7 @@ class ViewBox(GraphicsWidget):
#self._itemBoundsCache.clear()
#self.linkedXChanged()
#self.linkedYChanged()
self.sigResized.emit(self)
def viewRange(self):
"""Return a the view's visible range as a list: [[xmin, xmax], [ymin, ymax]]"""
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment