* 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>
* 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

View File

@ -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 '''<ui>
<menubar name="MenuBar">
<menu action="ViewMenu">
<menuitem action="Filter"/>
</menu>
<menu action="EditMenu">
<placeholder name="CommonEdit">
<menuitem action="Add"/>

View File

@ -96,6 +96,9 @@ class PersonView(PageView.PersonNavView):
}
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="<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,
_('_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 '''<ui>
<accelerator action="Jump"/>
<menubar name="MenuBar">
<menu action="ViewMenu">
<menuitem action="Filter"/>
</menu>
<menu action="BookMenu">
<placeholder name="AddEditBook">
<menuitem action="AddBook"/>
@ -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):

View File

@ -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)

View File

@ -123,6 +123,7 @@ uidefault = '''<ui>
<menu action="ViewMenu">
<menuitem action="Sidebar"/>
<menuitem action="Toolbar"/>
<menuitem action="Filter"/>
<separator/>
</menu>
<menu action="GoMenu">
@ -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)