Fix handle errors in family lines graph

This commit is contained in:
Nick Hall
2015-12-29 18:14:43 +00:00
parent f4af5277e6
commit 715277d9ac

View File

@@ -486,18 +486,19 @@ class FamilyLinesReport(Report):
for family_handle in person.get_parent_family_handle_list():
family = self._db.get_family_from_handle(family_handle)
father = self._db.get_person_from_handle(
family.get_father_handle())
mother = self._db.get_person_from_handle(
family.get_mother_handle())
if father:
ancestorsNotYetProcessed.add(
family.get_father_handle())
self._families.add(family_handle)
if mother:
ancestorsNotYetProcessed.add(
family.get_mother_handle())
self._families.add(family_handle)
father_handle = family.get_father_handle()
if father_handle:
father = self._db.get_person_from_handle(father_handle)
if father:
ancestorsNotYetProcessed.add(father_handle)
self._families.add(family_handle)
mother_handle = family.get_mother_handle()
if mother_handle:
mother = self._db.get_person_from_handle(mother_handle)
if mother:
ancestorsNotYetProcessed.add(mother_handle)
self._families.add(family_handle)
def removeUninterestingParents(self):
# start with all the people we've already identified
@@ -750,16 +751,7 @@ class FamilyLinesReport(Report):
# get birth place (one of: city, state, or country) we can use
birthplace = None
if bth_event and self._incplaces:
place = self._db.get_place_from_handle(
bth_event.get_place_handle())
if place:
location = get_main_location(self._db, place)
if location.get(PlaceType.CITY):
birthplace = location.get(PlaceType.CITY)
elif location.get(PlaceType.STATE):
birthplace = location.get(PlaceType.STATE)
elif location.get(PlaceType.COUNTRY):
birthplace = location.get(PlaceType.COUNTRY)
birthplace = self.get_event_place(bth_event)
# see if we have a deceased date we can use
deathStr = None
@@ -773,16 +765,7 @@ class FamilyLinesReport(Report):
# get death place (one of: city, state, or country) we can use
deathplace = None
if dth_event and self._incplaces:
place = self._db.get_place_from_handle(
dth_event.get_place_handle())
if place:
location = get_main_location(self._db, place)
if location.get(PlaceType.CITY):
deathplace = location.get(PlaceType.CITY)
elif location.get(PlaceType.STATE):
deathplace = location.get(PlaceType.STATE)
elif location.get(PlaceType.COUNTRY):
deathplace = location.get(PlaceType.COUNTRY)
deathplace = self.get_event_place(dth_event)
# see if we have an image to use for this person
imagePath = None
@@ -902,16 +885,7 @@ class FamilyLinesReport(Report):
weddingDate = self._get_date(date)
# get the wedding location
if self._incplaces:
place = self._db.get_place_from_handle(
event.get_place_handle())
if place:
location = get_main_location(self._db, place)
if location.get(PlaceType.CITY):
weddingPlace = location.get(PlaceType.CITY)
elif location.get(PlaceType.STATE):
weddingPlace = location.get(PlaceType.STATE)
elif location.get(PlaceType.COUNTRY):
weddingPlace = location.get(PlaceType.COUNTRY)
weddingPlace = self.get_event_place(event)
break
# figure out the number of children (if any)
@@ -1012,3 +986,18 @@ class FamilyLinesReport(Report):
child = self._db.get_person_from_handle(childRef.ref)
comment = "child: %s" % child.get_primary_name().get_regular_name()
self.doc.add_link(fgid, child.get_gramps_id(), comment=comment)
def get_event_place(self, event):
place_text = None
place_handle = event.get_place_handle()
if place_handle:
place = self._db.get_place_from_handle(place_handle)
if place:
location = get_main_location(self._db, place)
if location.get(PlaceType.CITY):
place_text = location.get(PlaceType.CITY)
elif location.get(PlaceType.STATE):
place_text = location.get(PlaceType.STATE)
elif location.get(PlaceType.COUNTRY):
place_text = location.get(PlaceType.COUNTRY)
return place_text