Projects/laydi
Projects
/
laydi
Archived
7
0
Fork 0

Double clicking a function in the navigator causes the first four plots of that

function to be displayed in the main view. If the function has returned less
than four plots the remaining ViewFrames will be cleared.
This commit is contained in:
Einar Ryeng 2006-08-31 10:57:44 +00:00
parent 0b58c5ea28
commit 5c45308279
3 changed files with 32 additions and 6 deletions

View File

@ -81,11 +81,17 @@ class FluentApp:
self.init_gui() self.init_gui()
def change_plot(self, plot): 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()) plot.selection_changed(self.project.get_selection())
pt = self.widget_tree.get_widget('main_view') pt = self.widget_tree.get_widget('main_view')
pt.insert_view(plot) 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): def get_active_view_frame(self):
return self['main_view'].get_active_view_frame() return self['main_view'].get_active_view_frame()

View File

@ -39,7 +39,9 @@ class NavigatorView (gtk.TreeView):
self.append_column(self.object_col) self.append_column(self.object_col)
# send events to plots / itself # 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) self.connect("drag-data-get",self.slot_drag_data)
@ -78,10 +80,12 @@ class NavigatorView (gtk.TreeView):
tmp = self._previous_selection tmp = self._previous_selection
self._previous_selection = paths self._previous_selection = paths
# set timestamp on newly selected objects # 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_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.sort()
objs = [obj for timestamp, obj in objs] objs = [obj for timestamp, obj in objs]
# order dataset # order dataset
@ -132,6 +136,15 @@ class NavigatorView (gtk.TreeView):
self.app.change_plot(obj) self.app.change_plot(obj)
elif isinstance(obj, dataset.Dataset): elif isinstance(obj, dataset.Dataset):
self.display_data_info(obj) 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: else:
t = type(obj) t = type(obj)
logger.log('debug', 'Activated datatype was %s. Don\'t know what to do.' % t) logger.log('debug', 'Activated datatype was %s. Don\'t know what to do.' % t)

View File

@ -214,7 +214,14 @@ class MainView (gtk.Notebook):
else: else:
vf = self._large_view vf = self._large_view
vf.set_view(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): def show(self):
for vf in self._view_frames: for vf in self._view_frames:
vf.show() vf.show()