Bugfix for plot linking

This commit is contained in:
Luke Campagnola 2012-03-23 04:04:04 -04:00
parent 2a2f19b2d5
commit 7e926ba136
3 changed files with 7 additions and 6 deletions

View File

@ -100,8 +100,7 @@ def run():
app = QtGui.QApplication([])
loader = ExampleLoader()
if sys.flags.interactive != 1:
app.exec_()
app.exec_()
if __name__ == '__main__':
run()

View File

@ -22,7 +22,7 @@ y = np.sin(x) / x
win = pg.GraphicsWindow(title="View Linking Examples")
win.resize(800,600)
win.addLabel("Views linked at runtime:", colspan=2)
win.addLabel("Linked Views", colspan=2)
win.nextRow()
p1 = win.addPlot(x=x, y=y, name="Plot1", title="Plot1")

View File

@ -215,7 +215,7 @@ class ViewBox(GraphicsWidget):
def resizeEvent(self, ev):
#self.setRange(self.range, padding=0)
self.updateAutoRange()
#self.updateAutoRange()
self.updateMatrix()
self.sigStateChanged.emit(self)
#self.linkedXChanged()
@ -609,10 +609,12 @@ class ViewBox(GraphicsWidget):
return self.mapToScene(self.mapFromView(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):
return item.mapFromScene(self.mapViewToScene(obj))
return self.childGroup.mapToItem(item, obj)
#return item.mapFromScene(self.mapViewToScene(obj))
def itemBoundingRect(self, item):
"""Return the bounding rect of the item in view coordinates"""