Projects/laydi
Projects
/
laydi
Archived
7
0
Fork 0

Added selection listeners to plots in context menu

This commit is contained in:
Arnar Flatberg 2007-02-26 07:58:33 +00:00
parent a614908436
commit 3ee8439e07
1 changed files with 10 additions and 4 deletions

View File

@ -18,10 +18,10 @@ class NavigatorView (gtk.TreeView):
gtk.TreeView.__init__(self) gtk.TreeView.__init__(self)
# various properties # various properties
self.set_enable_tree_lines(True)
#self.set_enable_tree_lines(True)
self.set_headers_visible(False) self.set_headers_visible(False)
self.get_hadjustment().set_value(0) self.get_hadjustment().set_value(0)
self.set_enable_tree_lines(True)
# Selection Mode # Selection Mode
self.get_selection().set_mode(gtk.SELECTION_MULTIPLE) self.get_selection().set_mode(gtk.SELECTION_MULTIPLE)
@ -58,7 +58,7 @@ class NavigatorView (gtk.TreeView):
# sets data for drag event. # sets data for drag event.
def slot_drag_data(self,treeview,context,selection,target_id,etime): def slot_drag_data(self, treeview, context, selection, target_id, etime):
treeselection = treeview.get_selection() treeselection = treeview.get_selection()
model, paths = treeselection.get_selected_rows() model, paths = treeselection.get_selected_rows()
if paths: if paths:
@ -183,7 +183,7 @@ class NavigatorView (gtk.TreeView):
class NavigatorMenu(gtk.Menu): class NavigatorMenu(gtk.Menu):
def __init__(self, navigator): def __init__(self, navigator):
gtk.Menu.__init__(self) gtk.Menu.__init__(self)
self.navigaotor = navigator self.navigator = navigator
self.dataset = None self.dataset = None
self.tree_iter = None self.tree_iter = None
@ -277,9 +277,15 @@ class NavigatorMenu(gtk.Menu):
plot = plots.ImagePlot(self.dataset, name='Image Plot') plot = plots.ImagePlot(self.dataset, name='Image Plot')
icon = fluents.icon_factory.get("line_plot") icon = fluents.icon_factory.get("line_plot")
project.data_tree_insert(self.tree_iter, 'Image Plot', plot, None, "black", icon) project.data_tree_insert(self.tree_iter, 'Image Plot', plot, None, "black", icon)
# fixme: image plot selections are not well defined
#plot.set_selection_listener(project.set_selection)
#project._selection_observers.append(plot)
def on_plot_hist(self, item, navigator): def on_plot_hist(self, item, navigator):
project = navigator.project project = navigator.project
plot = plots.HistogramPlot(self.dataset, name='Histogram') plot = plots.HistogramPlot(self.dataset, name='Histogram')
icon = fluents.icon_factory.get("line_plot") icon = fluents.icon_factory.get("line_plot")
project.data_tree_insert(self.tree_iter, 'Histogram', plot, None, "black", icon) project.data_tree_insert(self.tree_iter, 'Histogram', plot, None, "black", icon)
plot.set_selection_listener(project.set_selection)
project._selection_observers.append(plot)