Refinement of "Center Person" selection for reports. Now only use one dialog.
svn: r9670
This commit is contained in:
parent
d053467a61
commit
22359b81c4
@ -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.
|
@ -615,65 +615,50 @@ class PersonOption(Option):
|
|||||||
def make_gui_obj(self, gtk, dialog):
|
def make_gui_obj(self, gtk, dialog):
|
||||||
self.dialog = dialog
|
self.dialog = dialog
|
||||||
self.gobj = gtk.HBox()
|
self.gobj = gtk.HBox()
|
||||||
|
self.person_label = gtk.Label()
|
||||||
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.set_alignment(0.0,0.5)
|
self.person_label.set_alignment(0.0,0.5)
|
||||||
|
|
||||||
self.person_button = GrampsWidgets.SimpleButton(gtk.STOCK_INDEX,
|
self.person_button = GrampsWidgets.SimpleButton(gtk.STOCK_INDEX,
|
||||||
self.get_person_clicked)
|
self.get_person_clicked)
|
||||||
self.bookmark_button = GrampsWidgets.SimpleButton('gramps-bookmark',
|
self.person_button.set_relief(gtk.RELIEF_NORMAL)
|
||||||
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.pevt = gtk.EventBox()
|
self.pevt = gtk.EventBox()
|
||||||
self.pevt.add(self.person_label)
|
self.pevt.add(self.person_label)
|
||||||
|
|
||||||
self.gobj.pack_start(self.pevt, False)
|
self.gobj.pack_start(self.pevt, False)
|
||||||
self.gobj.pack_end(self.person_button, 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)
|
person = self.db.get_person_from_gramps_id(self.get_value())
|
||||||
self.gobj.pack_end(self.active_button,False)
|
if not person:
|
||||||
|
person = self.dbstate.get_active_person()
|
||||||
|
self.update_person(person)
|
||||||
|
|
||||||
def parse(self):
|
def parse(self):
|
||||||
return self.get_value()
|
return self.get_value()
|
||||||
|
|
||||||
def get_person_clicked(self, obj):
|
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
|
from Filters import GenericFilter, Rules
|
||||||
bfilter = GenericFilter()
|
rfilter = GenericFilter()
|
||||||
bfilter.set_name(_("Bookmarked People"))
|
rfilter.set_logical_op('or')
|
||||||
bfilter.add_rule(Rules.Person.IsBookmarked([]))
|
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')
|
SelectPerson = selector_factory('Person')
|
||||||
sel = SelectPerson(self.dbstate, self.dialog.uistate,
|
sel = SelectPerson(self.dbstate, self.dialog.uistate,
|
||||||
self.dialog.track,
|
self.dialog.track,
|
||||||
title=_('Select a Bookmarked Person'),
|
title=_('Select a person for the report'),
|
||||||
filter=bfilter )
|
filter=rfilter )
|
||||||
person = sel.run()
|
person = sel.run()
|
||||||
self.update_person(person)
|
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):
|
def update_person(self,person):
|
||||||
if person:
|
if person:
|
||||||
name = _nd.display(person)
|
name = _nd.display(person)
|
||||||
@ -686,10 +671,7 @@ class PersonOption(Option):
|
|||||||
Add the option's help to the GUI object.
|
Add the option's help to the GUI object.
|
||||||
"""
|
"""
|
||||||
tooltip.set_tip(self.pevt, self.get_help())
|
tooltip.set_tip(self.pevt, self.get_help())
|
||||||
tooltip.set_tip(self.bookmark_button, _('Select a bookmarked person'))
|
tooltip.set_tip(self.person_button, _('Select a different 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'))
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
|
@ -96,7 +96,7 @@ def register_stock_icons ():
|
|||||||
('gramps-db', _('Family Trees'), gtk.gdk.CONTROL_MASK, 0, ''),
|
('gramps-db', _('Family Trees'), gtk.gdk.CONTROL_MASK, 0, ''),
|
||||||
('gramps-address', _('Address'), gtk.gdk.CONTROL_MASK, 0, ''),
|
('gramps-address', _('Address'), gtk.gdk.CONTROL_MASK, 0, ''),
|
||||||
('gramps-attribute', _('Attribute'), 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-delete', _('Delete bookmark'), gtk.gdk.CONTROL_MASK, 0, ''),
|
||||||
('gramps-bookmark-edit', _('Edit Bookmarks'), 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, ''),
|
('gramps-bookmark-new', _('Add Bookmark'), gtk.gdk.CONTROL_MASK, 0, ''),
|
||||||
|
Loading…
Reference in New Issue
Block a user