Projects/laydi
Projects
/
laydi
Archived
7
0
Fork 0

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.
This commit is contained in:
Einar Ryeng 2007-01-17 15:35:12 +00:00
parent 06591e301e
commit 1ffbf4f9e7
1 changed files with 17 additions and 1 deletions

View File

@ -477,6 +477,14 @@ class Plot (View):
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()