* 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


svn: r7015
This commit is contained in:
Don Allingham 2006-07-10 21:46:46 +00:00
parent e3edec3107
commit 8236179ce3
5 changed files with 37 additions and 25 deletions

View File

@ -1,5 +1,8 @@
2006-07-10 Don Allingham <don@gramps-project.org> 2006-07-10 Don Allingham <don@gramps-project.org>
* src/DataViews/_FamlyList.py: add filter editor support * 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/_FilterEditor.py: add family support
* src/FilterEditor/_EditRule.py: add family support * src/FilterEditor/_EditRule.py: add family support
* src/Filters/_FamilySidebarFilter.py: start of family support * src/Filters/_FamilySidebarFilter.py: start of family support

View File

@ -29,6 +29,7 @@ import PageView
import DisplayModels import DisplayModels
import Bookmarks import Bookmarks
import Errors import Errors
import Config
import const import const
from Filters import FamilySidebarFilter from Filters import FamilySidebarFilter
@ -75,6 +76,9 @@ class FamilyListView(PageView.ListView):
self.updating = False self.updating = False
Config.client.notify_add("/apps/gramps/interface/filter",
self.filter_toggle)
def define_actions(self): def define_actions(self):
# add the Forward action group to handle the Forward button # 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'), self.add_action('FilterEdit', None, _('Family Filter Editor'),
callback=self.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): def filter_editor(self,obj):
from FilterEditor import FilterEditor from FilterEditor import FilterEditor
@ -116,9 +130,6 @@ class FamilyListView(PageView.ListView):
def ui_definition(self): def ui_definition(self):
return '''<ui> return '''<ui>
<menubar name="MenuBar"> <menubar name="MenuBar">
<menu action="ViewMenu">
<menuitem action="Filter"/>
</menu>
<menu action="EditMenu"> <menu action="EditMenu">
<placeholder name="CommonEdit"> <placeholder name="CommonEdit">
<menuitem action="Add"/> <menuitem action="Add"/>

View File

@ -95,6 +95,9 @@ class PersonView(PageView.PersonNavView):
'F3' : self.key_edit_selected_person, 'F3' : self.key_edit_selected_person,
} }
self.dirty = True self.dirty = True
Config.client.notify_add("/apps/gramps/interface/filter",
self.filter_toggle)
def change_page(self): def change_page(self):
pass pass
@ -129,10 +132,6 @@ class PersonView(PageView.PersonNavView):
self.add_action('Jump', None, _("_Jump"), self.add_action('Jump', None, _("_Jump"),
accel="<control>j",callback=self.jumpto) accel="<control>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, self.add_action('ColumnEdit', gtk.STOCK_PROPERTIES,
_('_Column Editor'), callback=self.column_editor,) _('_Column Editor'), callback=self.column_editor,)
@ -261,6 +260,7 @@ class PersonView(PageView.PersonNavView):
hpaned.pack_start(self.vbox, True, True) hpaned.pack_start(self.vbox, True, True)
hpaned.pack_end(self.filter_pane, False, False) hpaned.pack_end(self.filter_pane, False, False)
self.filter_toggle(None, None, None, None)
return hpaned return hpaned
def post(self): def post(self):
@ -286,9 +286,6 @@ class PersonView(PageView.PersonNavView):
return '''<ui> return '''<ui>
<accelerator action="Jump"/> <accelerator action="Jump"/>
<menubar name="MenuBar"> <menubar name="MenuBar">
<menu action="ViewMenu">
<menuitem action="Filter"/>
</menu>
<menu action="BookMenu"> <menu action="BookMenu">
<placeholder name="AddEditBook"> <placeholder name="AddEditBook">
<menuitem action="AddBook"/> <menuitem action="AddBook"/>
@ -468,15 +465,15 @@ class PersonView(PageView.PersonNavView):
else: else:
self.dirty = True self.dirty = True
if Config.get(Config.FILTER): # if Config.get(Config.FILTER):
self.search_bar.hide() # self.search_bar.hide()
self.filter_pane.show() # self.filter_pane.show()
else: # else:
self.search_bar.show() # self.search_bar.show()
self.filter_pane.hide() # self.filter_pane.hide()
def filter_toggle(self,obj): def filter_toggle(self, client, cnxn_id, etnry, data):
if obj.get_active(): if Config.get(Config.FILTER):
self.search_bar.hide() self.search_bar.hide()
self.filter_pane.show() self.filter_pane.show()
active = True active = True
@ -484,7 +481,6 @@ class PersonView(PageView.PersonNavView):
self.search_bar.show() self.search_bar.show()
self.filter_pane.hide() self.filter_pane.hide()
active = False active = False
Config.set(Config.FILTER, active)
self.build_tree() self.build_tree()
def add(self,obj): def add(self,obj):

View File

@ -467,6 +467,7 @@ class ListView(BookMarkView):
hpaned = gtk.HBox() hpaned = gtk.HBox()
hpaned.pack_start(self.vbox, True, True) hpaned.pack_start(self.vbox, True, True)
hpaned.pack_end(self.filter_pane, False, False) hpaned.pack_end(self.filter_pane, False, False)
self.filter_toggle(None, None, None, None)
return hpaned return hpaned
def post(self): def post(self):
@ -482,12 +483,6 @@ class ListView(BookMarkView):
self.generic_filter = self.filter_sidebar.get_filter() self.generic_filter = self.filter_sidebar.get_filter()
self.build_tree() 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): def add_bookmark(self, obj):
mlist = [] mlist = []
self.selection.selected_foreach(self.blist, mlist) self.selection.selected_foreach(self.blist, mlist)

View File

@ -123,6 +123,7 @@ uidefault = '''<ui>
<menu action="ViewMenu"> <menu action="ViewMenu">
<menuitem action="Sidebar"/> <menuitem action="Sidebar"/>
<menuitem action="Toolbar"/> <menuitem action="Toolbar"/>
<menuitem action="Filter"/>
<separator/> <separator/>
</menu> </menu>
<menu action="GoMenu"> <menu action="GoMenu">
@ -374,6 +375,8 @@ class ViewManager:
self.show_sidebar ), self.show_sidebar ),
('Toolbar', None, _('_Toolbar'), None, None, self.toolbar_toggle, ('Toolbar', None, _('_Toolbar'), None, None, self.toolbar_toggle,
self.show_toolbar ), self.show_toolbar ),
('Filter', None, _('Show Sidebar _Filter'), None, None, self.filter_toggle,
self.show_toolbar ),
] ]
self._undo_action_list = [ self._undo_action_list = [
@ -576,6 +579,10 @@ class ViewManager:
Config.set(Config.TOOLBAR_ON, False) Config.set(Config.TOOLBAR_ON, False)
Config.sync() Config.sync()
def filter_toggle(self, obj):
Config.set(Config.FILTER, obj.get_active())
Config.sync()
def register_view(self, view): def register_view(self, view):
self.views.append(view) self.views.append(view)