Annotation display now works (sort of).

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

View File

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