From 4f64dd0feaa859ce48127e101dbfb1106235bea0 Mon Sep 17 00:00:00 2001 From: Tim Waugh Date: Mon, 13 Dec 2004 19:00:12 +0000 Subject: [PATCH] 2004-12-13 Tim Waugh * src/plugins/Ancestors.py (generation): Avoid empty sections. svn: r3801 --- ChangeLog | 3 +++ src/plugins/Ancestors.py | 30 +++++++++++++++++------------- 2 files changed, 20 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index ceb003037..a6c7a9009 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +2004-12-13 Tim Waugh + * src/plugins/Ancestors.py (generation): Avoid empty sections. + 2004-12-09 Alex Roitman * src/PedView.py (get_distance): Remove function; use similar from Relationship module. diff --git a/src/plugins/Ancestors.py b/src/plugins/Ancestors.py index 58511eaf7..093b1ff47 100644 --- a/src/plugins/Ancestors.py +++ b/src/plugins/Ancestors.py @@ -227,6 +227,7 @@ class ComprehensiveAncestorsReport (Report.Report): for family_handle in pfamily_handles: people.extend (self.family (family_handle, already_described)) + paternal_known = (len (people) > 0) if thisgen > 2 and len (mfamily_handles): for self.gp in [self.database.get_family_from_handle(mfamily_handles[0]).get_father_handle (), self.database.get_family_from_handle(mfamily_handles[0]).get_mother_handle ()]: @@ -248,7 +249,7 @@ class ComprehensiveAncestorsReport (Report.Report): if len (people): if self.pgbrk: self.doc.page_break() - self.doc.start_paragraph ("AR-Heading") + family_handles = pfamily_handles family_handles.extend (mfamily_handles) for self.gp in [self.database.get_family_from_handle(family_handles[0]).get_father_handle (), @@ -256,19 +257,22 @@ class ComprehensiveAncestorsReport (Report.Report): if self.gp: break - relstring = self.relationship.get_grandparents_string (self.start, - self.database.get_person_from_handle(self.gp))[0] - if thisgen == 2: - heading = _("%(name)s's %(parents)s") % \ - { 'name': self.first_name_or_nick (self.start), - 'parents': relstring } - else: - heading = _("%(name)s's paternal %(grandparents)s") % \ - { 'name': self.first_name_or_nick (self.start), - 'grandparents': relstring } + if paternal_known: + self.doc.start_paragraph ("AR-Heading") + relstring = self.relationship.get_grandparents_string (self.start, + self.database.get_person_from_handle(self.gp))[0] + if thisgen == 2: + heading = _("%(name)s's %(parents)s") % \ + { 'name': self.first_name_or_nick (self.start), + 'parents': relstring } + else: + heading = _("%(name)s's paternal %(grandparents)s") % \ + { 'name': self.first_name_or_nick (self.start), + 'grandparents': relstring } + + self.doc.write_text (heading) + self.doc.end_paragraph () - self.doc.write_text (heading) - self.doc.end_paragraph () self.write_paragraphs (people) next_pfamily_handles = []