Added auto-expand and auto-commit

This commit is contained in:
Reidar Strand Hagen 2006-04-27 14:15:13 +00:00
parent 0df56248ee
commit c6ef6cdb07

View File

@ -19,6 +19,8 @@ class NavigatorView (gtk.TreeView):
self.connect('cursor_changed', self.cursor_changed_handler)
self.connect('row_activated', self.row_activated_handler)
# self.connect('row_inserted', self.row_changed_handler)
renderer = gtk.CellRendererText()
self.object_col = gtk.TreeViewColumn('Object', renderer, text=0)
self.append_column(self.object_col)
@ -29,6 +31,7 @@ class NavigatorView (gtk.TreeView):
self.project = project
self.data_tree = project.data_tree
self.set_model(project.data_tree)
self.data_tree.connect('row-changed',self.row_changed_handler)
def cursor_changed_handler(self, widget):
selection = widget.get_selection()
@ -42,6 +45,16 @@ class NavigatorView (gtk.TreeView):
t = type(obj)
logger.log('debug', 'Selected datatype was %s. Don\'t know what to do.' % t)
# TreeView changed. Expand new items!
def row_changed_handler(self, treestore, pos, iter):
obj = treestore.get_value(iter,2)
if not treestore.get_value(iter,2):
return
self.expand_to_path(pos)
if isinstance(treestore.get_value(iter,2),dataset.Dataset):
self.set_cursor(pos)
def display_data_info(self, data):
dims = zip(data.get_dim_names(), data.shape)