Archived
7
0

Annotation display now works (sort of).

This commit is contained in:
2007-02-21 16:39:04 +00:00
parent 28aca8c621
commit 2bae169f38

@ -38,6 +38,9 @@ class IdListController:
self._idstore = gtk.ListStore(gobject.TYPE_STRING, self._idstore = gtk.ListStore(gobject.TYPE_STRING,
gobject.TYPE_STRING,) gobject.TYPE_STRING,)
# Annotation tree column
self._annotation_column = None
## Set up identifier list ## Set up identifier list
idlist.set_model(self._idstore) idlist.set_model(self._idstore)
@ -64,6 +67,8 @@ class IdListController:
if dimname == self._dimension: if dimname == self._dimension:
return return
self.set_annotation(self._annotation.get(dimname, None))
if not self._annotation.has_key(dimname): if not self._annotation.has_key(dimname):
self._annotation[dimname] = None self._annotation[dimname] = None
self._dimension = dimname self._dimension = dimname
@ -73,14 +78,28 @@ class IdListController:
the annotation column is hidden. Otherwise the annotation column is the annotation column is hidden. Otherwise the annotation column is
shown and filled with values from the given annotation field.""" shown and filled with values from the given annotation field."""
if annotation == self._annotation: if annotation == None:
return if self._annotation_column != None:
self._idlist.remove_column(self._annotation_column)
if self.annotation == None: self._annotation_column = None
self._idlist.remove_column(self._annotation_colum)
else: else:
for x in self._idstore:
print "set annotation:", x idlist = [x[0] for x in self._idstore]
annlist = annotations.get_dim_annotations(self._dimension,
annotation,
idlist)
for i, x in enumerate(self._idstore):
x[1] = annlist[i]
if self._annotation_column == None:
renderer = gtk.CellRendererText()
col = gtk.TreeViewColumn(annotation, renderer, text=1)
self._idlist.append_column(col)
self._annotation_column = col
self._annotation_column.set_title(annotation)
self._annotation[self._dimension] = annotation
def set_selection(self, selection): def set_selection(self, selection):
"""Set the selection to be displayed. """Set the selection to be displayed.
@ -109,7 +128,6 @@ class IdListController:
dim_h = annotations.get_dim_handler(self._dimension) dim_h = annotations.get_dim_handler(self._dimension)
if not dim_h: if not dim_h:
print "No annotations etc"
self._menu_ann.set_sensitive(False) self._menu_ann.set_sensitive(False)
else: else:
annotations_menu = gtk.Menu() annotations_menu = gtk.Menu()
@ -215,7 +233,6 @@ class SelectionListController:
def selection_changed(self, dimname, selection): def selection_changed(self, dimname, selection):
"""Callback function from Project.""" """Callback function from Project."""
print "selection changed"
for dim in selection.dims(): for dim in selection.dims():
self._ensure_selection_store(dim) self._ensure_selection_store(dim)
store = self._sel_stores[dim] store = self._sel_stores[dim]