Projects/laydi
Projects
/
laydi
Archived
7
0
Fork 0

Selection listeners are now notified when new dimensions are added (because

this implies that an empty selection is made on the new dimension).
This commit is contained in:
Einar Ryeng 2007-02-21 12:05:08 +00:00
parent 5800e7e362
commit f0b2660813
2 changed files with 5 additions and 4 deletions

View File

@ -47,10 +47,9 @@ class Project:
def set_selection(self, dim_name, selection): def set_selection(self, dim_name, selection):
"""Sets a current selection and notify observers""" """Sets a current selection and notify observers"""
if self._last_selection != selection: self.sel_obj[dim_name] = set(selection)
self.sel_obj[dim_name] = set(selection) self.notify_selection_listeners(dim_name)
self.notify_selection_listeners(dim_name) self._last_selection = selection
self._last_selection = selection
def get_selection(self): def get_selection(self):
"""Returns the current selection object""" """Returns the current selection object"""
@ -117,6 +116,7 @@ class Project:
if dim_name not in self.dim_names: if dim_name not in self.dim_names:
self.dim_names.append(dim_name) self.dim_names.append(dim_name)
self.sel_obj[dim_name] = set() self.sel_obj[dim_name] = set()
self.notify_selection_listeners(dim_name)
self.notify_dataset_listeners() self.notify_dataset_listeners()
def add_selection(self, selection): def add_selection(self, selection):

View File

@ -193,6 +193,7 @@ 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]