Commit 7e926ba1 authored by Luke Campagnola's avatar Luke Campagnola
Browse files

Bugfix for plot linking

parent 2a2f19b2
...@@ -100,8 +100,7 @@ def run(): ...@@ -100,8 +100,7 @@ def run():
app = QtGui.QApplication([]) app = QtGui.QApplication([])
loader = ExampleLoader() loader = ExampleLoader()
if sys.flags.interactive != 1: app.exec_()
app.exec_()
if __name__ == '__main__': if __name__ == '__main__':
run() run()
...@@ -22,7 +22,7 @@ y = np.sin(x) / x ...@@ -22,7 +22,7 @@ y = np.sin(x) / x
win = pg.GraphicsWindow(title="View Linking Examples") win = pg.GraphicsWindow(title="View Linking Examples")
win.resize(800,600) win.resize(800,600)
win.addLabel("Views linked at runtime:", colspan=2) win.addLabel("Linked Views", colspan=2)
win.nextRow() win.nextRow()
p1 = win.addPlot(x=x, y=y, name="Plot1", title="Plot1") p1 = win.addPlot(x=x, y=y, name="Plot1", title="Plot1")
......
...@@ -215,7 +215,7 @@ class ViewBox(GraphicsWidget): ...@@ -215,7 +215,7 @@ class ViewBox(GraphicsWidget):
def resizeEvent(self, ev): def resizeEvent(self, ev):
#self.setRange(self.range, padding=0) #self.setRange(self.range, padding=0)
self.updateAutoRange() #self.updateAutoRange()
self.updateMatrix() self.updateMatrix()
self.sigStateChanged.emit(self) self.sigStateChanged.emit(self)
#self.linkedXChanged() #self.linkedXChanged()
...@@ -609,10 +609,12 @@ class ViewBox(GraphicsWidget): ...@@ -609,10 +609,12 @@ class ViewBox(GraphicsWidget):
return self.mapToScene(self.mapFromView(obj)) return self.mapToScene(self.mapFromView(obj))
def mapFromItemToView(self, item, obj): def mapFromItemToView(self, item, obj):
return self.mapSceneToView(item.mapToScene(obj)) return self.childGroup.mapFromItem(item, obj)
#return self.mapSceneToView(item.mapToScene(obj))
def mapFromViewToItem(self, item, obj): def mapFromViewToItem(self, item, obj):
return item.mapFromScene(self.mapViewToScene(obj)) return self.childGroup.mapToItem(item, obj)
#return item.mapFromScene(self.mapViewToScene(obj))
def itemBoundingRect(self, item): def itemBoundingRect(self, item):
"""Return the bounding rect of the item in view coordinates""" """Return the bounding rect of the item in view coordinates"""
......
Markdown is supported
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