convert existing reports to use the new stdoptions gramps-ID option

This commit is contained in:
Paul Franklin 2017-05-07 18:15:40 -07:00
parent 5056b8addf
commit 8d0fcc5730
5 changed files with 16 additions and 34 deletions

View File

@ -156,12 +156,7 @@ class FamilyLinesOptions(MenuReportOptions):
_("Use rounded corners to differentiate between women and men.")) _("Use rounded corners to differentiate between women and men."))
add_option("useroundedcorners", roundedcorners) add_option("useroundedcorners", roundedcorners)
include_id = EnumeratedListOption(_('Gramps ID'), 0) stdoptions.add_gramps_id_option(menu, category_name, ownline=True)
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)
# --------------------- # ---------------------
category_name = _('Report Options (2)') category_name = _('Report Options (2)')
@ -336,7 +331,7 @@ class FamilyLinesReport(Report):
user - a gen.user.User() instance user - a gen.user.User() instance
name_format - Preferred format to display names name_format - Preferred format to display names
incl_private - Whether to include private data 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 living_people - How to handle living people
years_past_death - Consider as living this many years after death 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._just_years = get_value('justyears')
self._incplaces = get_value('incplaces') self._incplaces = get_value('incplaces')
self._incchildcount = get_value('incchildcnt') self._incchildcount = get_value('incchildcnt')
self.includeid = get_value('incid') self.includeid = get_value('inc_id')
arrow_str = get_value('arrow') arrow_str = get_value('arrow')
if 'd' in arrow_str: if 'd' in arrow_str:

View File

@ -78,7 +78,7 @@ class HourGlassReport(Report):
name_format - Preferred format to display names name_format - Preferred format to display names
incl_private - Whether to include private data 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 living_people - How to handle living people
years_past_death - Consider as living this many years after death 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.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() arrow_str = menu.get_option_by_name('arrow').get_value()
if 'o' in arrow_str: if 'o' in arrow_str:
@ -345,12 +345,7 @@ class HourGlassOptions(MenuReportOptions):
_("Use rounded corners to differentiate between women and men.")) _("Use rounded corners to differentiate between women and men."))
menu.add_option(category_name, "roundcorners", roundedcorners) menu.add_option(category_name, "roundcorners", roundedcorners)
include_id = EnumeratedListOption(_('Gramps ID'), 0) stdoptions.add_gramps_id_option(menu, category_name, ownline=True)
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)
category_name = _("Report Options (2)") category_name = _("Report Options (2)")

View File

@ -103,7 +103,7 @@ class RelGraphReport(Report):
returning the list of filters. returning the list of filters.
arrow - Arrow styles for heads and tails. arrow - Arrow styles for heads and tails.
showfamily - Whether to show family nodes. showfamily - Whether to show family nodes.
incid - Whether to include IDs. inc_id - Whether to include IDs.
url - Whether to include URLs. url - Whether to include URLs.
inclimg - Include images or not inclimg - Include images or not
imgpos - Image position, above/beside name imgpos - Image position, above/beside name
@ -137,7 +137,7 @@ class RelGraphReport(Report):
self.database = CacheProxyDb(self.database) self.database = CacheProxyDb(self.database)
self._db = self.database self._db = self.database
self.includeid = get_value('incid') self.includeid = get_value('inc_id')
self.includeurl = get_value('url') self.includeurl = get_value('url')
self.includeimg = get_value('includeImages') self.includeimg = get_value('includeImages')
self.imgpos = get_value('imageOnTheSide') self.imgpos = get_value('imageOnTheSide')
@ -780,12 +780,7 @@ class RelGraphOptions(MenuReportOptions):
"between women and men.")) "between women and men."))
add_option("useroundedcorners", roundedcorners) add_option("useroundedcorners", roundedcorners)
include_id = EnumeratedListOption(_('Gramps ID'), 0) stdoptions.add_gramps_id_option(menu, category_name, ownline=True)
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)
################################ ################################
category_name = _("Report Options (2)") category_name = _("Report Options (2)")

View File

@ -101,7 +101,7 @@ class FamilyGroup(Report):
get_option_by_name = menu.get_option_by_name get_option_by_name = menu.get_option_by_name
get_value = lambda name: get_option_by_name(name).get_value() 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.recursive = get_value('recursive')
self.missing_info = get_value('missinginfo') self.missing_info = get_value('missinginfo')
self.generations = get_value('generations') self.generations = get_value('generations')
@ -774,9 +774,12 @@ class FamilyGroupOptions(MenuReportOptions):
add_option("incParNames", inc_par_names) 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 = BooleanOption(_("Family Notes"), False)
inc_fam_notes.set_help(_("Whether to include notes for families.")) inc_fam_notes.set_help(_("Whether to include notes for families."))
add_option("incFamNotes", inc_fam_notes) add_option("incFamNotes", inc_fam_notes)
@ -791,10 +794,6 @@ class FamilyGroupOptions(MenuReportOptions):
_("Whether to include marriage information for children.")) _("Whether to include marriage information for children."))
add_option("incChiMar", inc_chi_mar) 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 " self.__generations = BooleanOption(_("Generation numbers "
"(recursive only)"), False) "(recursive only)"), False)
self.__generations.set_help(_("Whether to include the generation " self.__generations.set_help(_("Whether to include the generation "

View File

@ -143,7 +143,7 @@ class IndivCompleteReport(Report):
self.use_attrs = menu.get_option_by_name('incl_attrs').get_value() 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_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_images = menu.get_option_by_name('images').get_value()
self.use_notes = menu.get_option_by_name('incl_notes').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() self.use_srcs = menu.get_option_by_name('cites').get_value()
@ -1108,9 +1108,7 @@ class IndivCompleteOptions(MenuReportOptions):
category_name = _("Include (2)") category_name = _("Include (2)")
################################ ################################
grampsid = BooleanOption(_("Gramps ID"), False) stdoptions.add_gramps_id_option(menu, category_name)
grampsid.set_help(_("Whether to include Gramps ID next to names."))
menu.add_option(category_name, "grampsid", grampsid)
tags = BooleanOption(_("Include Tags"), True) tags = BooleanOption(_("Include Tags"), True)
tags.set_help(_("Whether to include tags.")) tags.set_help(_("Whether to include tags."))