Geography : sometimes crash with unknown people or family.

svn: r21318
This commit is contained in:
Serge Noiraud 2013-02-07 23:25:46 +00:00
parent fed5cc6a71
commit 0465b9cf37
2 changed files with 19 additions and 8 deletions

View File

@ -209,12 +209,17 @@ class GeoClose(GeoGraphyView):
self._createmap(p1, color, self.place_list_active, False) self._createmap(p1, color, self.place_list_active, False)
if self.refperson: if self.refperson:
color = self._config.get('geography.color1') color = self._config.get('geography.color1')
self.message_layer.add_message(_("Reference : %(name)s ( %(birth)s - %(death)s )") % {'name': _nd.display(self.refperson), self.message_layer.add_message(_("Reference : %(name)s ( %(birth)s - %(death)s )") % {
'birth': self.birth(self.refperson), 'name': _nd.display(self.refperson),
'death': self.death(self.refperson)}) 'birth': self.birth(self.refperson),
self.message_layer.add_message(_("The other : %(name)s ( %(birth)s - %(death)s )") % {'name': _nd.display(p1), 'death': self.death(self.refperson)})
'birth': self.birth(p1), if p1:
'death': self.death(p1)}) self.message_layer.add_message(_("The other : %(name)s ( %(birth)s - %(death)s )") % {
'name': _nd.display(p1),
'birth': self.birth(p1),
'death': self.death(p1)})
else:
self.message_layer.add_message(_("The other person is unknown"))
self._createmap(self.refperson, color, self.place_list_ref, True) self._createmap(self.refperson, color, self.place_list_ref, True)
else: else:
self.message_layer.add_message(_("You must choose one reference person.")) self.message_layer.add_message(_("You must choose one reference person."))
@ -294,7 +299,10 @@ class GeoClose(GeoGraphyView):
active = self.get_active() active = self.get_active()
person = self.dbstate.db.get_person_from_handle(active) person = self.dbstate.db.get_person_from_handle(active)
self.lifeway_layer.clear_ways() self.lifeway_layer.clear_ways()
self.goto_handle(handle=person) if person is None:
self.goto_handle(None)
else:
self.goto_handle(handle=person)
def draw(self, menu, marks, color, reference): def draw(self, menu, marks, color, reference):
""" """

View File

@ -240,7 +240,10 @@ class GeoFamClose(GeoGraphyView):
color = self._config.get('geography.color1') color = self._config.get('geography.color1')
self._createmap(self.reffamily, color, self.place_list_ref, True) self._createmap(self.reffamily, color, self.place_list_ref, True)
self.message_layer.add_message(_("Family reference : %s" % self.family_label(self.reffamily))) self.message_layer.add_message(_("Family reference : %s" % self.family_label(self.reffamily)))
self.message_layer.add_message(_("The other family : %s" % self.family_label(f1))) if f1:
self.message_layer.add_message(_("The other family : %s" % self.family_label(f1)))
else:
self.message_layer.add_message(_("The other family : %s" % _("Unknown")))
else: else:
self.message_layer.add_message(_("You must choose one reference family.")) self.message_layer.add_message(_("You must choose one reference family."))
self.message_layer.add_message(_("Go to the family view and select " self.message_layer.add_message(_("Go to the family view and select "