From 1ffbf4f9e7f754d5ee148987291907a87ecd8f55 Mon Sep 17 00:00:00 2001 From: einarr Date: Wed, 17 Jan 2007 15:35:12 +0000 Subject: [PATCH] Added default implementation of set_current_selection in Plot, so that plots can safely ignore selections without adding any code to the plot. Rectangle select mode, lasso select mode and freeze are now grayed out in ImagePlot. --- fluents/plots.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/fluents/plots.py b/fluents/plots.py index c3f2f77..3498500 100644 --- a/fluents/plots.py +++ b/fluents/plots.py @@ -476,6 +476,14 @@ class Plot (View): pass return ids + + def set_current_selection(self, selection): + """Called whenever the plot should change the selection. + + This method is a dummy method, so that specialized plots that have + no implemented selection can ignore selections alltogether. + """ + pass class LineViewPlot(Plot): """Line view plot with percentiles. @@ -802,18 +810,25 @@ class ImagePlot(Plot): self.ax.set_xticks([]) self.ax.set_yticks([]) self.ax.grid(False) + # FIXME: ax shouldn't be in kw at all if kw.has_key('ax'): kw.pop('ax') # Initial draw -# xim = AxesImage(dataset.asarray(), self.ax) self.ax.imshow(dataset.asarray(), interpolation='nearest', aspect='auto') # Add canvas and show self.add(self.canvas) self.canvas.show() + # Disable selection modes + btn = self._toolbar.get_button('select') + btn.set_sensitive(False) + btn = self._toolbar.get_button('lassoselect') + btn.set_sensitive(False) + self._toolbar.freeze_button.set_sensitive(False) + def get_toolbar(self): return self._toolbar @@ -1285,6 +1300,7 @@ class PlotToolbar(gtk.Toolbar): btn.set_icon_widget(image) btn.connect('toggled', self._on_freeze_toggle) self.insert(btn, -1) + self.freeze_button = btn self.show_all()