Projects/laydi
Projects
/
laydi
Archived
7
0
Fork 0

Added identifier list update on selection changed.

This commit is contained in:
Einar Ryeng 2007-02-26 18:02:34 +00:00
parent 537dc9f0ec
commit d040f11c2f
1 changed files with 18 additions and 0 deletions

View File

@ -105,6 +105,12 @@ class IdListController:
"""Set the selection to be displayed. """Set the selection to be displayed.
The selection is not stored, the values are copied into the TreeStore""" The selection is not stored, the values are copied into the TreeStore"""
self._idstore.clear() self._idstore.clear()
# Return if no selection
if selection == None:
return
# Otherwise show selection, possibly with annotations.
id_list = list(selection[self._dimension]) id_list = list(selection[self._dimension])
idlist = list(selection[self._dimension]) idlist = list(selection[self._dimension])
if self._annotation[self._dimension] != None: if self._annotation[self._dimension] != None:
@ -224,6 +230,9 @@ class SelectionListController:
# #
# Public interface # Public interface
# #
def activate(self):
self._seltree.set_cursor((0,))
def set_project(self, project): def set_project(self, project):
"""Dependency injection.""" """Dependency injection."""
self.project = project self.project = project
@ -258,6 +267,12 @@ class SelectionListController:
if row[1]==selection: if row[1]==selection:
row[3] = row[4] = len(selection[dim]) row[3] = row[4] = len(selection[dim])
path = self._seltree.get_cursor()
if path and self._sel_stores.has_key(self._dimension):
it = self._sel_stores[self._dimension].get_iter(path[0])
sel = self._sel_stores[self._dimension].get_value(it, 1)
self._idlist_controller.set_selection(sel)
def add_dataset(self, dataset): def add_dataset(self, dataset):
"""Converts a CategoryDataset to Selection objects and adds it to """Converts a CategoryDataset to Selection objects and adds it to
the selection tree. The name of the dataset will be the parent the selection tree. The name of the dataset will be the parent
@ -390,6 +405,8 @@ class SelectionListController:
if isinstance(obj, dataset.Selection): if isinstance(obj, dataset.Selection):
self._idlist_controller.set_selection(obj) self._idlist_controller.set_selection(obj)
else:
self._idlist_controller.set_selection(None)
def _on_row_activated(self, widget, path, column): def _on_row_activated(self, widget, path, column):
store = self._sel_stores[self._dimension] store = self._sel_stores[self._dimension]
@ -526,6 +543,7 @@ class DimListController:
i = self.dimlist.get_model().get_iter(cursor) i = self.dimlist.get_model().get_iter(cursor)
row = self.dimlist.get_model().get_value(i, 0) row = self.dimlist.get_model().get_value(i, 0)
self.set_dimension(row) self.set_dimension(row)
self._seltree_controller.activate()
def _dim_row_activated(self, widget, path, column): def _dim_row_activated(self, widget, path, column):
self._seltree_controller.set_dimension(dim) self._seltree_controller.set_dimension(dim)