From 07ce8c22d8ad82eff4507931ba4af17bfbc95be2 Mon Sep 17 00:00:00 2001 From: Paul Franklin Date: Wed, 10 May 2017 20:18:52 -0700 Subject: [PATCH] add gramps-ID option to DAR and DDR text reports --- gramps/plugins/textreport/ancestorreport.py | 7 ++++--- gramps/plugins/textreport/detancestralreport.py | 12 ++++++++++++ gramps/plugins/textreport/detdescendantreport.py | 12 ++++++++++++ 3 files changed, 28 insertions(+), 3 deletions(-) diff --git a/gramps/plugins/textreport/ancestorreport.py b/gramps/plugins/textreport/ancestorreport.py index bf062d492..b0d555206 100644 --- a/gramps/plugins/textreport/ancestorreport.py +++ b/gramps/plugins/textreport/ancestorreport.py @@ -292,9 +292,12 @@ class AncestorOptions(MenuReportOptions): menu.add_option(category_name, "pid", self.__pid) maxgen = NumberOption(_("Generations"), 10, 1, 100) - maxgen.set_help(_("The number of generations to include in the report")) + maxgen.set_help( + _("The number of generations to include in the report")) menu.add_option(category_name, "maxgen", maxgen) + stdoptions.add_gramps_id_option(menu, category_name) + pagebbg = BooleanOption(_("Page break between generations"), False) pagebbg.set_help( _("Whether to start a new page after each generation.")) @@ -304,8 +307,6 @@ class AncestorOptions(MenuReportOptions): namebrk.set_help(_("Whether a line break should follow the name.")) menu.add_option(category_name, "namebrk", namebrk) - stdoptions.add_gramps_id_option(menu, category_name) - category_name = _("Report Options (2)") stdoptions.add_name_format_option(menu, category_name) diff --git a/gramps/plugins/textreport/detancestralreport.py b/gramps/plugins/textreport/detancestralreport.py index 57be77c8f..8f1215ec9 100644 --- a/gramps/plugins/textreport/detancestralreport.py +++ b/gramps/plugins/textreport/detancestralreport.py @@ -92,6 +92,7 @@ class DetAncestorReport(Report): that come in the options class. gen - Maximum number of generations to include. + inc_id - Whether to include Gramps IDs pagebgg - Whether to include page breaks between generations. pageben - Whether to include page break before End Notes. firstName - Whether to use first names instead of pronouns. @@ -156,6 +157,7 @@ class DetAncestorReport(Report): self.inc_srcnotes = get_value('incsrcnotes') self.inc_attrs = get_value('incattrs') self.initial_sosa = get_value('initial_sosa') + self.want_ids = get_value('inc_id') pid = get_value('pid') self.other_events = get_value('incotherevents') @@ -298,6 +300,8 @@ class DetAncestorReport(Report): elif name: self.doc.write_text_citation("%s. " % self.endnotes(person)) self.doc.end_bold() + if self.want_ids: + self.doc.write_text('(%s) ' % person.get_gramps_id()) if self.dupperson: # Check for duplicate record (result of distant cousins marrying) @@ -557,6 +561,8 @@ class DetAncestorReport(Report): self._nd) if text: self.doc.write_text_citation(text, spouse_mark) + if self.want_ids: + self.doc.write_text(' (%s)' % family.get_gramps_id()) is_first = False def write_children(self, family): @@ -614,6 +620,8 @@ class DetAncestorReport(Report): self.__narrator.set_subject(child) if child_name: self.doc.write_text("%s. " % child_name, child_mark) + if self.want_ids: + self.doc.write_text('(%s) ' % child.get_gramps_id()) self.doc.write_text_citation( self.__narrator.get_born_string() or self.__narrator.get_christened_string() or @@ -735,6 +743,8 @@ class DetAncestorReport(Report): mark) if name[-1:] != '.': self.doc.write_text(".") + if self.want_ids: + self.doc.write_text(' (%s)' % ind.get_gramps_id()) self.doc.write_text_citation(self.endnotes(ind)) self.doc.end_paragraph() @@ -821,6 +831,8 @@ class DetAncestorOptions(MenuReportOptions): gen.set_help(_("The number of generations to include in the report")) addopt("gen", gen) + stdoptions.add_gramps_id_option(menu, category) + pagebbg = BooleanOption(_("Page break between generations"), False) pagebbg.set_help( _("Whether to start a new page after each generation.")) diff --git a/gramps/plugins/textreport/detdescendantreport.py b/gramps/plugins/textreport/detdescendantreport.py index 17af6dad4..7b0358065 100644 --- a/gramps/plugins/textreport/detdescendantreport.py +++ b/gramps/plugins/textreport/detdescendantreport.py @@ -95,6 +95,7 @@ class DetDescendantReport(Report): that come in the options class. gen - Maximum number of generations to include. + inc_id - Whether to include Gramps IDs pagebgg - Whether to include page breaks between generations. pageben - Whether to include page break before End Notes. fulldates - Whether to use full dates instead of just year. @@ -177,6 +178,7 @@ class DetDescendantReport(Report): self.inc_paths = get_value('incpaths') self.inc_ssign = get_value('incssign') self.inc_materef = get_value('incmateref') + self.want_ids = get_value('inc_id') pid = get_value('pid') self.center_person = self._db.get_person_from_gramps_id(pid) @@ -439,6 +441,8 @@ class DetDescendantReport(Report): elif name: self.doc.write_text_citation("%s. " % self.endnotes(person)) self.doc.end_bold() + if self.want_ids: + self.doc.write_text('(%s)' % person.get_gramps_id()) if self.inc_paths: self.write_path(person) @@ -597,6 +601,8 @@ class DetDescendantReport(Report): self._name_display) if text: self.doc.write_text_citation(text, spouse_mark) + if self.want_ids: + self.doc.write_text('(%s)' % family.get_gramps_id()) is_first = False def __write_mate(self, person, family): @@ -627,6 +633,8 @@ class DetDescendantReport(Report): if name[-1:] != '.': self.doc.write_text(".") self.doc.write_text_citation(self.endnotes(mate)) + if self.want_ids: + self.doc.write_text(' (%s)' % mate.get_gramps_id()) self.doc.end_paragraph() if not self.inc_materef: @@ -723,6 +731,8 @@ class DetDescendantReport(Report): cnt += 1 self.doc.write_text("%s. " % child_name, child_mark) + if self.want_ids: + self.doc.write_text('(%s) ' % child.get_gramps_id()) self.__narrator.set_subject(child) self.doc.write_text_citation( self.__narrator.get_born_string() or @@ -1027,6 +1037,8 @@ class DetDescendantOptions(MenuReportOptions): gen.set_help(_("The number of generations to include in the report")) add_option("gen", gen) + stdoptions.add_gramps_id_option(menu, category) + pagebbg = BooleanOption(_("Page break between generations"), False) pagebbg.set_help( _("Whether to start a new page after each generation."))