From 8d0fcc57301e2d27c3a72a90979aac5857376448 Mon Sep 17 00:00:00 2001 From: Paul Franklin Date: Sun, 7 May 2017 18:15:40 -0700 Subject: [PATCH] convert existing reports to use the new stdoptions gramps-ID option --- gramps/plugins/graph/gvfamilylines.py | 11 +++-------- gramps/plugins/graph/gvhourglass.py | 11 +++-------- gramps/plugins/graph/gvrelgraph.py | 11 +++-------- gramps/plugins/textreport/familygroup.py | 11 +++++------ gramps/plugins/textreport/indivcomplete.py | 6 ++---- 5 files changed, 16 insertions(+), 34 deletions(-) diff --git a/gramps/plugins/graph/gvfamilylines.py b/gramps/plugins/graph/gvfamilylines.py index 035cf1879..4740b2e90 100644 --- a/gramps/plugins/graph/gvfamilylines.py +++ b/gramps/plugins/graph/gvfamilylines.py @@ -156,12 +156,7 @@ class FamilyLinesOptions(MenuReportOptions): _("Use rounded corners to differentiate between women and men.")) add_option("useroundedcorners", roundedcorners) - include_id = EnumeratedListOption(_('Gramps ID'), 0) - include_id.add_item(0, _('Do not include')) - include_id.add_item(1, _('Share an existing line')) - include_id.add_item(2, _('On a line of its own')) - include_id.set_help(_("Whether (and where) to include Gramps IDs")) - add_option("incid", include_id) + stdoptions.add_gramps_id_option(menu, category_name, ownline=True) # --------------------- category_name = _('Report Options (2)') @@ -336,7 +331,7 @@ class FamilyLinesReport(Report): user - a gen.user.User() instance name_format - Preferred format to display names incl_private - Whether to include private data - incid - Whether to include IDs. + inc_id - Whether to include IDs. living_people - How to handle living people years_past_death - Consider as living this many years after death """ @@ -383,7 +378,7 @@ class FamilyLinesReport(Report): self._just_years = get_value('justyears') self._incplaces = get_value('incplaces') self._incchildcount = get_value('incchildcnt') - self.includeid = get_value('incid') + self.includeid = get_value('inc_id') arrow_str = get_value('arrow') if 'd' in arrow_str: diff --git a/gramps/plugins/graph/gvhourglass.py b/gramps/plugins/graph/gvhourglass.py index 4e70392df..e5350489d 100644 --- a/gramps/plugins/graph/gvhourglass.py +++ b/gramps/plugins/graph/gvhourglass.py @@ -78,7 +78,7 @@ class HourGlassReport(Report): name_format - Preferred format to display names incl_private - Whether to include private data - incid - Whether to include IDs. + inc_id - Whether to include IDs. living_people - How to handle living people years_past_death - Consider as living this many years after death """ @@ -113,7 +113,7 @@ class HourGlassReport(Report): } self.roundcorners = menu.get_option_by_name('roundcorners').get_value() - self.includeid = menu.get_option_by_name('incid').get_value() + self.includeid = menu.get_option_by_name('inc_id').get_value() arrow_str = menu.get_option_by_name('arrow').get_value() if 'o' in arrow_str: @@ -345,12 +345,7 @@ class HourGlassOptions(MenuReportOptions): _("Use rounded corners to differentiate between women and men.")) menu.add_option(category_name, "roundcorners", roundedcorners) - include_id = EnumeratedListOption(_('Gramps ID'), 0) - include_id.add_item(0, _('Do not include')) - include_id.add_item(1, _('Share an existing line')) - include_id.add_item(2, _('On a line of its own')) - include_id.set_help(_("Whether (and where) to include Gramps IDs")) - menu.add_option(category_name, "incid", include_id) + stdoptions.add_gramps_id_option(menu, category_name, ownline=True) category_name = _("Report Options (2)") diff --git a/gramps/plugins/graph/gvrelgraph.py b/gramps/plugins/graph/gvrelgraph.py index 757e71284..2f2d64b0d 100644 --- a/gramps/plugins/graph/gvrelgraph.py +++ b/gramps/plugins/graph/gvrelgraph.py @@ -103,7 +103,7 @@ class RelGraphReport(Report): returning the list of filters. arrow - Arrow styles for heads and tails. showfamily - Whether to show family nodes. - incid - Whether to include IDs. + inc_id - Whether to include IDs. url - Whether to include URLs. inclimg - Include images or not imgpos - Image position, above/beside name @@ -137,7 +137,7 @@ class RelGraphReport(Report): self.database = CacheProxyDb(self.database) self._db = self.database - self.includeid = get_value('incid') + self.includeid = get_value('inc_id') self.includeurl = get_value('url') self.includeimg = get_value('includeImages') self.imgpos = get_value('imageOnTheSide') @@ -780,12 +780,7 @@ class RelGraphOptions(MenuReportOptions): "between women and men.")) add_option("useroundedcorners", roundedcorners) - include_id = EnumeratedListOption(_('Gramps ID'), 0) - include_id.add_item(0, _('Do not include')) - include_id.add_item(1, _('Share an existing line')) - include_id.add_item(2, _('On a line of its own')) - include_id.set_help(_("Whether (and where) to include Gramps IDs")) - add_option("incid", include_id) + stdoptions.add_gramps_id_option(menu, category_name, ownline=True) ################################ category_name = _("Report Options (2)") diff --git a/gramps/plugins/textreport/familygroup.py b/gramps/plugins/textreport/familygroup.py index bc5237742..50b7b3b1e 100644 --- a/gramps/plugins/textreport/familygroup.py +++ b/gramps/plugins/textreport/familygroup.py @@ -101,7 +101,7 @@ class FamilyGroup(Report): get_option_by_name = menu.get_option_by_name get_value = lambda name: get_option_by_name(name).get_value() - self.gramps_ids = get_value('gramps_ids') + self.gramps_ids = get_value('inc_id') self.recursive = get_value('recursive') self.missing_info = get_value('missinginfo') self.generations = get_value('generations') @@ -774,9 +774,12 @@ class FamilyGroupOptions(MenuReportOptions): add_option("incParNames", inc_par_names) ########################## - add_option = partial(menu.add_option, _("Include (2)")) + category_name = _("Include (2)") + add_option = partial(menu.add_option, category_name) ########################## + stdoptions.add_gramps_id_option(menu, category_name) + inc_fam_notes = BooleanOption(_("Family Notes"), False) inc_fam_notes.set_help(_("Whether to include notes for families.")) add_option("incFamNotes", inc_fam_notes) @@ -791,10 +794,6 @@ class FamilyGroupOptions(MenuReportOptions): _("Whether to include marriage information for children.")) add_option("incChiMar", inc_chi_mar) - gramps_ids = BooleanOption(_('Gramps ID'), False) - gramps_ids.set_help(_("Whether to include Gramps ID next to names.")) - add_option("gramps_ids", gramps_ids) - self.__generations = BooleanOption(_("Generation numbers " "(recursive only)"), False) self.__generations.set_help(_("Whether to include the generation " diff --git a/gramps/plugins/textreport/indivcomplete.py b/gramps/plugins/textreport/indivcomplete.py index 2ea91b761..603cf6edf 100644 --- a/gramps/plugins/textreport/indivcomplete.py +++ b/gramps/plugins/textreport/indivcomplete.py @@ -143,7 +143,7 @@ class IndivCompleteReport(Report): self.use_attrs = menu.get_option_by_name('incl_attrs').get_value() self.use_census = menu.get_option_by_name('incl_census').get_value() - self.use_gramps_id = menu.get_option_by_name('grampsid').get_value() + self.use_gramps_id = menu.get_option_by_name('inc_id').get_value() self.use_images = menu.get_option_by_name('images').get_value() self.use_notes = menu.get_option_by_name('incl_notes').get_value() self.use_srcs = menu.get_option_by_name('cites').get_value() @@ -1108,9 +1108,7 @@ class IndivCompleteOptions(MenuReportOptions): category_name = _("Include (2)") ################################ - grampsid = BooleanOption(_("Gramps ID"), False) - grampsid.set_help(_("Whether to include Gramps ID next to names.")) - menu.add_option(category_name, "grampsid", grampsid) + stdoptions.add_gramps_id_option(menu, category_name) tags = BooleanOption(_("Include Tags"), True) tags.set_help(_("Whether to include tags."))