Refinement of "Center Person" selection for reports. Now only use one dialog.

svn: r9670
This commit is contained in:
Brian Matherly 2008-01-01 06:44:58 +00:00
parent d053467a61
commit 22359b81c4
3 changed files with 29 additions and 42 deletions

View File

@ -0,0 +1,5 @@
2008-01-01 Brian Matherly <brian@gramps-project.org>
* src/gramps_main.py:
* src/PluginUtils/_MenuOptions.py:
Refinement of "Center Person" selection for reports. Now only use one
dialog.

View File

@ -615,65 +615,50 @@ class PersonOption(Option):
def make_gui_obj(self, gtk, dialog):
self.dialog = dialog
self.gobj = gtk.HBox()
person = self.db.get_person_from_gramps_id(self.get_value())
if not person:
person = self.dbstate.get_active_person()
name = _nd.display(person)
gid = person.get_gramps_id()
self.person_label = gtk.Label( "%s (%s)" % (name,gid) )
self.person_label = gtk.Label()
self.person_label.set_alignment(0.0,0.5)
self.person_button = GrampsWidgets.SimpleButton(gtk.STOCK_INDEX,
self.get_person_clicked)
self.bookmark_button = GrampsWidgets.SimpleButton('gramps-bookmark',
self.get_bookmark_clicked)
self.home_button = GrampsWidgets.SimpleButton(gtk.STOCK_HOME,
self.get_home_clicked)
self.active_button = GrampsWidgets.SimpleButton(gtk.STOCK_YES,
self.get_active_clicked)
self.person_button.set_relief(gtk.RELIEF_NORMAL)
self.pevt = gtk.EventBox()
self.pevt.add(self.person_label)
self.gobj.pack_start(self.pevt, False)
self.gobj.pack_end(self.person_button, False)
self.gobj.pack_end(self.bookmark_button,False)
self.gobj.pack_end(self.home_button,False)
self.gobj.pack_end(self.active_button,False)
person = self.db.get_person_from_gramps_id(self.get_value())
if not person:
person = self.dbstate.get_active_person()
self.update_person(person)
def parse(self):
return self.get_value()
def get_person_clicked(self, obj):
SelectPerson = selector_factory('Person')
sel = SelectPerson(self.dbstate, self.dialog.uistate,
self.dialog.track)
person = sel.run()
self.update_person(person)
def get_bookmark_clicked(self,obj):
from Filters import GenericFilter, Rules
bfilter = GenericFilter()
bfilter.set_name(_("Bookmarked People"))
bfilter.add_rule(Rules.Person.IsBookmarked([]))
rfilter = GenericFilter()
rfilter.set_logical_op('or')
rfilter.add_rule(Rules.Person.IsBookmarked([]))
default_person = self.db.get_default_person()
if default_person:
id = default_person.get_gramps_id()
rfilter.add_rule(Rules.Person.HasIdOf([id]))
active_person = self.dbstate.get_active_person()
if active_person:
id = active_person.get_gramps_id()
rfilter.add_rule(Rules.Person.HasIdOf([id]))
SelectPerson = selector_factory('Person')
sel = SelectPerson(self.dbstate, self.dialog.uistate,
self.dialog.track,
title=_('Select a Bookmarked Person'),
filter=bfilter )
title=_('Select a person for the report'),
filter=rfilter )
person = sel.run()
self.update_person(person)
def get_home_clicked(self,obj):
person = self.db.get_default_person()
self.update_person(person)
def get_active_clicked(self,obj):
person = self.dbstate.get_active_person()
self.update_person(person)
def update_person(self,person):
if person:
name = _nd.display(person)
@ -686,10 +671,7 @@ class PersonOption(Option):
Add the option's help to the GUI object.
"""
tooltip.set_tip(self.pevt, self.get_help())
tooltip.set_tip(self.bookmark_button, _('Select a bookmarked person'))
tooltip.set_tip(self.home_button, _('Select the "home" person'))
tooltip.set_tip(self.active_button, _('Select the currently active person'))
tooltip.set_tip(self.person_button, _('Select any person from the database'))
tooltip.set_tip(self.person_button, _('Select a different person'))
#-------------------------------------------------------------------------
#

View File

@ -96,7 +96,7 @@ def register_stock_icons ():
('gramps-db', _('Family Trees'), gtk.gdk.CONTROL_MASK, 0, ''),
('gramps-address', _('Address'), gtk.gdk.CONTROL_MASK, 0, ''),
('gramps-attribute', _('Attribute'), gtk.gdk.CONTROL_MASK, 0, ''),
('gramps-bookmark', _('Bookmarks'), gtk.gdk.CONTROL_MASK, 0, ''),
#('gramps-bookmark', _('Bookmarks'), gtk.gdk.CONTROL_MASK, 0, ''),
#('gramps-bookmark-delete', _('Delete bookmark'), gtk.gdk.CONTROL_MASK, 0, ''),
('gramps-bookmark-edit', _('Edit Bookmarks'), gtk.gdk.CONTROL_MASK, 0, ''),
('gramps-bookmark-new', _('Add Bookmark'), gtk.gdk.CONTROL_MASK, 0, ''),