From 4dcbff364772ea7bd6d7824fa7a9059073db87df Mon Sep 17 00:00:00 2001 From: einarr Date: Tue, 25 Oct 2011 15:15:01 +0000 Subject: [PATCH] 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. --- laydi/view.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/laydi/view.py b/laydi/view.py index 48924ca..3ddaa8e 100644 --- a/laydi/view.py +++ b/laydi/view.py @@ -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):