Projects/laydi
Projects
/
laydi
Archived
7
0
Fork 0

Adding plots to panes is now done in row_activated_handler again, which makes it respond to double-clicks instead of just being selected in navigator.

This commit is contained in:
Truls Alexander Tangstad 2006-04-21 14:59:25 +00:00
parent 79481ed186
commit 0918f0019b
1 changed files with 15 additions and 3 deletions

View File

@ -16,6 +16,7 @@ class NavigatorView (gtk.TreeView):
self.set_headers_visible(False) self.set_headers_visible(False)
self.connect('cursor_changed', self.cursor_changed_handler) self.connect('cursor_changed', self.cursor_changed_handler)
self.connect('row_activated', self.row_activated_handler)
renderer = gtk.CellRendererText() renderer = gtk.CellRendererText()
self.object_col = gtk.TreeViewColumn('Object', renderer, text=0) self.object_col = gtk.TreeViewColumn('Object', renderer, text=0)
@ -28,12 +29,23 @@ class NavigatorView (gtk.TreeView):
model, tree_iter = selection.get_selected() model, tree_iter = selection.get_selected()
obj = self.data_tree.get_value(tree_iter, 2) obj = self.data_tree.get_value(tree_iter, 2)
if isinstance(obj, dataset.Dataset):
logger.log('debug', 'Selecting dataset')
self.project.set_current_data(obj)
elif not isinstance(obj, plots.Plot):
t = type(obj)
logger.log('debug', 'Selected datatype was %s. Don\'t know what to do.' % t)
def row_activated_handler(self, widget, path, column):
tree_iter = self.data_tree.get_iter(path)
obj = self.data_tree.get_value(tree_iter, 2)
if isinstance(obj, plots.Plot): if isinstance(obj, plots.Plot):
logger.log('debug', 'Activating plot') logger.log('debug', 'Activating plot')
self.app.change_plot(obj) self.app.change_plot(obj)
elif isinstance(obj, dataset.Dataset): elif isinstance(obj, dataset.Dataset):
logger.log('debug', 'Selecting dataset') # do nothing
self.project.set_current_data(obj) pass
else: else:
t = type(obj) t = type(obj)
logger.log('debug', 'Datatype was %s. Don\'t know what to do.' % t) logger.log('debug', 'Activated datatype was %s. Don\'t know what to do.' % t)