Projects/laydi
Projects
/
laydi
Archived
7
0
Fork 0

Added reference to Selector objects to avoid the object from going to GC.

This change is triggered by changes to mpl, but should not break with
old versions.
This commit is contained in:
Einar Ryeng 2011-10-25 15:15:01 +00:00
parent 660f649670
commit 4dcbff3647
1 changed files with 4 additions and 0 deletions

View File

@ -695,6 +695,7 @@ class SelectLassoPlotMode(PlotMode):
for ax in self.canvas.figure.get_axes():
lasso = Selector(ax, self.plot.lasso_select_callback,
select_type='lasso')
self.lasso = lasso
self.cids.append(self.canvas.mpl_connect('button_release_event',
lasso._onrelease))
self.cids.append(self.canvas.mpl_connect('motion_notify_event',
@ -704,6 +705,7 @@ class SelectLassoPlotMode(PlotMode):
def deactivate(self):
for cid in self.cids:
self.canvas.mpl_disconnect(cid)
self.lasso = None
class SelectRectanglePlotMode(PlotMode):
@ -717,6 +719,7 @@ class SelectRectanglePlotMode(PlotMode):
for ax in self.canvas.figure.get_axes():
lasso = Selector(ax, self.plot.rectangle_select_callback,
select_type='rectangle')
self.lasso = lasso
self.cids.append(self.canvas.mpl_connect('button_release_event',
lasso._onrelease))
self.cids.append(self.canvas.mpl_connect('motion_notify_event',
@ -726,6 +729,7 @@ class SelectRectanglePlotMode(PlotMode):
def deactivate(self):
for cid in self.cids:
self.canvas.mpl_disconnect(cid)
self.lasso = None
class PlotToolbar(gtk.Toolbar):