From 174fe82e52a7f2184c5c6da68f3ef6ce0c3f1ea3 Mon Sep 17 00:00:00 2001 From: Brian Matherly Date: Sat, 12 Aug 2006 03:37:05 +0000 Subject: [PATCH] * src/plugins/DetDescendantReport.py: fix spouse name printing * src/plugins/DetAncestralReport.py: fix spouse name printing svn: r7156 --- ChangeLog | 4 +++ src/plugins/DetAncestralReport.py | 35 ++++++++++++++++++++++---- src/plugins/DetDescendantReport.py | 40 +++++++++++++++++++++++------- 3 files changed, 65 insertions(+), 14 deletions(-) diff --git a/ChangeLog b/ChangeLog index d8612518c..e290d841a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2006-08-11 Brian Matherly + * src/plugins/DetDescendantReport.py: fix spouse name printing + * src/plugins/DetAncestralReport.py: fix spouse name printing + 2006-08-11 Don Allingham * src/DisplayModels/_PeopleModel.py: fix sorting of names diff --git a/src/plugins/DetAncestralReport.py b/src/plugins/DetAncestralReport.py index cc78d8d88..ddedf329b 100644 --- a/src/plugins/DetAncestralReport.py +++ b/src/plugins/DetAncestralReport.py @@ -454,6 +454,7 @@ class DetAncestorReport(Report): family = self.database.get_family_from_handle(family_handle) person_name = "" ind_handle = None + has_info = False person_key = "" if mate.get_gender() == RelLib.Person.MALE: ind_handle = family.get_mother_handle() @@ -464,34 +465,58 @@ class DetAncestorReport(Report): person_name = _nd.display(ind) person_mark = ReportUtils.get_person_mark(self.database,ind) firstName = ReportUtils.common_name(ind,self.usenick) + + for event_ref in ind.get_event_ref_list(): + event = self.database.get_event_from_handle(event_ref.ref) + if event: + etype = event.get_type() + if etype == RelLib.EventType.BURIAL or \ + etype == RelLib.EventType.BIRTH or \ + etype == RelLib.EventType.DEATH : + has_info = True + break + if not has_info: + family_handle = ind.get_main_parents_family_handle() + if family_handle: + f = self.database.get_family_from_handle(family_handle) + if f.get_mother_handle() or f.get_father_handle(): + has_info = True else: firstName = 0 - if person_name: + print_name = "" + + if person_name and has_info: self.doc.start_paragraph("DAR-Entry") self.doc.write_text(person_name,person_key) - text = ReportUtils.born_str(self.database,ind,"", + text = ReportUtils.born_str(self.database,ind,print_name, self.EMPTY_DATE,self.EMPTY_PLACE) if text: self.doc.write_text(text) + print_name = 0; age,units = self.calc_age(ind) - text = ReportUtils.died_str(self.database,ind,0, + text = ReportUtils.died_str(self.database,ind,print_name, self.EMPTY_DATE,self.EMPTY_PLACE,age,units) if text: self.doc.write_text(text) + print_name = 0; - text = ReportUtils.buried_str(self.database,ind,0, + text = ReportUtils.buried_str(self.database,ind,print_name, self.EMPTY_DATE,self.EMPTY_PLACE) if text: self.doc.write_text(text) + print_name = 0; - self.write_parents(ind, firstName) + if print_name == 0: + print_name = firstName + self.write_parents(ind, print_name) self.doc.end_paragraph() + if person_name: if self.listChildren and mate.get_gender()==RelLib.Person.MALE: self.write_children(family) diff --git a/src/plugins/DetDescendantReport.py b/src/plugins/DetDescendantReport.py index 6a595e049..4c72eecc4 100644 --- a/src/plugins/DetDescendantReport.py +++ b/src/plugins/DetDescendantReport.py @@ -480,12 +480,12 @@ class DetDescendantReport(Report): def write_mate(self, mate): """Output birth, death, parentage, marriage and notes information """ - for family_handle in mate.get_family_handle_list(): family = self.database.get_family_from_handle(family_handle) person_name = "" ind_handle = None - person_mark = None + has_info = False + person_key = "" if mate.get_gender() == RelLib.Person.MALE: ind_handle = family.get_mother_handle() else: @@ -495,35 +495,57 @@ class DetDescendantReport(Report): person_name = _nd.display(ind) person_mark = ReportUtils.get_person_mark(self.database,ind) firstName = ReportUtils.common_name(ind,self.usenick) + + for event_ref in ind.get_event_ref_list(): + event = self.database.get_event_from_handle(event_ref.ref) + if event: + etype = event.get_type() + if etype == RelLib.EventType.BURIAL or \ + etype == RelLib.EventType.BIRTH or \ + etype == RelLib.EventType.DEATH : + has_info = True + break + if not has_info: + family_handle = ind.get_main_parents_family_handle() + if family_handle: + f = self.database.get_family_from_handle(family_handle) + if f.get_mother_handle() or f.get_father_handle(): + has_info = True else: firstName = 0 - if person_name: + print_name = "" + + if person_name and has_info: self.doc.start_paragraph("DDR-Entry") - self.doc.write_text(person_name,person_mark) + self.doc.write_text(person_name,person_key) - text = ReportUtils.born_str(self.database,ind,"", + text = ReportUtils.born_str(self.database,ind,print_name, self.EMPTY_DATE,self.EMPTY_PLACE) if text: self.doc.write_text(text) + print_name = 0; age,units = self.calc_age(ind) - text = ReportUtils.died_str(self.database,ind,0, + text = ReportUtils.died_str(self.database,ind,print_name, self.EMPTY_DATE,self.EMPTY_PLACE,age,units) if text: self.doc.write_text(text) + print_name = 0; - text = ReportUtils.buried_str(self.database,ind,0, + text = ReportUtils.buried_str(self.database,ind,print_name, self.EMPTY_DATE,self.EMPTY_PLACE) if text: self.doc.write_text(text) + print_name = 0; - self.write_parents(ind, firstName) + if print_name == 0: + print_name = firstName + self.write_parents(ind, print_name) self.doc.end_paragraph() - def calc_age(self,ind): """ Calulate age.