geography : add roles to geoperson. some cleaning.

svn: r17418
This commit is contained in:
Serge Noiraud
2011-05-05 13:26:51 +00:00
parent 76887ee818
commit a2d99db5a6
3 changed files with 44 additions and 26 deletions

View File

@@ -56,6 +56,7 @@ import gtk
#-------------------------------------------------------------------------
import gen.lib
import Utils
from gen.display.name import displayer as _nd
from gui.views.navigationview import NavigationView
from libformatting import FormattingHelper
import Errors
@@ -562,6 +563,28 @@ class GeoGraphyView(osmGpsMap, NavigationView):
self.save_center(self.latit, self.longt)
config.set("geography.zoom",self.new_zoom)
def _get_father_and_mother_name(self, event):
"""
Return the father and mother name of a family event
"""
dbstate = self.dbstate
family_list = [
dbstate.db.get_family_from_handle(ref_handle)
for (ref_type, ref_handle) in
dbstate.db.find_backlink_handles(event.handle)
if ref_type == 'Family'
]
fnam = mnam = _("Unknown")
if family_list:
for family in family_list:
handle = family.get_father_handle()
father = dbstate.db.get_person_from_handle(handle)
handle = family.get_mother_handle()
mother = dbstate.db.get_person_from_handle(handle)
fnam = _nd.display(father) if father else _("Unknown")
mnam = _nd.display(mother) if mother else _("Unknown")
return ( fnam, mnam )
#-------------------------------------------------------------------------
#
# Specific functionalities