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:
parent
06591e301e
commit
1ffbf4f9e7
|
@ -476,6 +476,14 @@ class Plot (View):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
return ids
|
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):
|
class LineViewPlot(Plot):
|
||||||
"""Line view plot with percentiles.
|
"""Line view plot with percentiles.
|
||||||
|
@ -802,18 +810,25 @@ class ImagePlot(Plot):
|
||||||
self.ax.set_xticks([])
|
self.ax.set_xticks([])
|
||||||
self.ax.set_yticks([])
|
self.ax.set_yticks([])
|
||||||
self.ax.grid(False)
|
self.ax.grid(False)
|
||||||
|
|
||||||
# FIXME: ax shouldn't be in kw at all
|
# FIXME: ax shouldn't be in kw at all
|
||||||
if kw.has_key('ax'):
|
if kw.has_key('ax'):
|
||||||
kw.pop('ax')
|
kw.pop('ax')
|
||||||
|
|
||||||
# Initial draw
|
# Initial draw
|
||||||
# xim = AxesImage(dataset.asarray(), self.ax)
|
|
||||||
self.ax.imshow(dataset.asarray(), interpolation='nearest', aspect='auto')
|
self.ax.imshow(dataset.asarray(), interpolation='nearest', aspect='auto')
|
||||||
|
|
||||||
# Add canvas and show
|
# Add canvas and show
|
||||||
self.add(self.canvas)
|
self.add(self.canvas)
|
||||||
self.canvas.show()
|
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):
|
def get_toolbar(self):
|
||||||
return self._toolbar
|
return self._toolbar
|
||||||
|
|
||||||
|
@ -1285,6 +1300,7 @@ class PlotToolbar(gtk.Toolbar):
|
||||||
btn.set_icon_widget(image)
|
btn.set_icon_widget(image)
|
||||||
btn.connect('toggled', self._on_freeze_toggle)
|
btn.connect('toggled', self._on_freeze_toggle)
|
||||||
self.insert(btn, -1)
|
self.insert(btn, -1)
|
||||||
|
self.freeze_button = btn
|
||||||
|
|
||||||
self.show_all()
|
self.show_all()
|
||||||
|
|
||||||
|
|
Reference in New Issue