Projects/laydi
Projects
/
laydi
Archived
7
0
Fork 0

Fixed bug with hidden dimensions.

This commit is contained in:
Einar Ryeng 2007-03-01 15:06:33 +00:00
parent d699afa6a5
commit 28e6c52f78
1 changed files with 16 additions and 9 deletions

View File

@ -443,6 +443,8 @@ class DimListController:
self._current_dim = None
self._seltree_controller = seltree_controller
self.show_hidden = False
## dimstore is a list of all dimensions in the application
self.dimstore = gtk.ListStore(gobject.TYPE_STRING)
@ -485,11 +487,11 @@ class DimListController:
"""Returns the iterator to the dimension with the given name, or
None if not found."""
i = self.dimstore.get_iter_first()
i = self.dimstore_filter.get_iter_first()
while i:
if self.dimstore.get_value(i, 0) == dim:
if self.dimstore_filter.get_value(i, 0) == dim:
return i
i = self.dimstore.iter_next(i)
i = self.dimstore_filter.iter_next(i)
return None
def set_dimension(self, dimname):
@ -497,10 +499,10 @@ class DimListController:
self._current_dim = dimname
dim = self.get_dimension(self._current_dim)
path = self.dimstore.get_path(dim)
path = self.dimstore_filter.get_path(dim)
if self.dimlist.get_cursor()[0] != path:
self.dimlist.set_cursor(self.dimstore.get_path(dim))
self.dimlist.set_cursor(self.dimstore_filter.get_path(dim))
self._seltree_controller.set_dimension(dimname)
def dataset_changed(self):
@ -512,12 +514,16 @@ class DimListController:
for dim in self.dim_names:
if not self.get_dimension(dim):
self.dimstore.insert_after(None, (dim,))
self.dimstore_filter.refilter()
#
# Private interface
#
def _dimension_filter(self, store, row):
"""Filters out dimensions with underscore prefix."""
if self.show_hidden:
return True
visible = False
name = store.get_value(row, 0)
if name != None:
@ -530,18 +536,19 @@ class DimListController:
def _on_dim_hide(self, menuitem):
"""Menu item callback function which hides underscore prefixed
dimensions."""
self.show_hidden = False
self.dimstore_filter.refilter()
self.dimlist.set_model(self.dimstore_filter)
def _on_dim_show(self, menuitem):
"""Menu item callback function that shows underscore prefixed
dimension names."""
self.dimlist.set_model(self.dimstore)
self.show_hidden = True
self.dimstore_filter.refilter()
def _dim_cursor_changed(self, widget):
cursor = self.dimlist.get_cursor()[0]
i = self.dimlist.get_model().get_iter(cursor)
row = self.dimlist.get_model().get_value(i, 0)
i = self.dimstore_filter.get_iter(cursor)
row = self.dimstore_filter.get_value(i, 0)
self.set_dimension(row)
self._seltree_controller.activate()