From 149e3516652ff8f39715c9cf60f16a228ec38283 Mon Sep 17 00:00:00 2001 From: Alex Roitman Date: Tue, 25 Jan 2005 04:46:52 +0000 Subject: [PATCH] * src/ReportUtils.py (born_died_str,married_str,child_str): Add functions. * src/plugins/FtmStyleDescendants.py, src/plugins/FtmStyleAncestors.py: Use common strings from ReportUtils. svn: r3960 --- ChangeLog | 5 + src/ReportUtils.py | 486 +++++++++++++ src/plugins/FtmStyleAncestors.py | 741 +------------------- src/plugins/FtmStyleDescendants.py | 1025 +--------------------------- 4 files changed, 555 insertions(+), 1702 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5ce18ca45..76c18db8a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -30,6 +30,11 @@ * src/docgen/LPRDoc.py (LPRDoc.draw_box): Shadow support. + * src/ReportUtils.py (born_died_str,married_str,child_str): + Add functions. + * src/plugins/FtmStyleDescendants.py, + src/plugins/FtmStyleAncestors.py: Use common strings from ReportUtils. + 2005-01-23 Don Allingham * src/BaseDoc.py: don't check for init on table or cell addition * src/Report.py: Call doc.init() before write_report diff --git a/src/ReportUtils.py b/src/ReportUtils.py index 3daed79b1..70eaa6d58 100644 --- a/src/ReportUtils.py +++ b/src/ReportUtils.py @@ -331,6 +331,492 @@ def roman(num): num -= vals[i] * amount return retval +#------------------------------------------------------------------------- +# +# Strings commonly used in reports +# +#------------------------------------------------------------------------- +def empty_notes(): + # Empty stab function for when endnotes are not needed + return "" + +def born_died_str(database,person,endnotes=None,name_object=None,person_name=None): + """ + Composes a string describing birth and death of a person. + + The string is composed in the following form: + "Such-and-such was born on-a-date in a-place, + and died on-a-date in a-place" + Missing information will be omitted without loss of readability. + Optional references may be added to birth and death events. + Optional Name object may be used to override a person's Name instance. + Optional string may be used to override the string representation of a name. + + @param database GRAMPS database to which the Person object belongs + @type db: GrampsDbBase + @param person: Person instance for which the string has to be composed + @type person: Person + @param endnotes: Function to use for reference composition. If None + then references will not be added + @type endnotes: function + @param name_object: Name instance for which the phrase is composed. If None + then the regular primary name of the person will be used + @type name_object: Name + @param person_name: String to override the person's name. If None then the + regular primary name string will be used + @type person_name: unicode + @returns: A composed string + @rtype: unicode + """ + + if not endnotes: + endnotes = empty_notes + + if not name_object: + name_object = person.get_primary_name() + + if person_name == None: + person_name = name_object.get_regular_name() + elif person_name == 0: + if person.get_gender() == RelLib.Person.male: + person_name = _('He') + else: + person_name = _('She') + + birth_handle = person.get_birth_handle() + bplace = "" + bdate = "" + if birth_handle: + birth = database.get_event_from_handle(birth_handle) + bdate = birth.get_date() + bplace_handle = birth.get_place_handle() + if bplace_handle: + bplace = database.get_place_from_handle(bplace_handle).get_title() + + death_handle = person.get_death_handle() + dplace = "" + ddate = "" + if death_handle: + death = database.get_event_from_handle(death_handle) + ddate = death.get_date() + dplace_handle = death.get_place_handle() + if dplace_handle: + dplace = database.get_place_from_handle(dplace_handle).get_title() + + if person.get_gender() == RelLib.Person.male: + if bdate: + if bplace: + if ddate: + if dplace: + text = _("%(male_name)s%(endnotes)s " + "was born %(birth_date)s in %(birth_place)s%(birth_endnotes)s, " + "and died %(death_date)s in %(death_place)s%(death_endnotes)s.") % { + 'male_name' : person_name, 'endnotes' : endnotes(name_object), + 'birth_date' : bdate, 'birth_place' : bplace, + 'death_date' : ddate,'death_place' : dplace, + 'birth_endnotes' : endnotes(birth), + 'death_endnotes' : endnotes(death) } + else: + text = _("%(male_name)s%(endnotes)s " + "was born %(birth_date)s in %(birth_place)s%(birth_endnotes)s, " + "and died %(death_date)s%(death_endnotes)s.") % { + 'male_name' : person_name, 'endnotes' : endnotes(name_object), + 'birth_date' : bdate, 'birth_place' : bplace, 'death_date' : ddate, + 'birth_endnotes' : endnotes(birth), + 'death_endnotes' : endnotes(death) } + else: + if dplace: + text = _("%(male_name)s%(endnotes)s " + "was born %(birth_date)s in %(birth_place)s%(birth_endnotes)s, " + "and died in %(death_place)s%(death_endnotes)s.") % { + 'male_name' : person_name, 'endnotes' : endnotes(name_object), + 'birth_date' : bdate, 'birth_place' : bplace, 'death_place' : dplace, + 'birth_endnotes' : endnotes(birth), + 'death_endnotes' : endnotes(death) } + else: + text = _("%(male_name)s%(endnotes)s " + "was born %(birth_date)s in %(birth_place)s%(birth_endnotes)s.") % { + 'male_name' : person_name, 'endnotes' : endnotes(name_object), + 'birth_date' : bdate, 'birth_place' : bplace, + 'birth_endnotes' : endnotes(birth) } + else: + if ddate: + if dplace: + text = _("%(male_name)s%(endnotes)s " + "was born %(birth_date)s%(birth_endnotes)s, " + "and died %(death_date)s in %(death_place)s%(death_endnotes)s.") % { + 'male_name' : person_name, 'endnotes' : endnotes(name_object), + 'birth_date' : bdate, + 'death_date' : ddate,'death_place' : dplace, + 'birth_endnotes' : endnotes(birth), + 'death_endnotes' : endnotes(death) } + else: + text = _("%(male_name)s%(endnotes)s " + "was born %(birth_date)s%(birth_endnotes)s, " + "and died %(death_date)s%(death_endnotes)s.") % { + 'male_name' : person_name, 'endnotes' : endnotes(name_object), + 'birth_date' : bdate, 'death_date' : ddate, + 'birth_endnotes' : endnotes(birth), + 'death_endnotes' : endnotes(death) } + else: + if dplace: + text = _("%(male_name)s%(endnotes)s " + "was born %(birth_date)s%(birth_endnotes)s, " + "and died in %(death_place)s%(death_endnotes)s.") % { + 'male_name' : person_name, 'endnotes' : endnotes(name_object), + 'birth_date' : bdate, 'death_place' : dplace, + 'birth_endnotes' : endnotes(birth), + 'death_endnotes' : endnotes(death) } + else: + text = _("%(male_name)s%(endnotes)s " + "was born %(birth_date)s%(birth_endnotes)s.") % { + 'male_name' : person_name, 'endnotes' : endnotes(name_object), + 'birth_date' : bdate, 'birth_endnotes' : endnotes(birth) } + else: + if bplace: + if ddate: + if dplace: + text = _("%(male_name)s%(endnotes)s " + "was born in %(birth_place)s%(birth_endnotes)s, " + "and died %(death_date)s in %(death_place)s%(death_endnotes)s.") % { + 'male_name' : person_name, 'endnotes' : endnotes(name_object), + 'birth_place' : bplace, + 'death_date' : ddate,'death_place' : dplace, + 'birth_endnotes' : endnotes(birth), + 'death_endnotes' : endnotes(death) } + else: + text = _("%(male_name)s%(endnotes)s " + "was born in %(birth_place)s%(birth_endnotes)s, " + "and died %(death_date)s%(death_endnotes)s.") % { + 'male_name' : person_name, 'endnotes' : endnotes(name_object), + 'birth_place' : bplace, 'death_date' : ddate, + 'birth_endnotes' : endnotes(birth), + 'death_endnotes' : endnotes(death) } + else: + if dplace: + text = _("%(male_name)s%(endnotes)s " + "was born in %(birth_place)s%(birth_endnotes)s, " + "and died in %(death_place)s%(death_endnotes)s.") % { + 'male_name' : person_name, 'endnotes' : endnotes(name_object), + 'birth_place' : bplace, 'death_place' : dplace, + 'birth_endnotes' : endnotes(birth), + 'death_endnotes' : endnotes(death) } + else: + text = _("%(male_name)s%(endnotes)s " + "was born in %(birth_place)s%(birth_endnotes)s.") % { + 'male_name' : person_name, 'endnotes' : endnotes(name_object), + 'birth_place' : bplace, + 'birth_endnotes' : endnotes(birth) } + else: + if ddate: + if dplace: + text = _("%(male_name)s%(endnotes)s " + "died %(death_date)s in %(death_place)s%(death_endnotes)s.") % { + 'male_name' : person_name, 'endnotes' : endnotes(name_object), + 'death_date' : ddate, 'death_place' : dplace, + 'death_endnotes' : endnotes(death) } + else: + text = _("%(male_name)s%(endnotes)s " + "died %(death_date)s%(death_endnotes)s.") % { + 'male_name' : person_name, 'endnotes' : endnotes(name_object), + 'death_date' : ddate, + 'death_endnotes' : endnotes(death) } + else: + if dplace: + text = _("%(male_name)s%(endnotes)s " + "died in %(death_place)s%(death_endnotes)s.") % { + 'male_name' : person_name, 'endnotes' : endnotes(name_object), + 'death_place' : dplace, + 'death_endnotes' : endnotes(death) } + else: + text = _("%(male_name)s%(endnotes)s.") % { + 'male_name' : person_name, 'endnotes' : endnotes(name_object) } + else: + if bdate: + if bplace: + if ddate: + if dplace: + text = _("%(female_name)s%(endnotes)s " + "was born %(birth_date)s in %(birth_place)s%(birth_endnotes)s, " + "and died %(death_date)s in %(death_place)s%(death_endnotes)s.") % { + 'female_name' : person_name, 'endnotes' : endnotes(name_object), + 'birth_date' : bdate, 'birth_place' : bplace, + 'death_date' : ddate,'death_place' : dplace, + 'birth_endnotes' : endnotes(birth), + 'death_endnotes' : endnotes(death) } + else: + text = _("%(female_name)s%(endnotes)s " + "was born %(birth_date)s in %(birth_place)s%(birth_endnotes)s, " + "and died %(death_date)s%(death_endnotes)s.") % { + 'female_name' : person_name, 'endnotes' : endnotes(name_object), + 'birth_date' : bdate, 'birth_place' : bplace, 'death_date' : ddate, + 'birth_endnotes' : endnotes(birth), + 'death_endnotes' : endnotes(death) } + else: + if dplace: + text = _("%(female_name)s%(endnotes)s " + "was born %(birth_date)s in %(birth_place)s%(birth_endnotes)s, " + "and died in %(death_place)s%(death_endnotes)s.") % { + 'female_name' : person_name, 'endnotes' : endnotes(name_object), + 'birth_date' : bdate, 'birth_place' : bplace, 'death_place' : dplace, + 'birth_endnotes' : endnotes(birth), + 'death_endnotes' : endnotes(death) } + else: + text = _("%(female_name)s%(endnotes)s " + "was born %(birth_date)s in %(birth_place)s%(birth_endnotes)s.") % { + 'female_name' : person_name, 'endnotes' : endnotes(name_object), + 'birth_date' : bdate, 'birth_place' : bplace, + 'birth_endnotes' : endnotes(birth) } + else: + if ddate: + if dplace: + text = _("%(female_name)s%(endnotes)s " + "was born %(birth_date)s%(birth_endnotes)s, " + "and died %(death_date)s in %(death_place)s%(death_endnotes)s.") % { + 'female_name' : person_name, 'endnotes' : endnotes(name_object), + 'birth_date' : bdate, + 'death_date' : ddate,'death_place' : dplace, + 'birth_endnotes' : endnotes(birth), + 'death_endnotes' : endnotes(death) } + else: + text = _("%(female_name)s%(endnotes)s " + "was born %(birth_date)s%(birth_endnotes)s, " + "and died %(death_date)s%(death_endnotes)s.") % { + 'female_name' : person_name, 'endnotes' : endnotes(name_object), + 'birth_date' : bdate, 'death_date' : ddate, + 'birth_endnotes' : endnotes(birth), + 'death_endnotes' : endnotes(death) } + else: + if dplace: + text = _("%(female_name)s%(endnotes)s " + "was born %(birth_date)s%(birth_endnotes)s, " + "and died in %(death_place)s%(death_endnotes)s.") % { + 'female_name' : person_name, 'endnotes' : endnotes(name_object), + 'birth_date' : bdate, 'death_place' : dplace, + 'birth_endnotes' : endnotes(birth), + 'death_endnotes' : endnotes(death) } + else: + text = _("%(female_name)s%(endnotes)s " + "was born %(birth_date)s%(birth_endnotes)s.") % { + 'female_name' : person_name, 'endnotes' : endnotes(name_object), + 'birth_date' : bdate, 'birth_endnotes' : endnotes(birth) } + else: + if bplace: + if ddate: + if dplace: + text = _("%(female_name)s%(endnotes)s " + "was born in %(birth_place)s%(birth_endnotes)s, " + "and died %(death_date)s in %(death_place)s%(death_endnotes)s.") % { + 'female_name' : person_name, 'endnotes' : endnotes(name_object), + 'birth_place' : bplace, + 'death_date' : ddate,'death_place' : dplace, + 'birth_endnotes' : endnotes(birth), + 'death_endnotes' : endnotes(death) } + else: + text = _("%(female_name)s%(endnotes)s " + "was born in %(birth_place)s%(birth_endnotes)s, " + "and died %(death_date)s%(death_endnotes)s.") % { + 'female_name' : person_name, 'endnotes' : endnotes(name_object), + 'birth_place' : bplace, 'death_date' : ddate, + 'birth_endnotes' : endnotes(birth), + 'death_endnotes' : endnotes(death) } + else: + if dplace: + text = _("%(female_name)s%(endnotes)s " + "was born in %(birth_place)s%(birth_endnotes)s, " + "and died in %(death_place)s%(death_endnotes)s.") % { + 'female_name' : person_name, 'endnotes' : endnotes(name_object), + 'birth_place' : bplace, 'death_place' : dplace, + 'birth_endnotes' : endnotes(birth), + 'death_endnotes' : endnotes(death) } + else: + text = _("%(female_name)s%(endnotes)s " + "was born in %(birth_place)s%(birth_endnotes)s.") % { + 'female_name' : person_name, 'endnotes' : endnotes(name_object), + 'birth_place' : bplace, + 'birth_endnotes' : endnotes(birth) } + else: + if ddate: + if dplace: + text = _("%(female_name)s%(endnotes)s " + "died %(death_date)s in %(death_place)s%(death_endnotes)s.") % { + 'female_name' : person_name, 'endnotes' : endnotes(name_object), + 'death_date' : ddate, 'death_place' : dplace, + 'death_endnotes' : endnotes(death) } + else: + text = _("%(female_name)s%(endnotes)s " + "died %(death_date)s%(death_endnotes)s.") % { + 'female_name' : person_name, 'endnotes' : endnotes(name_object), + 'death_date' : ddate, + 'death_endnotes' : endnotes(death) } + else: + if dplace: + text = _("%(female_name)s%(endnotes)s " + "died in %(death_place)s%(death_endnotes)s.") % { + 'female_name' : person_name, 'endnotes' : endnotes(name_object), + 'death_place' : dplace, + 'death_endnotes' : endnotes(death) } + else: + text = _("%(female_name)s%(endnotes)s.") % { + 'female_name' : person_name, 'endnotes' : endnotes(name_object) } + return text + +def married_str(database,person,spouse,event,endnotes=None): + """ + Composes a string describing marriage of a person. + + The string is composed in the following form: + "He/She married such-and-such on-a-date" or + "He/She married such-and-such in a-place", + Missing information will be omitted without loss of readability. + Optional references may be added to birth and death events. + + @param database GRAMPS database to which the Person object belongs + @type db: GrampsDbBase + @param person: Person instance whose marriage is discussed + @type person: Person + @param spouse: Person instance to use as a spouse + @type spouse: Person + @param event: Event instance of marriage + @type event: Event + @param endnotes: Function to use for reference composition. If None + then references will not be added + @type endnotes: function + @returns: A composed string + @rtype: unicode + """ + + if not endnotes: + endnotes = empty_notes + + spouse_name = spouse.get_primary_name().get_regular_name() + + date = event.get_date() + place_handle = event.get_place_handle() + if place_handle: + place = database.get_place_from_handle(place_handle).get_title() + else: + place = "" + + text = "" + if date and place: + if person.get_gender() == RelLib.Person.male: + text = _('He married %(spouse)s %(date)s in %(place)s%(endnotes)s.') % { + 'spouse' : spouse_name, + 'endnotes' : endnotes(event), + 'date' : date, + 'place' : place} + else: + text = _('She married %(spouse)s %(date)s in %(place)s%(endnotes)s.') % { + 'spouse' : spouse_name, + 'date' : date, + 'endnotes' : endnotes(event), + 'place' : place} + elif date: + if person.get_gender() == RelLib.Person.male: + text = _('He married %(spouse)s %(date)s%(endnotes)s.') % { + 'spouse' : spouse_name, + 'endnotes' : endnotes(event), + 'date' : date,} + else: + text = _('She married %(spouse)s in %(place)s%(endnotes)s.') % { + 'spouse' : spouse_name, + 'endnotes' : endnotes(event), + 'place' : place,} + elif place: + if person.get_gender() == RelLib.Person.male: + text = _('He married %(spouse)s in %(place)s%(endnotes)s.') % { + 'spouse' : spouse_name, + 'endnotes' : endnotes(event), + 'place' : place} + else: + text = _('She married %(spouse)s in %(place)s%(endnotes)s.') % { + 'spouse' : spouse_name, + 'endnotes' : endnotes(event), + 'place' : place} + else: + if person.get_gender() == RelLib.Person.male: + text = _('He married %(spouse)s%(endnotes)s.') % { + 'spouse' : spouse_name, + 'endnotes' : endnotes(event) } + else: + text = _('She married %(spouse)s%(endnotes)s.') % { + 'spouse' : spouse_name, + 'endnotes' : endnotes(event)} + return text + +def child_str(person_gender,father_name,mother_name,dead): + """ + Composes a string describing marriage of a person. + + The string is composed in the following form: + "He/She is/was the son/daughter of father_name and mother_name" + Missing information will be omitted without loss of readability. + + @param person_gender: Person.male, Person.female, or Person.unknown + @type person: Person.male, Person.female, or Person.unknown + @param father_name: String to use for father's name + @type father_name: unicode + @param mother_name: String to use for mother's name + @type mother_name: unicode + @param dead: Whether the person discussed is dead or not + @type dead: bool + @returns: A composed string + @rtype: unicode + """ + + text = "" + if person_gender == RelLib.Person.male: + if mother_name and father_name: + if dead: + text = _("He was the son of %(father)s and %(mother)s.") % { + 'father' : father_name, + 'mother' : mother_name, } + else: + text = _("He is the son of %(father)s and %(mother)s.") % { + 'father' : father_name, + 'mother' : mother_name, } + elif mother_name: + if dead: + text = _("He was the son of %(mother)s.") % { + 'mother' : mother_name, } + else: + text = _("He is the son of %(mother)s.") % { + 'mother' : mother_name, } + elif father_name: + if dead: + text = _("He was the son of %(father)s.") % { + 'father' : father_name, } + else: + text = _("He is the son of %(father)s.") % { + 'father' : father_name, } + else: + if mother_name and father_name: + if dead: + text = _("She was the daughter of %(father)s and %(mother)s.") % { + 'father' : father_name, + 'mother' : mother_name, } + else: + text = _("She is the daughter of %(father)s and %(mother)s.") % { + 'father' : father_name, + 'mother' : mother_name, } + elif mother_name: + if dead: + text = _("She was the daughter of %(mother)s.") % { + 'mother' : mother_name, } + else: + text = _("She is the daughter of %(mother)s.") % { + 'mother' : mother_name, } + elif father_name: + if dead: + text = _("She was the daughter of %(father)s.") % { + 'father' : father_name, } + else: + text = _("She is the daughter of %(father)s.") % { + 'father' : father_name, } + + return text + #------------------------------------------------------------------------- # # diff --git a/src/plugins/FtmStyleAncestors.py b/src/plugins/FtmStyleAncestors.py index 656de67c0..ccbea5307 100644 --- a/src/plugins/FtmStyleAncestors.py +++ b/src/plugins/FtmStyleAncestors.py @@ -40,6 +40,7 @@ import RelLib import ReportOptions from DateHandler import displayer as dd import const +import ReportUtils #------------------------------------------------------------------------ # @@ -118,320 +119,13 @@ class FtmAncestorReport(Report.Report): self.doc.write_text(name) self.doc.end_bold() - # Check birth record - - birth_handle = person.get_birth_handle() - if birth_handle: - birth_valid = 1 - birth = self.database.get_event_from_handle(birth_handle) - place_handle = birth.get_place_handle() - if place_handle: - bplace = self.database.get_place_from_handle(place_handle).get_title() - else: - bplace = u'' - bdate = birth.get_date() - else: - birth_valid = 0 - bplace = u'' - bdate = u'' + text = ReportUtils.born_died_str(self.database,person, + self.endnotes,None,"") + if text: + self.doc.write_text(text) + self.doc.write_text(' ') - death_handle = person.get_death_handle() - if death_handle: - death_valid = 1 - death = self.database.get_event_from_handle(death_handle) - place_handle = death.get_place_handle() - if place_handle: - dplace = self.database.get_place_from_handle(place_handle).get_title() - else: - dplace = u'' - ddate = death.get_date() - else: - death_valid = 0 - dplace = u'' - ddate = u'' - - if birth_valid or death_valid: - if person.get_gender() == RelLib.Person.male: - if bdate: - if bplace: - if ddate: - if dplace: - self.doc.write_text(_("%(male_name)s%(endnotes)s was born %(birth_date)s " - "in %(birth_place)s%(birth_endnotes)s, " - "and died %(death_date)s in %(death_place)s" - "%(death_endnotes)s.") % { - 'male_name' : '', 'endnotes' : self.endnotes(pri_name), - 'birth_date' : bdate, 'birth_place' : bplace, - 'death_date' : ddate,'death_place' : dplace, - 'birth_endnotes' : self.endnotes(birth), - 'death_endnotes' : self.endnotes(death), - }) - else: - self.doc.write_text(_("%(male_name)s%(endnotes)s was born %(birth_date)s " - "in %(birth_place)s%(birth_endnotes)s, " - "and died %(death_date)s%(death_endnotes)s.") % { - 'male_name' : '', 'endnotes' : self.endnotes(pri_name), - 'birth_date' : bdate, 'birth_place' : bplace, - 'death_date' : ddate, - 'birth_endnotes' : self.endnotes(birth), - 'death_endnotes' : self.endnotes(death), - }) - else: - if dplace: - self.doc.write_text(_("%(male_name)s%(endnotes)s was born %(birth_date)s " - "in %(birth_place)s%(birth_endnotes)s, " - "and died in %(death_place)s%(death_endnotes)s.") % { - 'male_name' : '', 'endnotes' : self.endnotes(pri_name), - 'birth_date' : bdate, 'birth_place' : bplace, - 'birth_endnotes' : self.endnotes(birth), - 'death_endnotes' : self.endnotes(death), - 'death_place' : dplace, - }) - else: - self.doc.write_text(_("%(male_name)s%(endnotes)s was born %(birth_date)s in " - "%(birth_place)s%(birth_endnotes)s.") % { - 'male_name' : '', 'endnotes' : self.endnotes(pri_name), - 'birth_date' : bdate, 'birth_place' : bplace, - 'birth_endnotes' : self.endnotes(birth), - }) - else: - if ddate: - if dplace: - self.doc.write_text(_("%(male_name)s%(endnotes)s was born %(birth_date)s%(birth_endnotes)s, " - "and died %(death_date)s in %(death_place)s" - "%(death_endnotes)s.") % { - 'male_name' : '', 'endnotes' : self.endnotes(pri_name), - 'birth_date' : bdate, 'death_date' : ddate, - 'death_place' : dplace, - 'birth_endnotes' : self.endnotes(birth), - 'death_endnotes' : self.endnotes(death), - }) - else: - self.doc.write_text(_("%(male_name)s%(endnotes)s was born %(birth_date)s%(birth_endnotes)s, " - "and died %(death_date)s%(death_endnotes)s.") % { - 'male_name' : '', 'endnotes' : self.endnotes(pri_name), - 'birth_date' : bdate, 'death_date' : ddate, - 'birth_endnotes' : self.endnotes(birth), - 'death_endnotes' : self.endnotes(death), - }) - else: - if dplace: - self.doc.write_text(_("%(male_name)s%(endnotes)s was born %(birth_date)s%(birth_endnotes)s, " - "and died in %(death_place)s%(death_endnotes)s.") % { - 'male_name' : '', 'endnotes' : self.endnotes(pri_name), - 'birth_date' : bdate, 'death_place' : dplace, - 'birth_endnotes' : self.endnotes(birth), - 'death_endnotes' : self.endnotes(death), - }) - else: - self.doc.write_text(_("%(male_name)s%(endnotes)s was born " - "%(birth_date)s%(birth_endnotes)s.") % { - 'male_name' : '', 'endnotes' : self.endnotes(pri_name), - 'birth_date' : bdate, - 'birth_endnotes' : self.endnotes(birth), - }) - else: - if bplace: - if ddate: - if dplace: - self.doc.write_text(_("%(male_name)s%(endnotes)s was born in %(birth_place)s%(birth_endnotes)s, " - "and died %(death_date)s in %(death_place)s" - "%(death_endnotes)s.") % { - 'male_name' : '', 'endnotes' : self.endnotes(pri_name), - 'birth_place' : bplace, 'death_date' : ddate, 'death_place' : dplace, - 'birth_endnotes' : self.endnotes(birth), - 'death_endnotes' : self.endnotes(death), - }) - else: - self.doc.write_text(_("%(male_name)s%(endnotes)s was born in %(birth_place)s%(birth_endnotes)s, " - "and died %(death_date)s%(death_endnotes)s.") % { - 'male_name' : '', 'endnotes' : self.endnotes(pri_name), - 'birth_endnotes' : self.endnotes(birth), - 'death_endnotes' : self.endnotes(death), - 'birth_place' : bplace, 'death_date' : ddate, - }) - else: - if dplace: - self.doc.write_text(_("%(male_name)s%(endnotes)s was born in %(birth_place)s%(birth_endnotes)s, " - "and died in %(death_place)s%(death_endnotes)s.") % { - 'male_name' : '', 'endnotes' : self.endnotes(pri_name), - 'birth_place' : bplace,'death_place' : dplace, - 'birth_endnotes' : self.endnotes(birth), - 'death_endnotes' : self.endnotes(death), - }) - else: - self.doc.write_text(_("%(male_name)s%(endnotes)s was born " - "in %(birth_place)s%(birth_endnotes)s.") % { - 'male_name' : '', 'endnotes' : self.endnotes(pri_name), - 'birth_place' : bplace, - 'birth_endnotes' : self.endnotes(birth), - }) - else: - if ddate: - if dplace: - self.doc.write_text(_("%(male_name)s%(endnotes)s died %(death_date)s in " - "%(death_place)s%(death_endnotes)s.") % { - 'male_name' : '', 'endnotes' : self.endnotes(pri_name), - 'death_date' : ddate, 'death_place' : dplace, - 'death_endnotes' : self.endnotes(death), - }) - else: - self.doc.write_text(_("%(male_name)s%(endnotes)s " - "died %(death_date)s%(death_endnotes)s.") % { - 'male_name' : '', 'endnotes' : self.endnotes(pri_name), - 'death_date' : ddate, - 'death_endnotes' : self.endnotes(death), - }) - else: - if dplace: - self.doc.write_text(_("%(male_name)s%(endnotes)s died " - "in %(death_place)s%(death_endnotes)s.") % { - 'male_name' : '', 'endnotes' : self.endnotes(pri_name), - 'death_endnotes' : self.endnotes(death), - 'death_place' : dplace, - }) - else: - if bdate: - if bplace: - if ddate: - if dplace: - self.doc.write_text(_("%(female_name)s%(endnotes)s was born %(birth_date)s in %(birth_place)s" - "%(birth_endnotes)s, " - "and died %(death_date)s in %(death_place)s" - "%(death_endnotes)s.") % { - 'female_name' : '', 'endnotes' : self.endnotes(pri_name), - 'birth_date' : bdate, 'birth_place' : bplace, - 'death_date' : ddate,'death_place' : dplace, - 'birth_endnotes' : self.endnotes(birth), - 'death_endnotes' : self.endnotes(death), - }) - else: - self.doc.write_text(_("%(female_name)s%(endnotes)s was born %(birth_date)s in %(birth_place)s" - "%(birth_endnotes)s, " - "and died %(death_date)s%(death_endnotes)s.") % { - 'female_name' : '', 'endnotes' : self.endnotes(pri_name), - 'birth_date' : bdate, 'birth_place' : bplace, - 'birth_endnotes' : self.endnotes(birth), - 'death_endnotes' : self.endnotes(death), - 'death_date' : ddate, - }) - else: - if dplace: - self.doc.write_text(_("%(female_name)s%(endnotes)s was born %(birth_date)s in %(birth_place)s" - "%(birth_endnotes)s, " - "and died in %(death_place)s%(death_endnotes)s.") % { - 'female_name' : '', 'endnotes' : self.endnotes(pri_name), - 'birth_date' : bdate, 'birth_place' : bplace, - 'death_place' : dplace, - 'birth_endnotes' : self.endnotes(birth), - 'death_endnotes' : self.endnotes(death), - }) - else: - self.doc.write_text(_("%(female_name)s%(endnotes)s was born %(birth_date)s " - "in %(birth_place)s%(birth_endnotes)s.") % { - 'female_name' : '', 'endnotes' : self.endnotes(pri_name), - 'birth_endnotes' : self.endnotes(birth), - 'birth_date' : bdate, 'birth_place' : bplace, - }) - else: - if ddate: - if dplace: - self.doc.write_text(_("%(female_name)s%(endnotes)s was born %(birth_date)s%(birth_endnotes)s, " - "and died %(death_date)s in %(death_place)s" - "%(death_endnotes)s.") % { - 'female_name' : '', 'endnotes' : self.endnotes(pri_name), - 'birth_date' : bdate, 'death_date' : ddate, - 'birth_endnotes' : self.endnotes(birth), - 'death_endnotes' : self.endnotes(death), - 'death_place' : dplace, - }) - else: - self.doc.write_text(_("%(female_name)s%(endnotes)s was born %(birth_date)s%(birth_endnotes)s, " - "and died %(death_date)s%(death_endnotes)s.") % { - 'female_name' : '', 'endnotes' : self.endnotes(pri_name), - 'birth_endnotes' : self.endnotes(birth), - 'death_endnotes' : self.endnotes(death), - 'birth_date' : bdate, 'death_date' : ddate, - }) - else: - if dplace: - self.doc.write_text(_("%(female_name)s%(endnotes)s was born %(birth_date)s%(birth_endnotes)s, " - "and died in %(death_place)s%(death_endnotes)s.") % { - 'female_name' : '', 'endnotes' : self.endnotes(pri_name), - 'birth_endnotes' : self.endnotes(birth), - 'death_endnotes' : self.endnotes(death), - 'birth_date' : bdate, 'death_place' : dplace, - }) - else: - self.doc.write_text(_("%(female_name)s%(endnotes)s was " - "born %(birth_date)s%(birth_endnotes)s.") % { - 'female_name' : '', 'endnotes' : self.endnotes(pri_name), - 'birth_endnotes' : self.endnotes(birth), - 'birth_date' : bdate, - }) - else: - if bplace: - if ddate: - if dplace: - self.doc.write_text(_("%(female_name)s%(endnotes)s was born in %(birth_place)s%(birth_endnotes)s, " - "and died %(death_date)s in %(death_place)s%(death_endnotes)s.") % { - 'female_name' : '', 'endnotes' : self.endnotes(pri_name), - 'birth_endnotes' : self.endnotes(birth), - 'death_endnotes' : self.endnotes(death), - 'birth_place' : bplace, 'death_date' : ddate, 'death_place' : dplace, - }) - else: - self.doc.write_text(_("%(female_name)s%(endnotes)s was born in %(birth_place)s%(birth_endnotes)s, " - "and died %(death_date)s%(death_endnotes)s.") % { - 'female_name' : '', 'endnotes' : self.endnotes(pri_name), - 'birth_endnotes' : self.endnotes(birth), - 'death_endnotes' : self.endnotes(death), - 'birth_place' : bplace, 'death_date' : ddate, - }) - else: - if dplace: - self.doc.write_text(_("%(female_name)s%(endnotes)s was born in %(birth_place)s%(birth_endnotes)s, " - "and died in %(death_place)s%(death_endnotes)s.") % { - 'female_name' : '', 'endnotes' : self.endnotes(pri_name), - 'birth_endnotes' : self.endnotes(birth), - 'death_endnotes' : self.endnotes(death), - 'birth_place' : bplace,'death_place' : dplace, - }) - else: - self.doc.write_text(_("%(female_name)s%(endnotes)s was born " - "in %(birth_place)s%(birth_endnotes)s.") % { - 'female_name' : '', 'endnotes' : self.endnotes(pri_name), - 'birth_endnotes' : self.endnotes(birth), - 'birth_place' : bplace, - }) - else: - if ddate: - if dplace: - self.doc.write_text(_("%(female_name)s%(endnotes)s died %(death_date)s in " - "%(death_place)s%(death_endnotes)s.") % { - 'female_name' : '', 'endnotes' : self.endnotes(pri_name), - 'death_endnotes' : self.endnotes(death), - 'death_date' : ddate, 'death_place' : dplace, - }) - else: - self.doc.write_text(_("%(female_name)s%(endnotes)s " - "died %(death_date)s%(death_endnotes)s.") % { - 'female_name' : '', 'endnotes' : self.endnotes(pri_name), - 'death_endnotes' : self.endnotes(death), - 'death_date' : ddate, - }) - else: - if dplace: - self.doc.write_text(_("%(female_name)s%(endnotes)s died " - "in %(death_place)s%(death_endnotes)s.") % { - 'female_name' : '', 'endnotes' : self.endnotes(pri_name), - 'death_endnotes' : self.endnotes(death), - 'birth_date' : bdate, 'death_place' : dplace, - }) - else: - self.doc.write_text( "%s." % self.endnotes(pri_name) ) - - self.doc.write_text(' ') + death_valid = bool(person.get_death_handle()) self.print_parents(person,death_valid) self.print_spouse(person) self.doc.end_paragraph() @@ -607,358 +301,23 @@ class FtmAncestorReport(Report.Report): else: place = u'' - if date and place: - if person.get_gender() == RelLib.Person.male: - self.doc.write_text(_('He married %(spouse)s %(date)s in %(place)s%(endnotes)s.') % { - 'spouse' : spouse_name, - 'endnotes' : self.endnotes(event), - 'date' : date, - 'place' : place}) - else: - self.doc.write_text(_('She married %(spouse)s %(date)s in %(place)s%(endnotes)s.') % { - 'spouse' : spouse_name, - 'date' : date, - 'endnotes' : self.endnotes(event), - 'place' : place}) - elif date: - if person.get_gender() == RelLib.Person.male: - self.doc.write_text(_('He married %(spouse)s %(date)s%(endnotes)s.') % { - 'spouse' : spouse_name, - 'endnotes' : self.endnotes(event), - 'date' : date,}) - else: - self.doc.write_text(_('She married %(spouse)s in %(place)s%(endnotes)s.') % { - 'spouse' : spouse_name, - 'endnotes' : self.endnotes(event), - 'place' : place,}) - elif place: - if person.get_gender() == RelLib.Person.male: - self.doc.write_text(_('He married %(spouse)s in %(place)s%(endnotes)s.') % { - 'spouse' : spouse_name, - 'endnotes' : self.endnotes(event), - 'place' : place}) - else: - self.doc.write_text(_('She married %(spouse)s in %(place)s%(endnotes)s.') % { - 'spouse' : spouse_name, - 'endnotes' : self.endnotes(event), - 'place' : place}) - else: - if person.get_gender() == RelLib.Person.male: - self.doc.write_text(_('He married %(spouse)s%(endnotes)s.') % { - 'spouse' : spouse_name, - 'endnotes' : self.endnotes(event), - }) - else: - self.doc.write_text(_('She married %(spouse)s%(endnotes)s.') % { - 'spouse' : spouse_name, - 'endnotes' : self.endnotes(event), - }) - self.doc.write_text(' ') + if not event: + return - death_handle = spouse.get_death_handle() - if death_handle: - death_valid = 1 - death = self.database.get_event_from_handle(death_handle) - ddate = death.get_date() - place_handle = death.get_place_handle() - if place_handle: - dplace = self.database.get_place_from_handle(place_handle).get_title() - else: - dplace = u'' - else: - death_valid = 0 - dplace = u'' - ddate = u'' - - birth_handle = spouse.get_birth_handle() - if birth_handle: - birth_valid = 1 - birth = self.database.get_event_from_handle(birth_handle) - bdate = birth.get_date() - place_handle = birth.get_place_handle() - if place_handle: - bplace = self.database.get_place_from_handle(place_handle).get_title() - else: - bplace = u'' - else: - birth_valid = 0 - bplace = u'' - bdate = u'' - - if birth_valid or death_valid: - if spouse.get_gender() == RelLib.Person.male: - if bdate: - if bplace: - if ddate: - if dplace: - self.doc.write_text(_("%(male_name)s%(endnotes)s was born %(birth_date)s in %(birth_place)s" - "%(birth_endnotes)s, " - "and died %(death_date)s in %(death_place)s" - "%(death_endnotes)s.") % { - 'male_name' : _('He'), 'endnotes' : '', - 'birth_date' : bdate, 'birth_place' : bplace, - 'death_date' : ddate,'death_place' : dplace, - 'birth_endnotes' : self.endnotes(birth), - 'death_endnotes' : self.endnotes(death), - }) - else: - self.doc.write_text(_("%(male_name)s%(endnotes)s was born %(birth_date)s in %(birth_place)s" - "%(birth_endnotes)s, " - "and died %(death_date)s%(death_endnotes)s.") % { - 'male_name' : _('He'), 'endnotes' : '', - 'birth_date' : bdate, 'birth_place' : bplace, - 'death_date' : ddate, - 'birth_endnotes' : self.endnotes(birth), - 'death_endnotes' : self.endnotes(death), - }) - else: - if dplace: - self.doc.write_text(_("%(male_name)s%(endnotes)s was born %(birth_date)s in %(birth_place)s" - "%(birth_endnotes)s, " - "and died in %(death_place)s%(death_endnotes)s.") % { - 'male_name' : _('He'), 'endnotes' : '', - 'birth_date' : bdate, 'birth_place' : bplace, - 'birth_endnotes' : self.endnotes(birth), - 'death_endnotes' : self.endnotes(death), - 'death_place' : dplace, - }) - else: - self.doc.write_text(_("%(male_name)s%(endnotes)s was born %(birth_date)s in " - "%(birth_place)s%(birth_endnotes)s. ") % { - 'male_name' : _('He'), 'endnotes' : '', - 'birth_date' : bdate, 'birth_place' : bplace, - 'birth_endnotes' : self.endnotes(birth), - }) - else: - if ddate: - if dplace: - self.doc.write_text(_("%(male_name)s%(endnotes)s was born %(birth_date)s%(birth_endnotes)s, " - "and died %(death_date)s in %(death_place)s" - "%(death_endnotes)s.") % { - 'male_name' : _('He'), 'endnotes' : '', - 'birth_date' : bdate, 'death_date' : ddate, - 'death_place' : dplace, - 'birth_endnotes' : self.endnotes(birth), - 'death_endnotes' : self.endnotes(death), - }) - else: - self.doc.write_text(_("%(male_name)s%(endnotes)s was born %(birth_date)s%(birth_endnotes)s, " - "and died %(death_date)s%(death_endnotes)s.") % { - 'male_name' : _('He'), 'endnotes' : '', - 'birth_date' : bdate, 'death_date' : ddate, - 'birth_endnotes' : self.endnotes(birth), - 'death_endnotes' : self.endnotes(death), - }) - else: - if dplace: - self.doc.write_text(_("%(male_name)s%(endnotes)s was born %(birth_date)s%(birth_endnotes)s, " - "and died in %(death_place)s%(death_endnotes)s.") % { - 'male_name' : _('He'), 'endnotes' : '', - 'birth_date' : bdate, 'death_place' : dplace, - 'birth_endnotes' : self.endnotes(birth), - 'death_endnotes' : self.endnotes(death), - }) - else: - self.doc.write_text(_("%(male_name)s%(endnotes)s was born %(birth_date)s%(birth_endnotes)s. ") % { - 'male_name' : _('He'), 'endnotes' : '', - 'birth_date' : bdate, - 'birth_endnotes' : self.endnotes(birth), - }) - else: - if bplace: - if ddate: - if dplace: - self.doc.write_text(_("%(male_name)s%(endnotes)s was born in %(birth_place)s%(birth_endnotes)s, " - "and died %(death_date)s in %(death_place)s" - "%(death_endnotes)s.") % { - 'male_name' : _('He'), 'endnotes' : '', - 'birth_place' : bplace, 'death_date' : ddate, 'death_place' : dplace, - 'birth_endnotes' : self.endnotes(birth), - 'death_endnotes' : self.endnotes(death), - }) - else: - self.doc.write_text(_("%(male_name)s%(endnotes)s was born in %(birth_place)s%(birth_endnotes)s, " - "and died %(death_date)s%(death_endnotes)s.") % { - 'male_name' : _('He'), 'endnotes' : '', - 'birth_endnotes' : self.endnotes(birth), - 'death_endnotes' : self.endnotes(death), - 'birth_place' : bplace, 'death_date' : ddate, - }) - else: - if dplace: - self.doc.write_text(_("%(male_name)s%(endnotes)s was born in %(birth_place)s%(birth_endnotes)s, " - "and died in %(death_place)s%(death_endnotes)s.") % { - 'male_name' : _('He'), 'endnotes' : '', - 'birth_place' : bplace,'death_place' : dplace, - 'birth_endnotes' : self.endnotes(birth), - 'death_endnotes' : self.endnotes(death), - }) - else: - self.doc.write_text(_("%(male_name)s%(endnotes)s was born in %(birth_place)s%(birth_endnotes)s. ") % { - 'male_name' : _('He'), 'endnotes' : '', - 'birth_place' : bplace, - 'birth_endnotes' : self.endnotes(birth), - }) - else: - if ddate: - if dplace: - self.doc.write_text(_("%(male_name)s%(endnotes)s died %(death_date)s in " - "%(death_place)s%(death_endnotes)s.") % { - 'male_name' : _('He'), 'endnotes' : '', - 'death_date' : ddate, 'death_place' : dplace, - 'death_endnotes' : self.endnotes(death), - }) - else: - self.doc.write_text(_("%(male_name)s%(endnotes)s died %(death_date)s%(death_endnotes)s.") % { - 'male_name' : _('He'), 'endnotes' : '', - 'death_date' : ddate, - 'death_endnotes' : self.endnotes(death), - }) - else: - if dplace: - self.doc.write_text(_("%(male_name)s%(endnotes)s died in %(death_place)s%(death_endnotes)s.") % { - 'male_name' : _('He'), 'endnotes' : '', - 'death_endnotes' : self.endnotes(death), - 'death_place' : dplace, - }) - else: - if bdate: - if bplace: - if ddate: - if dplace: - self.doc.write_text(_("%(female_name)s%(endnotes)s was born %(birth_date)s in %(birth_place)s" - "%(birth_endnotes)s, " - "and died %(death_date)s in %(death_place)s" - "%(death_endnotes)s.") % { - 'female_name' : _('She'), 'endnotes' : '', - 'birth_date' : bdate, 'birth_place' : bplace, - 'death_date' : ddate,'death_place' : dplace, - 'birth_endnotes' : self.endnotes(birth), - 'death_endnotes' : self.endnotes(death), - }) - else: - self.doc.write_text(_("%(female_name)s%(endnotes)s was born %(birth_date)s in %(birth_place)s" - "%(birth_endnotes)s, " - "and died %(death_date)s%(death_endnotes)s.") % { - 'female_name' : _('She'), 'endnotes' : '', - 'birth_date' : bdate, 'birth_place' : bplace, - 'birth_endnotes' : self.endnotes(birth), - 'death_endnotes' : self.endnotes(death), - 'death_date' : ddate, - }) - else: - if dplace: - self.doc.write_text(_("%(female_name)s%(endnotes)s was born %(birth_date)s in %(birth_place)s" - "%(birth_endnotes)s, " - "and died in %(death_place)s%(death_endnotes)s.") % { - 'female_name' : _('She'), 'endnotes' : '', - 'birth_date' : bdate, 'birth_place' : bplace, - 'death_place' : dplace, - 'birth_endnotes' : self.endnotes(birth), - 'death_endnotes' : self.endnotes(death), - }) - else: - self.doc.write_text(_("%(female_name)s%(endnotes)s was born %(birth_date)s in %(birth_place)s" - "%(birth_endnotes)s. ") % { - 'female_name' : _('She'), 'endnotes' : '', - 'birth_endnotes' : self.endnotes(birth), - 'birth_date' : bdate, 'birth_place' : bplace, - }) - else: - if ddate: - if dplace: - self.doc.write_text(_("%(female_name)s%(endnotes)s was born %(birth_date)s%(birth_endnotes)s, " - "and died %(death_date)s in %(death_place)s" - "%(death_endnotes)s.") % { - 'female_name' : _('She'), 'endnotes' : '', - 'birth_date' : bdate, 'death_date' : ddate, - 'birth_endnotes' : self.endnotes(birth), - 'death_endnotes' : self.endnotes(death), - 'death_place' : dplace, - }) - else: - self.doc.write_text(_("%(female_name)s%(endnotes)s was born %(birth_date)s%(birth_endnotes)s, " - "and died %(death_date)s%(death_endnotes)s.") % { - 'female_name' : _('She'), 'endnotes' : '', - 'birth_endnotes' : self.endnotes(birth), - 'death_endnotes' : self.endnotes(death), - 'birth_date' : bdate, 'death_date' : ddate, - }) - else: - if dplace: - self.doc.write_text(_("%(female_name)s%(endnotes)s was born %(birth_date)s%(birth_endnotes)s, " - "and died in %(death_place)s%(death_endnotes)s.") % { - 'female_name' : _('She'), 'endnotes' : '', - 'birth_endnotes' : self.endnotes(birth), - 'death_endnotes' : self.endnotes(death), - 'birth_date' : bdate, 'death_place' : dplace, - }) - else: - self.doc.write_text(_("%(female_name)s%(endnotes)s was born %(birth_date)s%(birth_endnotes)s. ") % { - 'female_name' : _('She'), 'endnotes' : '', - 'birth_endnotes' : self.endnotes(birth), - 'birth_date' : bdate, - }) - else: - if bplace: - if ddate: - if dplace: - self.doc.write_text(_("%(female_name)s%(endnotes)s was born in %(birth_place)s%(birth_endnotes)s, " - "and died %(death_date)s in %(death_place)s%(death_endnotes)s.") % { - 'female_name' : _('She'), 'endnotes' : '', - 'birth_endnotes' : self.endnotes(birth), - 'death_endnotes' : self.endnotes(death), - 'birth_place' : bplace, 'death_date' : ddate, 'death_place' : dplace, - }) - else: - self.doc.write_text(_("%(female_name)s%(endnotes)s was born in %(birth_place)s%(birth_endnotes)s, " - "and died %(death_date)s%(death_endnotes)s.") % { - 'female_name' : _('She'), 'endnotes' : '', - 'birth_endnotes' : self.endnotes(birth), - 'death_endnotes' : self.endnotes(death), - 'birth_place' : bplace, 'death_date' : ddate, - }) - else: - if dplace: - self.doc.write_text(_("%(female_name)s%(endnotes)s was born in %(birth_place)s%(birth_endnotes)s, " - "and died in %(death_place)s%(death_endnotes)s.") % { - 'female_name' : _('She'), 'endnotes' : '', - 'birth_endnotes' : self.endnotes(birth), - 'death_endnotes' : self.endnotes(death), - 'birth_place' : bplace,'death_place' : dplace, - }) - else: - self.doc.write_text(_("%(female_name)s%(endnotes)s was born in %(birth_place)s%(birth_endnotes)s. ") % { - 'female_name' : _('She'), 'endnotes' : '', - 'birth_endnotes' : self.endnotes(birth), - 'birth_place' : bplace, - }) - else: - if ddate: - if dplace: - self.doc.write_text(_("%(female_name)s%(endnotes)s died %(death_date)s in " - "%(death_place)s%(death_endnotes)s.") % { - 'female_name' : _('She'), 'endnotes' : '', - 'death_endnotes' : self.endnotes(death), - 'death_date' : ddate, 'death_place' : dplace, - }) - else: - self.doc.write_text(_("%(female_name)s%(endnotes)s died %(death_date)s%(death_endnotes)s.") % { - 'female_name' : _('She'), 'endnotes' : '', - 'death_endnotes' : self.endnotes(death), - 'death_date' : ddate, - }) - else: - if dplace: - self.doc.write_text(_("%(female_name)s%(endnotes)s died in %(death_place)s%(death_endnotes)s.") % { - 'female_name' : _('She'), 'endnotes' : '', - 'death_endnotes' : self.endnotes(death), - 'birth_date' : bdate, 'death_place' : dplace, - }) - + text = ReportUtils.married_str(self.database,person,spouse,event, + self.endnotes) + if text: + self.doc.write_text(text) self.doc.write_text(' ') - self.print_parents(spouse,death_valid) + text = ReportUtils.born_died_str(self.database,spouse, + self.endnotes,"",0) + if text: + self.doc.write_text(text) + self.doc.write_text(' ') + + death_valid = bool(spouse.get_death_handle()) + self.print_parents(spouse,death_valid) def print_parents(self,person,dead): family_handle = person.get_main_parents_family_handle() @@ -969,59 +328,19 @@ class FtmAncestorReport(Report.Report): if mother_handle: mother = self.database.get_person_from_handle(mother_handle) mother_name = mother.get_primary_name().get_regular_name() + else: + mother_name = "" if father_handle: father = self.database.get_person_from_handle(father_handle) father_name = father.get_primary_name().get_regular_name() - - if person.get_gender() == RelLib.Person.male: - if mother_handle and father_handle: - if dead: - self.doc.write_text(_("He was the son of %(father)s and %(mother)s.") % { - 'father' : father_name, - 'mother' : mother_name, }) - else: - self.doc.write_text(_("He is the son of %(father)s and %(mother)s.") % { - 'father' : father_name, - 'mother' : mother_name, }) - elif mother_handle: - if dead: - self.doc.write_text(_("He was the son of %(mother)s.") % { - 'mother' : mother_name, }) - else: - self.doc.write_text(_("He is the son of %(mother)s.") % { - 'mother' : mother_name, }) - elif father_handle: - if dead: - self.doc.write_text(_("He was the son of %(father)s.") % { - 'father' : father_name, }) - else: - self.doc.write_text(_("He is the son of %(father)s.") % { - 'father' : father_name, }) else: - if mother_handle and father_handle: - if dead: - self.doc.write_text(_("She was the daughter of %(father)s and %(mother)s.") % { - 'father' : father_name, - 'mother' : mother_name, }) - else: - self.doc.write_text(_("She is the daughter of %(father)s and %(mother)s.") % { - 'father' : father_name, - 'mother' : mother_name, }) - elif mother_handle: - if dead: - self.doc.write_text(_("She was the daughter of %(mother)s.") % { - 'mother' : mother_name, }) - else: - self.doc.write_text(_("She is the daughter of %(mother)s.") % { - 'mother' : mother_name, }) - elif father_handle: - if dead: - self.doc.write_text(_("She was the daughter of %(father)s.") % { - 'father' : father_name, }) - else: - self.doc.write_text(_("She is the daughter of %(father)s.") % { - 'father' : father_name, }) - self.doc.write_text(' '); + father_name = "" + + text = ReportUtils.child_str(person.get_gender(), + father_name,mother_name,dead) + if text: + self.doc.write_text(text) + self.doc.write_text(' ') #------------------------------------------------------------------------ # diff --git a/src/plugins/FtmStyleDescendants.py b/src/plugins/FtmStyleDescendants.py index 8a7589add..f69d89469 100644 --- a/src/plugins/FtmStyleDescendants.py +++ b/src/plugins/FtmStyleDescendants.py @@ -139,320 +139,19 @@ class FtmDescendantReport(Report.Report): person_handle = self.anc_map[key] person = self.database.get_person_from_handle(person_handle) - pri_name = person.get_primary_name() self.doc.start_paragraph("FTD-Entry","%d." % key) - name = pri_name.get_regular_name() + name = person.get_primary_name().get_regular_name() self.doc.start_bold() self.doc.write_text(name) self.doc.end_bold() - # Check birth record - - birth_handle = person.get_birth_handle() - bplace = "" - bdate = "" - if birth_handle: - birth = self.database.get_event_from_handle(birth_handle) - bdate = birth.get_date() - bplace_handle = birth.get_place_handle() - if bplace_handle: - bplace = self.database.get_place_from_handle(bplace_handle).get_title() + text = ReportUtils.born_died_str(self.database,person, + self.endnotes,None,"") + if text: + self.doc.write_text(text) + self.doc.write_text(' ') - death_handle = person.get_death_handle() - dplace = "" - ddate = "" - if death_handle: - death = self.database.get_event_from_handle(death_handle) - ddate = death.get_date() - dplace_handle = death.get_place_handle() - if dplace_handle: - dplace = self.database.get_place_from_handle(dplace_handle).get_title() - - birth_valid = bdate or bplace - death_valid = ddate or dplace - - if birth_valid or death_valid: - if person.get_gender() == RelLib.Person.male: - if bdate: - if bplace: - if ddate: - if dplace: - self.doc.write_text(_("%(male_name)s%(endnotes)s was born %(birth_date)s " - "in %(birth_place)s%(birth_endnotes)s, " - "and died %(death_date)s in %(death_place)s" - "%(death_endnotes)s.") % { - 'male_name' : '', 'endnotes' : self.endnotes(pri_name), - 'birth_date' : bdate, 'birth_place' : bplace, - 'death_date' : ddate,'death_place' : dplace, - 'birth_endnotes' : self.endnotes(birth), - 'death_endnotes' : self.endnotes(death), - }) - else: - self.doc.write_text(_("%(male_name)s%(endnotes)s was born %(birth_date)s " - "in %(birth_place)s%(birth_endnotes)s, " - "and died %(death_date)s%(death_endnotes)s.") % { - 'male_name' : '', 'endnotes' : self.endnotes(pri_name), - 'birth_date' : bdate, 'birth_place' : bplace, - 'death_date' : ddate, - 'birth_endnotes' : self.endnotes(birth), - 'death_endnotes' : self.endnotes(death), - }) - else: - if dplace: - self.doc.write_text(_("%(male_name)s%(endnotes)s was born %(birth_date)s " - "in %(birth_place)s%(birth_endnotes)s, " - "and died in %(death_place)s%(death_endnotes)s.") % { - 'male_name' : '', 'endnotes' : self.endnotes(pri_name), - 'birth_date' : bdate, 'birth_place' : bplace, - 'birth_endnotes' : self.endnotes(birth), - 'death_endnotes' : self.endnotes(death), - 'death_place' : dplace, - }) - else: - self.doc.write_text(_("%(male_name)s%(endnotes)s was born %(birth_date)s in " - "%(birth_place)s%(birth_endnotes)s.") % { - 'male_name' : '', 'endnotes' : self.endnotes(pri_name), - 'birth_date' : bdate, 'birth_place' : bplace, - 'birth_endnotes' : self.endnotes(birth), - }) - else: - if ddate: - if dplace: - self.doc.write_text(_("%(male_name)s%(endnotes)s was born %(birth_date)s%(birth_endnotes)s, " - "and died %(death_date)s in %(death_place)s" - "%(death_endnotes)s.") % { - 'male_name' : '', 'endnotes' : self.endnotes(pri_name), - 'birth_date' : bdate, 'death_date' : ddate, - 'death_place' : dplace, - 'birth_endnotes' : self.endnotes(birth), - 'death_endnotes' : self.endnotes(death), - }) - else: - self.doc.write_text(_("%(male_name)s%(endnotes)s was born %(birth_date)s%(birth_endnotes)s, " - "and died %(death_date)s%(death_endnotes)s.") % { - 'male_name' : '', 'endnotes' : self.endnotes(pri_name), - 'birth_date' : bdate, 'death_date' : ddate, - 'birth_endnotes' : self.endnotes(birth), - 'death_endnotes' : self.endnotes(death), - }) - else: - if dplace: - self.doc.write_text(_("%(male_name)s%(endnotes)s was born %(birth_date)s%(birth_endnotes)s, " - "and died in %(death_place)s%(death_endnotes)s.") % { - 'male_name' : '', 'endnotes' : self.endnotes(pri_name), - 'birth_date' : bdate, 'death_place' : dplace, - 'birth_endnotes' : self.endnotes(birth), - 'death_endnotes' : self.endnotes(death), - }) - else: - self.doc.write_text(_("%(male_name)s%(endnotes)s was born " - "%(birth_date)s%(birth_endnotes)s.") % { - 'male_name' : '', 'endnotes' : self.endnotes(pri_name), - 'birth_date' : bdate, - 'birth_endnotes' : self.endnotes(birth), - }) - else: - if bplace: - if ddate: - if dplace: - self.doc.write_text(_("%(male_name)s%(endnotes)s was born in %(birth_place)s%(birth_endnotes)s, " - "and died %(death_date)s in %(death_place)s" - "%(death_endnotes)s.") % { - 'male_name' : '', 'endnotes' : self.endnotes(pri_name), - 'birth_place' : bplace, 'death_date' : ddate, 'death_place' : dplace, - 'birth_endnotes' : self.endnotes(birth), - 'death_endnotes' : self.endnotes(death), - }) - else: - self.doc.write_text(_("%(male_name)s%(endnotes)s was born in %(birth_place)s%(birth_endnotes)s, " - "and died %(death_date)s%(death_endnotes)s.") % { - 'male_name' : '', 'endnotes' : self.endnotes(pri_name), - 'birth_endnotes' : self.endnotes(birth), - 'death_endnotes' : self.endnotes(death), - 'birth_place' : bplace, 'death_date' : ddate, - }) - else: - if dplace: - self.doc.write_text(_("%(male_name)s%(endnotes)s was born in %(birth_place)s%(birth_endnotes)s, " - "and died in %(death_place)s%(death_endnotes)s.") % { - 'male_name' : '', 'endnotes' : self.endnotes(pri_name), - 'birth_place' : bplace,'death_place' : dplace, - 'birth_endnotes' : self.endnotes(birth), - 'death_endnotes' : self.endnotes(death), - }) - else: - self.doc.write_text(_("%(male_name)s%(endnotes)s was born " - "in %(birth_place)s%(birth_endnotes)s.") % { - 'male_name' : '', 'endnotes' : self.endnotes(pri_name), - 'birth_place' : bplace, - 'birth_endnotes' : self.endnotes(birth), - }) - else: - if ddate: - if dplace: - self.doc.write_text(_("%(male_name)s%(endnotes)s died %(death_date)s in " - "%(death_place)s%(death_endnotes)s.") % { - 'male_name' : '', 'endnotes' : self.endnotes(pri_name), - 'death_date' : ddate, 'death_place' : dplace, - 'death_endnotes' : self.endnotes(death), - }) - else: - self.doc.write_text(_("%(male_name)s%(endnotes)s " - "died %(death_date)s%(death_endnotes)s.") % { - 'male_name' : '', 'endnotes' : self.endnotes(pri_name), - 'death_date' : ddate, - 'death_endnotes' : self.endnotes(death), - }) - else: - if dplace: - self.doc.write_text(_("%(male_name)s%(endnotes)s died " - "in %(death_place)s%(death_endnotes)s.") % { - 'male_name' : '', 'endnotes' : self.endnotes(pri_name), - 'death_endnotes' : self.endnotes(death), - 'death_place' : dplace, - }) - else: - if bdate: - if bplace: - if ddate: - if dplace: - self.doc.write_text(_("%(female_name)s%(endnotes)s was born %(birth_date)s in %(birth_place)s" - "%(birth_endnotes)s, " - "and died %(death_date)s in %(death_place)s" - "%(death_endnotes)s.") % { - 'female_name' : '', 'endnotes' : self.endnotes(pri_name), - 'birth_date' : bdate, 'birth_place' : bplace, - 'death_date' : ddate,'death_place' : dplace, - 'birth_endnotes' : self.endnotes(birth), - 'death_endnotes' : self.endnotes(death), - }) - else: - self.doc.write_text(_("%(female_name)s%(endnotes)s was born %(birth_date)s in %(birth_place)s" - "%(birth_endnotes)s, " - "and died %(death_date)s%(death_endnotes)s.") % { - 'female_name' : '', 'endnotes' : self.endnotes(pri_name), - 'birth_date' : bdate, 'birth_place' : bplace, - 'birth_endnotes' : self.endnotes(birth), - 'death_endnotes' : self.endnotes(death), - 'death_date' : ddate, - }) - else: - if dplace: - self.doc.write_text(_("%(female_name)s%(endnotes)s was born %(birth_date)s in %(birth_place)s" - "%(birth_endnotes)s, " - "and died in %(death_place)s%(death_endnotes)s.") % { - 'female_name' : '', 'endnotes' : self.endnotes(pri_name), - 'birth_date' : bdate, 'birth_place' : bplace, - 'death_place' : dplace, - 'birth_endnotes' : self.endnotes(birth), - 'death_endnotes' : self.endnotes(death), - }) - else: - self.doc.write_text(_("%(female_name)s%(endnotes)s was born %(birth_date)s " - "in %(birth_place)s%(birth_endnotes)s.") % { - 'female_name' : '', 'endnotes' : self.endnotes(pri_name), - 'birth_endnotes' : self.endnotes(birth), - 'birth_date' : bdate, 'birth_place' : bplace, - }) - else: - if ddate: - if dplace: - self.doc.write_text(_("%(female_name)s%(endnotes)s was born %(birth_date)s%(birth_endnotes)s, " - "and died %(death_date)s in %(death_place)s" - "%(death_endnotes)s.") % { - 'female_name' : '', 'endnotes' : self.endnotes(pri_name), - 'birth_date' : bdate, 'death_date' : ddate, - 'birth_endnotes' : self.endnotes(birth), - 'death_endnotes' : self.endnotes(death), - 'death_place' : dplace, - }) - else: - self.doc.write_text(_("%(female_name)s%(endnotes)s was born %(birth_date)s%(birth_endnotes)s, " - "and died %(death_date)s%(death_endnotes)s.") % { - 'female_name' : '', 'endnotes' : self.endnotes(pri_name), - 'birth_endnotes' : self.endnotes(birth), - 'death_endnotes' : self.endnotes(death), - 'birth_date' : bdate, 'death_date' : ddate, - }) - else: - if dplace: - self.doc.write_text(_("%(female_name)s%(endnotes)s was born %(birth_date)s%(birth_endnotes)s, " - "and died in %(death_place)s%(death_endnotes)s.") % { - 'female_name' : '', 'endnotes' : self.endnotes(pri_name), - 'birth_endnotes' : self.endnotes(birth), - 'death_endnotes' : self.endnotes(death), - 'birth_date' : bdate, 'death_place' : dplace, - }) - else: - self.doc.write_text(_("%(female_name)s%(endnotes)s was " - "born %(birth_date)s%(birth_endnotes)s.") % { - 'female_name' : '', 'endnotes' : self.endnotes(pri_name), - 'birth_endnotes' : self.endnotes(birth), - 'birth_date' : bdate, - }) - else: - if bplace: - if ddate: - if dplace: - self.doc.write_text(_("%(female_name)s%(endnotes)s was born in %(birth_place)s%(birth_endnotes)s, " - "and died %(death_date)s in %(death_place)s%(death_endnotes)s.") % { - 'female_name' : '', 'endnotes' : self.endnotes(pri_name), - 'birth_endnotes' : self.endnotes(birth), - 'death_endnotes' : self.endnotes(death), - 'birth_place' : bplace, 'death_date' : ddate, 'death_place' : dplace, - }) - else: - self.doc.write_text(_("%(female_name)s%(endnotes)s was born in %(birth_place)s%(birth_endnotes)s, " - "and died %(death_date)s%(death_endnotes)s.") % { - 'female_name' : '', 'endnotes' : self.endnotes(pri_name), - 'birth_endnotes' : self.endnotes(birth), - 'death_endnotes' : self.endnotes(death), - 'birth_place' : bplace, 'death_date' : ddate, - }) - else: - if dplace: - self.doc.write_text(_("%(female_name)s%(endnotes)s was born in %(birth_place)s%(birth_endnotes)s, " - "and died in %(death_place)s%(death_endnotes)s.") % { - 'female_name' : '', 'endnotes' : self.endnotes(pri_name), - 'birth_endnotes' : self.endnotes(birth), - 'death_endnotes' : self.endnotes(death), - 'birth_place' : bplace,'death_place' : dplace, - }) - else: - self.doc.write_text(_("%(female_name)s%(endnotes)s was born " - "in %(birth_place)s%(birth_endnotes)s.") % { - 'female_name' : '', 'endnotes' : self.endnotes(pri_name), - 'birth_endnotes' : self.endnotes(birth), - 'birth_place' : bplace, - }) - else: - if ddate: - if dplace: - self.doc.write_text(_("%(female_name)s%(endnotes)s died %(death_date)s in " - "%(death_place)s%(death_endnotes)s.") % { - 'female_name' : '', 'endnotes' : self.endnotes(pri_name), - 'death_endnotes' : self.endnotes(death), - 'death_date' : ddate, 'death_place' : dplace, - }) - else: - self.doc.write_text(_("%(female_name)s%(endnotes)s " - "died %(death_date)s%(death_endnotes)s.") % { - 'female_name' : '', 'endnotes' : self.endnotes(pri_name), - 'death_endnotes' : self.endnotes(death), - 'death_date' : ddate, - }) - else: - if dplace: - self.doc.write_text(_("%(female_name)s%(endnotes)s died " - "in %(death_place)s%(death_endnotes)s.") % { - 'female_name' : '', 'endnotes' : self.endnotes(pri_name), - 'death_endnotes' : self.endnotes(death), - 'birth_date' : bdate, 'death_place' : dplace, - }) - else: - self.doc.write_text( "%s." % self.endnotes(pri_name) ) - - self.doc.write_text(' ') + death_valid = bool(person.get_death_handle()) self.print_parents(person,death_valid) self.print_spouse(person) self.doc.end_paragraph() @@ -506,6 +205,8 @@ class FtmDescendantReport(Report.Report): self.doc.end_paragraph() def endnotes(self,obj): + if not obj: + return "" msg = cStringIO.StringIO() slist = obj.get_source_references() if slist: @@ -680,7 +381,6 @@ class FtmDescendantReport(Report.Report): for child_handle in family.get_child_handle_list(): child = self.database.get_person_from_handle(child_handle) child_index = child_index + 1 - child_name = child.get_primary_name().get_regular_name() for (ind,p_id) in self.anc_map.items(): if p_id == child_handle: index = ind @@ -711,283 +411,11 @@ class FtmDescendantReport(Report.Report): self.doc.start_cell('FTD-Normal') self.doc.start_paragraph('FTD-Details') + + text = ReportUtils.born_died_str(self.database,child, + self.endnotes) + self.doc.write_text(text) - birth_handle = child.get_birth_handle() - bplace = "" - bdate = "" - if birth_handle: - birth = self.database.get_event_from_handle(birth_handle) - bdate = birth.get_date() - bplace_handle = birth.get_place_handle() - if bplace_handle: - bplace = self.database.get_place_from_handle(bplace_handle).get_title() - - death_handle = child.get_death_handle() - dplace = "" - ddate = "" - if death_handle: - death = self.database.get_event_from_handle(death_handle) - ddate = death.get_date() - dplace_handle = death.get_place_handle() - if dplace_handle: - dplace = self.database.get_place_from_handle(dplace_handle).get_title() - - if child.get_gender() == RelLib.Person.male: - if bdate: - if bplace: - if ddate: - if dplace: - self.doc.write_text(_("%(male_name)s%(endnotes)s " - "was born %(birth_date)s in %(birth_place)s%(birth_endnotes)s, " - "and died %(death_date)s in %(death_place)s%(death_endnotes)s.") % { - 'male_name' : child_name, 'endnotes' : self.endnotes(child.get_primary_name()), - 'birth_date' : bdate, 'birth_place' : bplace, - 'death_date' : ddate,'death_place' : dplace, - 'birth_endnotes' : self.endnotes(birth), - 'death_endnotes' : self.endnotes(death) }) - else: - self.doc.write_text(_("%(male_name)s%(endnotes)s " - "was born %(birth_date)s in %(birth_place)s%(birth_endnotes)s, " - "and died %(death_date)s%(death_endnotes)s.") % { - 'male_name' : child_name, 'endnotes' : self.endnotes(child.get_primary_name()), - 'birth_date' : bdate, 'birth_place' : bplace, 'death_date' : ddate, - 'birth_endnotes' : self.endnotes(birth), - 'death_endnotes' : self.endnotes(death) }) - else: - if dplace: - self.doc.write_text(_("%(male_name)s%(endnotes)s " - "was born %(birth_date)s in %(birth_place)s%(birth_endnotes)s, " - "and died in %(death_place)s%(death_endnotes)s.") % { - 'male_name' : child_name, 'endnotes' : self.endnotes(child.get_primary_name()), - 'birth_date' : bdate, 'birth_place' : bplace, 'death_place' : dplace, - 'birth_endnotes' : self.endnotes(birth), - 'death_endnotes' : self.endnotes(death) }) - else: - self.doc.write_text(_("%(male_name)s%(endnotes)s " - "was born %(birth_date)s in %(birth_place)s%(birth_endnotes)s.") % { - 'male_name' : child_name, 'endnotes' : self.endnotes(child.get_primary_name()), - 'birth_date' : bdate, 'birth_place' : bplace, - 'birth_endnotes' : self.endnotes(birth) }) - else: - if ddate: - if dplace: - self.doc.write_text(_("%(male_name)s%(endnotes)s " - "was born %(birth_date)s%(birth_endnotes)s, " - "and died %(death_date)s in %(death_place)s%(death_endnotes)s.") % { - 'male_name' : child_name, 'endnotes' : self.endnotes(child.get_primary_name()), - 'birth_date' : bdate, - 'death_date' : ddate,'death_place' : dplace, - 'birth_endnotes' : self.endnotes(birth), - 'death_endnotes' : self.endnotes(death) }) - else: - self.doc.write_text(_("%(male_name)s%(endnotes)s " - "was born %(birth_date)s%(birth_endnotes)s, " - "and died %(death_date)s%(death_endnotes)s.") % { - 'male_name' : child_name, 'endnotes' : self.endnotes(child.get_primary_name()), - 'birth_date' : bdate, 'death_date' : ddate, - 'birth_endnotes' : self.endnotes(birth), - 'death_endnotes' : self.endnotes(death) }) - else: - if dplace: - self.doc.write_text(_("%(male_name)s%(endnotes)s " - "was born %(birth_date)s%(birth_endnotes)s, " - "and died in %(death_place)s%(death_endnotes)s.") % { - 'male_name' : child_name, 'endnotes' : self.endnotes(child.get_primary_name()), - 'birth_date' : bdate, 'death_place' : dplace, - 'birth_endnotes' : self.endnotes(birth), - 'death_endnotes' : self.endnotes(death) }) - else: - self.doc.write_text(_("%(male_name)s%(endnotes)s " - "was born %(birth_date)s%(birth_endnotes)s.") % { - 'male_name' : child_name, 'endnotes' : self.endnotes(child.get_primary_name()), - 'birth_date' : bdate, 'birth_endnotes' : self.endnotes(birth) }) - else: - if bplace: - if ddate: - if dplace: - self.doc.write_text(_("%(male_name)s%(endnotes)s " - "was born in %(birth_place)s%(birth_endnotes)s, " - "and died %(death_date)s in %(death_place)s%(death_endnotes)s.") % { - 'male_name' : child_name, 'endnotes' : self.endnotes(child.get_primary_name()), - 'birth_place' : bplace, - 'death_date' : ddate,'death_place' : dplace, - 'birth_endnotes' : self.endnotes(birth), - 'death_endnotes' : self.endnotes(death) }) - else: - self.doc.write_text(_("%(male_name)s%(endnotes)s " - "was born in %(birth_place)s%(birth_endnotes)s, " - "and died %(death_date)s%(death_endnotes)s.") % { - 'male_name' : child_name, 'endnotes' : self.endnotes(child.get_primary_name()), - 'birth_place' : bplace, 'death_date' : ddate, - 'birth_endnotes' : self.endnotes(birth), - 'death_endnotes' : self.endnotes(death) }) - else: - if dplace: - self.doc.write_text(_("%(male_name)s%(endnotes)s " - "was born in %(birth_place)s%(birth_endnotes)s, " - "and died in %(death_place)s%(death_endnotes)s.") % { - 'male_name' : child_name, 'endnotes' : self.endnotes(child.get_primary_name()), - 'birth_place' : bplace, 'death_place' : dplace, - 'birth_endnotes' : self.endnotes(birth), - 'death_endnotes' : self.endnotes(death) }) - else: - self.doc.write_text(_("%(male_name)s%(endnotes)s " - "was born in %(birth_place)s%(birth_endnotes)s.") % { - 'male_name' : child_name, 'endnotes' : self.endnotes(child.get_primary_name()), - 'birth_place' : bplace, - 'birth_endnotes' : self.endnotes(birth) }) - else: - if ddate: - if dplace: - self.doc.write_text(_("%(male_name)s%(endnotes)s " - "died %(death_date)s in %(death_place)s%(death_endnotes)s.") % { - 'male_name' : child_name, 'endnotes' : self.endnotes(child.get_primary_name()), - 'death_date' : ddate, 'death_place' : dplace, - 'death_endnotes' : self.endnotes(death) }) - else: - self.doc.write_text(_("%(male_name)s%(endnotes)s " - "died %(death_date)s%(death_endnotes)s.") % { - 'male_name' : child_name, 'endnotes' : self.endnotes(child.get_primary_name()), - 'death_date' : ddate, - 'death_endnotes' : self.endnotes(death) }) - else: - if dplace: - self.doc.write_text(_("%(male_name)s%(endnotes)s " - "died in %(death_place)s%(death_endnotes)s.") % { - 'male_name' : child_name, 'endnotes' : self.endnotes(child.get_primary_name()), - 'death_place' : dplace, - 'death_endnotes' : self.endnotes(death) }) - else: - self.doc.write_text(_("%(male_name)s%(endnotes)s.") % { - 'male_name' : child_name, 'endnotes' : self.endnotes(child.get_primary_name()) }) - else: - if bdate: - if bplace: - if ddate: - if dplace: - self.doc.write_text(_("%(female_name)s%(endnotes)s " - "was born %(birth_date)s in %(birth_place)s%(birth_endnotes)s, " - "and died %(death_date)s in %(death_place)s%(death_endnotes)s.") % { - 'female_name' : child_name, 'endnotes' : self.endnotes(child.get_primary_name()), - 'birth_date' : bdate, 'birth_place' : bplace, - 'death_date' : ddate,'death_place' : dplace, - 'birth_endnotes' : self.endnotes(birth), - 'death_endnotes' : self.endnotes(death) }) - else: - self.doc.write_text(_("%(female_name)s%(endnotes)s " - "was born %(birth_date)s in %(birth_place)s%(birth_endnotes)s, " - "and died %(death_date)s%(death_endnotes)s.") % { - 'female_name' : child_name, 'endnotes' : self.endnotes(child.get_primary_name()), - 'birth_date' : bdate, 'birth_place' : bplace, 'death_date' : ddate, - 'birth_endnotes' : self.endnotes(birth), - 'death_endnotes' : self.endnotes(death) }) - else: - if dplace: - self.doc.write_text(_("%(female_name)s%(endnotes)s " - "was born %(birth_date)s in %(birth_place)s%(birth_endnotes)s, " - "and died in %(death_place)s%(death_endnotes)s.") % { - 'female_name' : child_name, 'endnotes' : self.endnotes(child.get_primary_name()), - 'birth_date' : bdate, 'birth_place' : bplace, 'death_place' : dplace, - 'birth_endnotes' : self.endnotes(birth), - 'death_endnotes' : self.endnotes(death) }) - else: - self.doc.write_text(_("%(female_name)s%(endnotes)s " - "was born %(birth_date)s in %(birth_place)s%(birth_endnotes)s.") % { - 'female_name' : child_name, 'endnotes' : self.endnotes(child.get_primary_name()), - 'birth_date' : bdate, 'birth_place' : bplace, - 'birth_endnotes' : self.endnotes(birth) }) - else: - if ddate: - if dplace: - self.doc.write_text(_("%(female_name)s%(endnotes)s " - "was born %(birth_date)s%(birth_endnotes)s, " - "and died %(death_date)s in %(death_place)s%(death_endnotes)s.") % { - 'female_name' : child_name, 'endnotes' : self.endnotes(child.get_primary_name()), - 'birth_date' : bdate, - 'death_date' : ddate,'death_place' : dplace, - 'birth_endnotes' : self.endnotes(birth), - 'death_endnotes' : self.endnotes(death) }) - else: - self.doc.write_text(_("%(female_name)s%(endnotes)s " - "was born %(birth_date)s%(birth_endnotes)s, " - "and died %(death_date)s%(death_endnotes)s.") % { - 'female_name' : child_name, 'endnotes' : self.endnotes(child.get_primary_name()), - 'birth_date' : bdate, 'death_date' : ddate, - 'birth_endnotes' : self.endnotes(birth), - 'death_endnotes' : self.endnotes(death) }) - else: - if dplace: - self.doc.write_text(_("%(female_name)s%(endnotes)s " - "was born %(birth_date)s%(birth_endnotes)s, " - "and died in %(death_place)s%(death_endnotes)s.") % { - 'female_name' : child_name, 'endnotes' : self.endnotes(child.get_primary_name()), - 'birth_date' : bdate, 'death_place' : dplace, - 'birth_endnotes' : self.endnotes(birth), - 'death_endnotes' : self.endnotes(death) }) - else: - self.doc.write_text(_("%(female_name)s%(endnotes)s " - "was born %(birth_date)s%(birth_endnotes)s.") % { - 'female_name' : child_name, 'endnotes' : self.endnotes(child.get_primary_name()), - 'birth_date' : bdate, 'birth_endnotes' : self.endnotes(birth) }) - else: - if bplace: - if ddate: - if dplace: - self.doc.write_text(_("%(female_name)s%(endnotes)s " - "was born in %(birth_place)s%(birth_endnotes)s, " - "and died %(death_date)s in %(death_place)s%(death_endnotes)s.") % { - 'female_name' : child_name, 'endnotes' : self.endnotes(child.get_primary_name()), - 'birth_place' : bplace, - 'death_date' : ddate,'death_place' : dplace, - 'birth_endnotes' : self.endnotes(birth), - 'death_endnotes' : self.endnotes(death) }) - else: - self.doc.write_text(_("%(female_name)s%(endnotes)s " - "was born in %(birth_place)s%(birth_endnotes)s, " - "and died %(death_date)s%(death_endnotes)s.") % { - 'female_name' : child_name, 'endnotes' : self.endnotes(child.get_primary_name()), - 'birth_place' : bplace, 'death_date' : ddate, - 'birth_endnotes' : self.endnotes(birth), - 'death_endnotes' : self.endnotes(death) }) - else: - if dplace: - self.doc.write_text(_("%(female_name)s%(endnotes)s " - "was born in %(birth_place)s%(birth_endnotes)s, " - "and died in %(death_place)s%(death_endnotes)s.") % { - 'female_name' : child_name, 'endnotes' : self.endnotes(child.get_primary_name()), - 'birth_place' : bplace, 'death_place' : dplace, - 'birth_endnotes' : self.endnotes(birth), - 'death_endnotes' : self.endnotes(death) }) - else: - self.doc.write_text(_("%(female_name)s%(endnotes)s " - "was born in %(birth_place)s%(birth_endnotes)s.") % { - 'female_name' : child_name, 'endnotes' : self.endnotes(child.get_primary_name()), - 'birth_place' : bplace, - 'birth_endnotes' : self.endnotes(birth) }) - else: - if ddate: - if dplace: - self.doc.write_text(_("%(female_name)s%(endnotes)s " - "died %(death_date)s in %(death_place)s%(death_endnotes)s.") % { - 'female_name' : child_name, 'endnotes' : self.endnotes(child.get_primary_name()), - 'death_date' : ddate, 'death_place' : dplace, - 'death_endnotes' : self.endnotes(death) }) - else: - self.doc.write_text(_("%(female_name)s%(endnotes)s " - "died %(death_date)s%(death_endnotes)s.") % { - 'female_name' : child_name, 'endnotes' : self.endnotes(child.get_primary_name()), - 'death_date' : ddate, - 'death_endnotes' : self.endnotes(death) }) - else: - if dplace: - self.doc.write_text(_("%(female_name)s%(endnotes)s " - "died in %(death_place)s%(death_endnotes)s.") % { - 'female_name' : child_name, 'endnotes' : self.endnotes(child.get_primary_name()), - 'death_place' : dplace, - 'death_endnotes' : self.endnotes(death) }) - else: - self.doc.write_text(_("%(female_name)s%(endnotes)s.") % { - 'female_name' : child_name, 'endnotes' : self.endnotes(child.get_primary_name()) }) self.doc.end_paragraph() self.doc.end_cell() self.doc.end_row() @@ -996,7 +424,6 @@ class FtmDescendantReport(Report.Report): self.doc.end_table() first = 1 - def print_spouse(self,person): family_list = person.get_family_handle_list() if not family_list: @@ -1021,362 +448,20 @@ class FtmDescendantReport(Report.Report): if not event: return - date = event.get_date() - place_handle = event.get_place_handle() - if place_handle: - place = self.database.get_place_from_handle(place_handle).get_title() - else: - place = "" - if date and place: - if person.get_gender() == RelLib.Person.male: - self.doc.write_text(_('He married %(spouse)s %(date)s in %(place)s%(endnotes)s.') % { - 'spouse' : spouse.get_primary_name().get_regular_name(), - 'endnotes' : self.endnotes(event), - 'date' : date, - 'place' : place}) - else: - self.doc.write_text(_('She married %(spouse)s %(date)s in %(place)s%(endnotes)s.') % { - 'spouse' : spouse.get_primary_name().get_regular_name(), - 'date' : date, - 'endnotes' : self.endnotes(event), - 'place' : place}) - elif date: - if person.get_gender() == RelLib.Person.male: - self.doc.write_text(_('He married %(spouse)s %(date)s%(endnotes)s.') % { - 'spouse' : spouse.get_primary_name().get_regular_name(), - 'endnotes' : self.endnotes(event), - 'date' : date,}) - else: - self.doc.write_text(_('She married %(spouse)s in %(place)s%(endnotes)s.') % { - 'spouse' : spouse.get_primary_name().get_regular_name(), - 'endnotes' : self.endnotes(event), - 'place' : place,}) - elif place: - if person.get_gender() == RelLib.Person.male: - self.doc.write_text(_('He married %(spouse)s in %(place)s%(endnotes)s.') % { - 'spouse' : spouse.get_primary_name().get_regular_name(), - 'endnotes' : self.endnotes(event), - 'place' : place}) - else: - self.doc.write_text(_('She married %(spouse)s in %(place)s%(endnotes)s.') % { - 'spouse' : spouse.get_primary_name().get_regular_name(), - 'endnotes' : self.endnotes(event), - 'place' : place}) - else: - if person.get_gender() == RelLib.Person.male: - self.doc.write_text(_('He married %(spouse)s%(endnotes)s.') % { - 'spouse' : spouse.get_primary_name().get_regular_name(), - 'endnotes' : self.endnotes(event) }) - else: - self.doc.write_text(_('She married %(spouse)s%(endnotes)s.') % { - 'spouse' : spouse.get_primary_name().get_regular_name(), - 'endnotes' : self.endnotes(event)}) - self.doc.write_text(' ') - - birth_handle = spouse.get_birth_handle() - bplace = "" - bdate = "" - if birth_handle: - birth = self.database.get_event_from_handle(birth_handle) - bdate = birth.get_date() - bplace_handle = birth.get_place_handle() - if bplace_handle: - bplace = self.database.get_place_from_handle(bplace_handle).get_title() - - death_handle = spouse.get_death_handle() - dplace = "" - ddate = "" - if death_handle: - death = self.database.get_event_from_handle(death_handle) - ddate = death.get_date() - dplace_handle = death.get_place_handle() - if dplace_handle: - dplace = self.database.get_place_from_handle(dplace_handle).get_title() - - death_valid = ddate or dplace - birth_valid = bdate or bplace - - if birth_valid or death_valid: - if spouse.get_gender() == RelLib.Person.male: - if bdate: - if bplace: - if ddate: - if dplace: - self.doc.write_text(_("%(male_name)s%(endnotes)s was born %(birth_date)s " - "in %(birth_place)s%(birth_endnotes)s, " - "and died %(death_date)s in %(death_place)s" - "%(death_endnotes)s.") % { - 'male_name' : _('He'), 'endnotes' : '', - 'birth_date' : bdate, 'birth_place' : bplace, - 'death_date' : ddate,'death_place' : dplace, - 'birth_endnotes' : self.endnotes(birth), - 'death_endnotes' : self.endnotes(death), - }) - else: - self.doc.write_text(_("%(male_name)s%(endnotes)s was born %(birth_date)s " - "in %(birth_place)s%(birth_endnotes)s, " - "and died %(death_date)s%(death_endnotes)s.") % { - 'male_name' : _('He'), 'endnotes' : '', - 'birth_date' : bdate, 'birth_place' : bplace, - 'death_date' : ddate, - 'birth_endnotes' : self.endnotes(birth), - 'death_endnotes' : self.endnotes(death), - }) - else: - if dplace: - self.doc.write_text(_("%(male_name)s%(endnotes)s was born %(birth_date)s " - "in %(birth_place)s%(birth_endnotes)s, " - "and died in %(death_place)s%(death_endnotes)s.") % { - 'male_name' : _('He'), 'endnotes' : '', - 'birth_date' : bdate, 'birth_place' : bplace, - 'birth_endnotes' : self.endnotes(birth), - 'death_endnotes' : self.endnotes(death), - 'death_place' : dplace, - }) - else: - self.doc.write_text(_("%(male_name)s%(endnotes)s was born %(birth_date)s in " - "%(birth_place)s%(birth_endnotes)s.") % { - 'male_name' : _('He'), 'endnotes' : '', - 'birth_date' : bdate, 'birth_place' : bplace, - 'birth_endnotes' : self.endnotes(birth), - }) - else: - if ddate: - if dplace: - self.doc.write_text(_("%(male_name)s%(endnotes)s was born %(birth_date)s%(birth_endnotes)s, " - "and died %(death_date)s in %(death_place)s" - "%(death_endnotes)s.") % { - 'male_name' : _('He'), 'endnotes' : '', - 'birth_date' : bdate, 'death_date' : ddate, - 'death_place' : dplace, - 'birth_endnotes' : self.endnotes(birth), - 'death_endnotes' : self.endnotes(death), - }) - else: - self.doc.write_text(_("%(male_name)s%(endnotes)s was born %(birth_date)s%(birth_endnotes)s, " - "and died %(death_date)s%(death_endnotes)s.") % { - 'male_name' : _('He'), 'endnotes' : '', - 'birth_date' : bdate, 'death_date' : ddate, - 'birth_endnotes' : self.endnotes(birth), - 'death_endnotes' : self.endnotes(death), - }) - else: - if dplace: - self.doc.write_text(_("%(male_name)s%(endnotes)s was born %(birth_date)s%(birth_endnotes)s, " - "and died in %(death_place)s%(death_endnotes)s.") % { - 'male_name' : _('He'), 'endnotes' : '', - 'birth_date' : bdate, 'death_place' : dplace, - 'birth_endnotes' : self.endnotes(birth), - 'death_endnotes' : self.endnotes(death), - }) - else: - self.doc.write_text(_("%(male_name)s%(endnotes)s was born " - "%(birth_date)s%(birth_endnotes)s.") % { - 'male_name' : _('He'), 'endnotes' : '', - 'birth_date' : bdate, - 'birth_endnotes' : self.endnotes(birth), - }) - else: - if bplace: - if ddate: - if dplace: - self.doc.write_text(_("%(male_name)s%(endnotes)s was born in %(birth_place)s%(birth_endnotes)s, " - "and died %(death_date)s in %(death_place)s" - "%(death_endnotes)s.") % { - 'male_name' : _('He'), 'endnotes' : '', - 'birth_place' : bplace, 'death_date' : ddate, 'death_place' : dplace, - 'birth_endnotes' : self.endnotes(birth), - 'death_endnotes' : self.endnotes(death), - }) - else: - self.doc.write_text(_("%(male_name)s%(endnotes)s was born in %(birth_place)s%(birth_endnotes)s, " - "and died %(death_date)s%(death_endnotes)s.") % { - 'male_name' : _('He'), 'endnotes' : '', - 'birth_endnotes' : self.endnotes(birth), - 'death_endnotes' : self.endnotes(death), - 'birth_place' : bplace, 'death_date' : ddate, - }) - else: - if dplace: - self.doc.write_text(_("%(male_name)s%(endnotes)s was born in %(birth_place)s%(birth_endnotes)s, " - "and died in %(death_place)s%(death_endnotes)s.") % { - 'male_name' : _('He'), 'endnotes' : '', - 'birth_place' : bplace,'death_place' : dplace, - 'birth_endnotes' : self.endnotes(birth), - 'death_endnotes' : self.endnotes(death), - }) - else: - self.doc.write_text(_("%(male_name)s%(endnotes)s was born " - "in %(birth_place)s%(birth_endnotes)s.") % { - 'male_name' : _('He'), 'endnotes' : '', - 'birth_place' : bplace, - 'birth_endnotes' : self.endnotes(birth), - }) - else: - if ddate: - if dplace: - self.doc.write_text(_("%(male_name)s%(endnotes)s died %(death_date)s in " - "%(death_place)s%(death_endnotes)s.") % { - 'male_name' : _('He'), 'endnotes' : '', - 'death_date' : ddate, 'death_place' : dplace, - 'death_endnotes' : self.endnotes(death), - }) - else: - self.doc.write_text(_("%(male_name)s%(endnotes)s " - "died %(death_date)s%(death_endnotes)s.") % { - 'male_name' : _('He'), 'endnotes' : '', - 'death_date' : ddate, - 'death_endnotes' : self.endnotes(death), - }) - else: - if dplace: - self.doc.write_text(_("%(male_name)s%(endnotes)s died " - "in %(death_place)s%(death_endnotes)s.") % { - 'male_name' : _('He'), 'endnotes' : '', - 'death_endnotes' : self.endnotes(death), - 'death_place' : dplace, - }) - else: - if bdate: - if bplace: - if ddate: - if dplace: - self.doc.write_text(_("%(female_name)s%(endnotes)s was born %(birth_date)s in %(birth_place)s" - "%(birth_endnotes)s, " - "and died %(death_date)s in %(death_place)s" - "%(death_endnotes)s.") % { - 'female_name' : _('She'), 'endnotes' : '', - 'birth_date' : bdate, 'birth_place' : bplace, - 'death_date' : ddate,'death_place' : dplace, - 'birth_endnotes' : self.endnotes(birth), - 'death_endnotes' : self.endnotes(death), - }) - else: - self.doc.write_text(_("%(female_name)s%(endnotes)s was born %(birth_date)s in %(birth_place)s" - "%(birth_endnotes)s, " - "and died %(death_date)s%(death_endnotes)s.") % { - 'female_name' : _('She'), 'endnotes' : '', - 'birth_date' : bdate, 'birth_place' : bplace, - 'birth_endnotes' : self.endnotes(birth), - 'death_endnotes' : self.endnotes(death), - 'death_date' : ddate, - }) - else: - if dplace: - self.doc.write_text(_("%(female_name)s%(endnotes)s was born %(birth_date)s in %(birth_place)s" - "%(birth_endnotes)s, " - "and died in %(death_place)s%(death_endnotes)s.") % { - 'female_name' : _('She'), 'endnotes' : '', - 'birth_date' : bdate, 'birth_place' : bplace, - 'death_place' : dplace, - 'birth_endnotes' : self.endnotes(birth), - 'death_endnotes' : self.endnotes(death), - }) - else: - self.doc.write_text(_("%(female_name)s%(endnotes)s was born %(birth_date)s " - "in %(birth_place)s%(birth_endnotes)s.") % { - 'female_name' : _('She'), 'endnotes' : '', - 'birth_endnotes' : self.endnotes(birth), - 'birth_date' : bdate, 'birth_place' : bplace, - }) - else: - if ddate: - if dplace: - self.doc.write_text(_("%(female_name)s%(endnotes)s was born %(birth_date)s%(birth_endnotes)s, " - "and died %(death_date)s in %(death_place)s" - "%(death_endnotes)s.") % { - 'female_name' : _('She'), 'endnotes' : '', - 'birth_date' : bdate, 'death_date' : ddate, - 'birth_endnotes' : self.endnotes(birth), - 'death_endnotes' : self.endnotes(death), - 'death_place' : dplace, - }) - else: - self.doc.write_text(_("%(female_name)s%(endnotes)s was born %(birth_date)s%(birth_endnotes)s, " - "and died %(death_date)s%(death_endnotes)s.") % { - 'female_name' : _('She'), 'endnotes' : '', - 'birth_endnotes' : self.endnotes(birth), - 'death_endnotes' : self.endnotes(death), - 'birth_date' : bdate, 'death_date' : ddate, - }) - else: - if dplace: - self.doc.write_text(_("%(female_name)s%(endnotes)s was born %(birth_date)s%(birth_endnotes)s, " - "and died in %(death_place)s%(death_endnotes)s.") % { - 'female_name' : _('She'), 'endnotes' : '', - 'birth_endnotes' : self.endnotes(birth), - 'death_endnotes' : self.endnotes(death), - 'birth_date' : bdate, 'death_place' : dplace, - }) - else: - self.doc.write_text(_("%(female_name)s%(endnotes)s was " - "born %(birth_date)s%(birth_endnotes)s.") % { - 'female_name' : _('She'), 'endnotes' : '', - 'birth_endnotes' : self.endnotes(birth), - 'birth_date' : bdate, - }) - else: - if bplace: - if ddate: - if dplace: - self.doc.write_text(_("%(female_name)s%(endnotes)s was born in %(birth_place)s%(birth_endnotes)s, " - "and died %(death_date)s in %(death_place)s%(death_endnotes)s.") % { - 'female_name' : _('She'), 'endnotes' : '', - 'birth_endnotes' : self.endnotes(birth), - 'death_endnotes' : self.endnotes(death), - 'birth_place' : bplace, 'death_date' : ddate, 'death_place' : dplace, - }) - else: - self.doc.write_text(_("%(female_name)s%(endnotes)s was born in %(birth_place)s%(birth_endnotes)s, " - "and died %(death_date)s%(death_endnotes)s.") % { - 'female_name' : _('She'), 'endnotes' : '', - 'birth_endnotes' : self.endnotes(birth), - 'death_endnotes' : self.endnotes(death), - 'birth_place' : bplace, 'death_date' : ddate, - }) - else: - if dplace: - self.doc.write_text(_("%(female_name)s%(endnotes)s was born in %(birth_place)s%(birth_endnotes)s, " - "and died in %(death_place)s%(death_endnotes)s.") % { - 'female_name' : _('She'), 'endnotes' : '', - 'birth_endnotes' : self.endnotes(birth), - 'death_endnotes' : self.endnotes(death), - 'birth_place' : bplace,'death_place' : dplace, - }) - else: - self.doc.write_text(_("%(female_name)s%(endnotes)s was born " - "in %(birth_place)s%(birth_endnotes)s.") % { - 'female_name' : _('She'), 'endnotes' : '', - 'birth_endnotes' : self.endnotes(birth), - 'birth_place' : bplace, - }) - else: - if ddate: - if dplace: - self.doc.write_text(_("%(female_name)s%(endnotes)s died %(death_date)s in " - "%(death_place)s%(death_endnotes)s.") % { - 'female_name' : _('She'), 'endnotes' : '', - 'death_endnotes' : self.endnotes(death), - 'death_date' : ddate, 'death_place' : dplace, - }) - else: - self.doc.write_text(_("%(female_name)s%(endnotes)s " - "died %(death_date)s%(death_endnotes)s.") % { - 'female_name' : _('She'), 'endnotes' : '', - 'death_endnotes' : self.endnotes(death), - 'death_date' : ddate, - }) - else: - if dplace: - self.doc.write_text(_("%(female_name)s%(endnotes)s died " - "in %(death_place)s%(death_endnotes)s.") % { - 'female_name' : _('She'), 'endnotes' : '', - 'death_endnotes' : self.endnotes(death), - 'birth_date' : bdate, 'death_place' : dplace, - }) - + text = ReportUtils.married_str(self.database,person,spouse,event, + self.endnotes) + if text: + self.doc.write_text(text) self.doc.write_text(' ') + + text = ReportUtils.born_died_str(self.database,spouse, + self.endnotes,"",0) + if text: + self.doc.write_text(text) + self.doc.write_text(' ') + + death_valid = bool(spouse.get_death_handle()) self.print_parents(spouse,death_valid) @@ -1387,63 +472,21 @@ class FtmDescendantReport(Report.Report): mother_handle = family.get_mother_handle() if mother_handle: mother = self.database.get_person_from_handle(mother_handle) + mother_name = mother.get_primary_name().get_regular_name() else: - mother = None + mother_name = "" father_handle = family.get_father_handle() if father_handle: father = self.database.get_person_from_handle(father_handle) + father_name = father.get_primary_name().get_regular_name() else: - father = None - if person.get_gender() == RelLib.Person.male: - if mother and father: - if dead: - self.doc.write_text(_("He was the son of %(father)s and %(mother)s.") % { - 'father' : father.get_primary_name().get_regular_name(), - 'mother' : mother.get_primary_name().get_regular_name(), }) - else: - self.doc.write_text(_("He is the son of %(father)s and %(mother)s.") % { - 'father' : father.get_primary_name().get_regular_name(), - 'mother' : mother.get_primary_name().get_regular_name(), }) - elif mother: - if dead: - self.doc.write_text(_("He was the son of %(mother)s.") % { - 'mother' : mother.get_primary_name().get_regular_name(), }) - else: - self.doc.write_text(_("He is the son of %(mother)s.") % { - 'mother' : mother.get_primary_name().get_regular_name(), }) - elif father: - if dead: - self.doc.write_text(_("He was the son of %(father)s.") % { - 'father' : father.get_primary_name().get_regular_name(), }) - else: - self.doc.write_text(_("He is the son of %(father)s.") % { - 'father' : father.get_primary_name().get_regular_name(), }) - else: - if mother and father: - if dead: - self.doc.write_text(_("She was the daughter of %(father)s and %(mother)s.") % { - 'father' : father.get_primary_name().get_regular_name(), - 'mother' : mother.get_primary_name().get_regular_name(), }) - else: - self.doc.write_text(_("She is the daughter of %(father)s and %(mother)s.") % { - 'father' : father.get_primary_name().get_regular_name(), - 'mother' : mother.get_primary_name().get_regular_name(), }) - elif mother: - if dead: - self.doc.write_text(_("She was the daughter of %(mother)s.") % { - 'mother' : mother.get_primary_name().get_regular_name(), }) - else: - self.doc.write_text(_("She is the daughter of %(mother)s.") % { - 'mother' : mother.get_primary_name().get_regular_name(), }) - elif father: - if dead: - self.doc.write_text(_("She was the daughter of %(father)s.") % { - 'father' : father.get_primary_name().get_regular_name(), }) - else: - self.doc.write_text(_("She is the daughter of %(father)s.") % { - 'father' : father.get_primary_name().get_regular_name(), }) - self.doc.write_text(' '); + father_name = "" + text = ReportUtils.child_str(person.get_gender(), + father_name,mother_name,dead) + if text: + self.doc.write_text(text) + self.doc.write_text(' ') #------------------------------------------------------------------------ #