Geography : roles are important. This patch clarify this in popup menu.
svn: r17501
This commit is contained in:
parent
1ae953d816
commit
91d6538979
@ -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
|
||||
@ -569,6 +570,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
|
||||
|
@ -188,28 +188,6 @@ class GeoFamily(GeoGraphyView):
|
||||
else:
|
||||
self._createmap(self.uistate.get_active('Person'))
|
||||
|
||||
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 father")
|
||||
mnam = _nd.display(mother) if mother else _("Unknown mother")
|
||||
return ( fnam, mnam )
|
||||
|
||||
def _createpersonmarkers(self, dbstate, person, comment, fam_id):
|
||||
"""
|
||||
Create all markers for the specified person.
|
||||
@ -221,6 +199,7 @@ class GeoFamily(GeoGraphyView):
|
||||
for event_ref in person.get_event_ref_list():
|
||||
if not event_ref:
|
||||
continue
|
||||
role = event_ref.get_role()
|
||||
event = dbstate.db.get_event_from_handle(event_ref.ref)
|
||||
eyear = event.get_date_object().to_calendar(self.cal).get_year()
|
||||
place_handle = event.get_place_handle()
|
||||
@ -245,7 +224,7 @@ class GeoFamily(GeoGraphyView):
|
||||
str(descr1 + descr + str(evt)),
|
||||
_nd.display(person),
|
||||
latitude, longitude,
|
||||
descr1, eyear,
|
||||
role, eyear,
|
||||
event.get_type(),
|
||||
person.gramps_id,
|
||||
place.gramps_id,
|
||||
@ -262,6 +241,7 @@ class GeoFamily(GeoGraphyView):
|
||||
for event_ref in family.get_event_ref_list():
|
||||
if event_ref:
|
||||
event = dbstate.db.get_event_from_handle(event_ref.ref)
|
||||
role = event_ref.get_role()
|
||||
if event.get_place_handle():
|
||||
place_handle = event.get_place_handle()
|
||||
if place_handle:
|
||||
@ -283,7 +263,7 @@ class GeoFamily(GeoGraphyView):
|
||||
str(descr1 + descr + str(evt)),
|
||||
_nd.display(person),
|
||||
latitude, longitude,
|
||||
descr1, eyear,
|
||||
role, eyear,
|
||||
event.get_type(),
|
||||
person.gramps_id,
|
||||
place.gramps_id,
|
||||
@ -414,7 +394,18 @@ class GeoFamily(GeoGraphyView):
|
||||
self.add_place_bubble_message(event, lat, lon,
|
||||
marks, menu, message, mark)
|
||||
oldplace = mark[0]
|
||||
message = "%s" % mark[5]
|
||||
if ( mark[5] == gen.lib.EventRoleType.PRIMARY ):
|
||||
message = "%s : %s" % ( mark[7], mark[1] )
|
||||
elif ( mark[5] == gen.lib.EventRoleType.FAMILY ):
|
||||
evt = self.dbstate.db.get_event_from_gramps_id(mark[10])
|
||||
(father_name, mother_name) = self._get_father_and_mother_name(evt)
|
||||
message = "%s : %s - %s" % ( mark[7], father_name, mother_name )
|
||||
else:
|
||||
evt = self.dbstate.db.get_event_from_gramps_id(mark[10])
|
||||
descr = evt.get_description()
|
||||
if descr == "":
|
||||
descr = _('No description')
|
||||
message = "%s => %s" % ( mark[5], descr)
|
||||
prevmark = mark
|
||||
add_item = gtk.MenuItem(message)
|
||||
add_item.show()
|
||||
|
@ -259,6 +259,7 @@ class GeoPerson(GeoGraphyView):
|
||||
if not event_ref:
|
||||
continue
|
||||
event = dbstate.db.get_event_from_handle(event_ref.ref)
|
||||
role = event_ref.get_role()
|
||||
eyear = str("%04d" % event.get_date_object().to_calendar(self.cal).get_year()) + \
|
||||
str("%02d" % event.get_date_object().to_calendar(self.cal).get_month()) + \
|
||||
str("%02d" % event.get_date_object().to_calendar(self.cal).get_day())
|
||||
@ -287,7 +288,7 @@ class GeoPerson(GeoGraphyView):
|
||||
person.gramps_id,
|
||||
place.gramps_id,
|
||||
event.gramps_id,
|
||||
None
|
||||
role
|
||||
)
|
||||
else:
|
||||
self._append_to_places_without_coord(
|
||||
@ -309,6 +310,7 @@ class GeoPerson(GeoGraphyView):
|
||||
for event_ref in family.get_event_ref_list():
|
||||
if event_ref:
|
||||
event = dbstate.db.get_event_from_handle(event_ref.ref)
|
||||
role = event_ref.get_role()
|
||||
if event.get_place_handle():
|
||||
place_handle = event.get_place_handle()
|
||||
if place_handle:
|
||||
@ -332,7 +334,7 @@ class GeoPerson(GeoGraphyView):
|
||||
person.gramps_id,
|
||||
place.gramps_id,
|
||||
event.gramps_id,
|
||||
None
|
||||
role
|
||||
)
|
||||
else:
|
||||
self._append_to_places_without_coord( place.gramps_id, descr)
|
||||
@ -393,7 +395,18 @@ class GeoPerson(GeoGraphyView):
|
||||
marks, menu, message, mark)
|
||||
oldplace = mark[0]
|
||||
message = ""
|
||||
message = "%s : %s" % ( mark[2], mark[1] )
|
||||
if ( mark[11] == gen.lib.EventRoleType.PRIMARY ):
|
||||
message = "%s : %s" % ( mark[2], mark[1] )
|
||||
elif ( mark[11] == gen.lib.EventRoleType.FAMILY ):
|
||||
evt = self.dbstate.db.get_event_from_gramps_id(mark[10])
|
||||
(father_name, mother_name) = self._get_father_and_mother_name(evt)
|
||||
message = "%s : %s - %s" % ( mark[7], father_name, mother_name )
|
||||
else:
|
||||
evt = self.dbstate.db.get_event_from_gramps_id(mark[10])
|
||||
descr = evt.get_description()
|
||||
if descr == "":
|
||||
descr = _('No description')
|
||||
message = "%s => %s" % ( mark[11], descr)
|
||||
prevmark = mark
|
||||
add_item = gtk.MenuItem(message)
|
||||
add_item.show()
|
||||
|
Loading…
Reference in New Issue
Block a user