diff --git a/system/fluents.py b/system/fluents.py index 1c23b51..9e2849e 100755 --- a/system/fluents.py +++ b/system/fluents.py @@ -81,11 +81,17 @@ class FluentApp: self.init_gui() def change_plot(self, plot): - # add current selection to new plot + """Sets the plot in the currently active ViewFrame. If the plot is already + shown in another ViewFrame it will be moved from there.""" + # Set current selection in the plot before showing it. plot.selection_changed(self.project.get_selection()) pt = self.widget_tree.get_widget('main_view') pt.insert_view(plot) - + + def change_plots(self, plots): + """Changes all plots.""" + self['main_view'].set_all_plots(plots) + def get_active_view_frame(self): return self['main_view'].get_active_view_frame() diff --git a/system/navigator.py b/system/navigator.py index 33064be..68e8936 100644 --- a/system/navigator.py +++ b/system/navigator.py @@ -39,7 +39,9 @@ class NavigatorView (gtk.TreeView): self.append_column(self.object_col) # send events to plots / itself - self.enable_model_drag_source(gtk.gdk.BUTTON1_MASK,[("GTK_TREE_MODEL_ROW",gtk.TARGET_SAME_APP,7)], gtk.gdk.ACTION_LINK | gtk.gdk.ACTION_MOVE) + self.enable_model_drag_source(gtk.gdk.BUTTON1_MASK, + [("GTK_TREE_MODEL_ROW", gtk.TARGET_SAME_APP, 7)], + gtk.gdk.ACTION_LINK | gtk.gdk.ACTION_MOVE) self.connect("drag-data-get",self.slot_drag_data) @@ -78,10 +80,12 @@ class NavigatorView (gtk.TreeView): tmp = self._previous_selection self._previous_selection = paths # set timestamp on newly selected objects - [self.data_tree.set_value(self.data_tree.get_iter(path),6,time.time()) for path in paths if path not in tmp] + [self.data_tree.set_value(self.data_tree.get_iter(path), 6, time.time()) + for path in paths if path not in tmp] objs = [self.data_tree.get_iter(path) for path in paths] - objs = [(self.data_tree.get_value(iter,6), self.data_tree.get_value(iter,2)) for iter in objs] + objs = [(self.data_tree.get_value(iter,6), self.data_tree.get_value(iter,2)) + for iter in objs] objs.sort() objs = [obj for timestamp, obj in objs] # order dataset @@ -132,6 +136,15 @@ class NavigatorView (gtk.TreeView): self.app.change_plot(obj) elif isinstance(obj, dataset.Dataset): self.display_data_info(obj) + elif obj == None: + children = [] + i = self.data_tree.iter_children(tree_iter) + while i: + child = self.data_tree.get(i, 2)[0] + if isinstance(child, plots.Plot): + children.append(child) + i = self.data_tree.iter_next(i) + self.app.change_plots(children) else: t = type(obj) logger.log('debug', 'Activated datatype was %s. Don\'t know what to do.' % t) diff --git a/system/plots.py b/system/plots.py index cb66c58..1f13e73 100644 --- a/system/plots.py +++ b/system/plots.py @@ -214,7 +214,14 @@ class MainView (gtk.Notebook): else: vf = self._large_view vf.set_view(view) - + + def set_all_plots(self, plots): + for vf in self._view_frames: + if plots: + vf.set_view(plots.pop()) + else: + vf.set_view(None) + def show(self): for vf in self._view_frames: vf.show()