diff --git a/ChangeLog b/ChangeLog index 3afa341c4..6d2d1410b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2006-07-10 Don Allingham * src/DataViews/_FamlyList.py: add filter editor support + * src/DataViews/_PersonView.py: catch config callback for sidebar + * src/ViewManager.py: catch config callback for sidebar + * src/PageView.py: catch config callback for sidebar * src/FilterEditor/_FilterEditor.py: add family support * src/FilterEditor/_EditRule.py: add family support * src/Filters/_FamilySidebarFilter.py: start of family support diff --git a/src/DataViews/_FamilyList.py b/src/DataViews/_FamilyList.py index 3da05cac9..d3d0880f6 100644 --- a/src/DataViews/_FamilyList.py +++ b/src/DataViews/_FamilyList.py @@ -29,6 +29,7 @@ import PageView import DisplayModels import Bookmarks import Errors +import Config import const from Filters import FamilySidebarFilter @@ -75,6 +76,9 @@ class FamilyListView(PageView.ListView): self.updating = False + Config.client.notify_add("/apps/gramps/interface/filter", + self.filter_toggle) + def define_actions(self): # add the Forward action group to handle the Forward button @@ -83,6 +87,16 @@ class FamilyListView(PageView.ListView): self.add_action('FilterEdit', None, _('Family Filter Editor'), callback=self.filter_editor,) + def filter_toggle(self, client, cnxn_id, etnry, data): + if Config.get(Config.FILTER): + self.search_bar.hide() + self.filter_pane.show() + active = True + else: + self.search_bar.show() + self.filter_pane.hide() + active = False + def filter_editor(self,obj): from FilterEditor import FilterEditor @@ -116,9 +130,6 @@ class FamilyListView(PageView.ListView): def ui_definition(self): return ''' - - - diff --git a/src/DataViews/_PersonView.py b/src/DataViews/_PersonView.py index 083f01cc0..e2d4ccf0b 100644 --- a/src/DataViews/_PersonView.py +++ b/src/DataViews/_PersonView.py @@ -95,6 +95,9 @@ class PersonView(PageView.PersonNavView): 'F3' : self.key_edit_selected_person, } self.dirty = True + + Config.client.notify_add("/apps/gramps/interface/filter", + self.filter_toggle) def change_page(self): pass @@ -129,10 +132,6 @@ class PersonView(PageView.PersonNavView): self.add_action('Jump', None, _("_Jump"), accel="j",callback=self.jumpto) - self.add_toggle_action('Filter', None, _('_Show filter sidebar'), - None, None, - self.filter_toggle, Config.get(Config.FILTER)) - self.add_action('ColumnEdit', gtk.STOCK_PROPERTIES, _('_Column Editor'), callback=self.column_editor,) @@ -261,6 +260,7 @@ class PersonView(PageView.PersonNavView): hpaned.pack_start(self.vbox, True, True) hpaned.pack_end(self.filter_pane, False, False) + self.filter_toggle(None, None, None, None) return hpaned def post(self): @@ -286,9 +286,6 @@ class PersonView(PageView.PersonNavView): return ''' - - - @@ -468,15 +465,15 @@ class PersonView(PageView.PersonNavView): else: self.dirty = True - if Config.get(Config.FILTER): - self.search_bar.hide() - self.filter_pane.show() - else: - self.search_bar.show() - self.filter_pane.hide() +# if Config.get(Config.FILTER): +# self.search_bar.hide() +# self.filter_pane.show() +# else: +# self.search_bar.show() +# self.filter_pane.hide() - def filter_toggle(self,obj): - if obj.get_active(): + def filter_toggle(self, client, cnxn_id, etnry, data): + if Config.get(Config.FILTER): self.search_bar.hide() self.filter_pane.show() active = True @@ -484,7 +481,6 @@ class PersonView(PageView.PersonNavView): self.search_bar.show() self.filter_pane.hide() active = False - Config.set(Config.FILTER, active) self.build_tree() def add(self,obj): diff --git a/src/PageView.py b/src/PageView.py index d0d762914..3f8b9b65f 100644 --- a/src/PageView.py +++ b/src/PageView.py @@ -467,6 +467,7 @@ class ListView(BookMarkView): hpaned = gtk.HBox() hpaned.pack_start(self.vbox, True, True) hpaned.pack_end(self.filter_pane, False, False) + self.filter_toggle(None, None, None, None) return hpaned def post(self): @@ -482,12 +483,6 @@ class ListView(BookMarkView): self.generic_filter = self.filter_sidebar.get_filter() self.build_tree() - def define_actions(self): - BookMarkView.define_actions(self) - self.add_toggle_action('Filter', None, _('_Show filter sidebar'), - None, None, - self.filter_toggle, Config.get(Config.FILTER)) - def add_bookmark(self, obj): mlist = [] self.selection.selected_foreach(self.blist, mlist) diff --git a/src/ViewManager.py b/src/ViewManager.py index 80361500b..96fe3497c 100644 --- a/src/ViewManager.py +++ b/src/ViewManager.py @@ -123,6 +123,7 @@ uidefault = ''' + @@ -374,6 +375,8 @@ class ViewManager: self.show_sidebar ), ('Toolbar', None, _('_Toolbar'), None, None, self.toolbar_toggle, self.show_toolbar ), + ('Filter', None, _('Show Sidebar _Filter'), None, None, self.filter_toggle, + self.show_toolbar ), ] self._undo_action_list = [ @@ -576,6 +579,10 @@ class ViewManager: Config.set(Config.TOOLBAR_ON, False) Config.sync() + def filter_toggle(self, obj): + Config.set(Config.FILTER, obj.get_active()) + Config.sync() + def register_view(self, view): self.views.append(view)