From d040f11c2f19ae573d7d6700ebd5b1626ea75693 Mon Sep 17 00:00:00 2001 From: einarr Date: Mon, 26 Feb 2007 18:02:34 +0000 Subject: [PATCH] Added identifier list update on selection changed. --- fluents/selections.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/fluents/selections.py b/fluents/selections.py index a1ea856..43d1b0f 100644 --- a/fluents/selections.py +++ b/fluents/selections.py @@ -105,6 +105,12 @@ class IdListController: """Set the selection to be displayed. The selection is not stored, the values are copied into the TreeStore""" self._idstore.clear() + + # Return if no selection + if selection == None: + return + + # Otherwise show selection, possibly with annotations. id_list = list(selection[self._dimension]) idlist = list(selection[self._dimension]) if self._annotation[self._dimension] != None: @@ -224,6 +230,9 @@ class SelectionListController: # # Public interface # + def activate(self): + self._seltree.set_cursor((0,)) + def set_project(self, project): """Dependency injection.""" self.project = project @@ -258,6 +267,12 @@ class SelectionListController: if row[1]==selection: 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): """Converts a CategoryDataset to Selection objects and adds it to the selection tree. The name of the dataset will be the parent @@ -390,6 +405,8 @@ class SelectionListController: if isinstance(obj, dataset.Selection): self._idlist_controller.set_selection(obj) + else: + self._idlist_controller.set_selection(None) def _on_row_activated(self, widget, path, column): store = self._sel_stores[self._dimension] @@ -526,6 +543,7 @@ class DimListController: i = self.dimlist.get_model().get_iter(cursor) row = self.dimlist.get_model().get_value(i, 0) self.set_dimension(row) + self._seltree_controller.activate() def _dim_row_activated(self, widget, path, column): self._seltree_controller.set_dimension(dim)