add "living people" option to Database Summary report

This commit is contained in:
Paul Franklin 2016-04-20 19:11:35 -07:00
parent e2b7935ace
commit fd8c8f5948
2 changed files with 21 additions and 12 deletions

View File

@ -109,7 +109,8 @@ def run_private_data_option(report, menu):
def add_living_people_option(menu, category, def add_living_people_option(menu, category,
mode=LivingProxyDb.MODE_INCLUDE_ALL, mode=LivingProxyDb.MODE_INCLUDE_ALL,
after_death_years=0): after_death_years=0,
process_names=True):
""" """
Insert an option for deciding how the information in the Insert an option for deciding how the information in the
database for living people shall be handled by the report database for living people shall be handled by the report
@ -146,6 +147,8 @@ def add_living_people_option(menu, category,
still consider them as living. still consider them as living.
:type after_death_years: int :type after_death_years: int
:return: nothing :return: nothing
:param process_names: whether to offer name-oriented option choices
:type process_names: Boolean
""" """
def living_people_changed(): def living_people_changed():
@ -160,12 +163,13 @@ def add_living_people_option(menu, category,
living_people = EnumeratedListOption(_("Living People"), mode) living_people = EnumeratedListOption(_("Living People"), mode)
living_people.add_item(LivingProxyDb.MODE_INCLUDE_ALL, living_people.add_item(LivingProxyDb.MODE_INCLUDE_ALL,
_("Include living people and their data")) _("Include living people and their data"))
living_people.add_item(LivingProxyDb.MODE_INCLUDE_FULL_NAME_ONLY, if process_names:
_("Include full names but no data")) living_people.add_item(LivingProyDb.MODE_INCLUDE_FULL_NAME_ONLY,
living_people.add_item(LivingProxyDb.MODE_INCLUDE_LAST_NAME_ONLY, _("Include full names but no data"))
_("Replace given names and include no data")) living_people.add_item(LivingProxyDb.MODE_INCLUDE_LAST_NAME_ONLY,
living_people.add_item(LivingProxyDb.MODE_REPLACE_COMPLETE_NAME, _("Replace given names and include no data"))
_("Replace complete names and include no data")) living_people.add_item(LivingProxyDb.MODE_REPLACE_COMPLETE_NAME,
_("Replace complete names and include no data"))
living_people.add_item(LivingProxyDb.MODE_EXCLUDE_ALL, living_people.add_item(LivingProxyDb.MODE_EXCLUDE_ALL,
_("Do not include living people")) _("Do not include living people"))
living_people.set_help(_("How to handle living people")) living_people.set_help(_("How to handle living people"))

View File

@ -68,16 +68,18 @@ class SummaryReport(Report):
database - the GRAMPS database instance database - the GRAMPS database instance
options - instance of the Options class for this report options - instance of the Options class for this report
user - a gen.user.User() instance user - a gen.user.User() instance
incl_private - Whether to count private data incl_private - Whether to count private data
living_people - How to handle living people
years_past_death - Consider as living this many years after death
""" """
Report.__init__(self, database, options, user) Report.__init__(self, database, options, user)
stdoptions.run_private_data_option(self, options.menu)
self.__db = self.database
lang = options.menu.get_option_by_name('trans').get_value() lang = options.menu.get_option_by_name('trans').get_value()
self.set_locale(lang) rlocale = self.set_locale(lang)
stdoptions.run_private_data_option(self, options.menu)
stdoptions.run_living_people_option(self, options.menu, rlocale)
self.__db = self.database
def write_report(self): def write_report(self):
""" """
@ -281,6 +283,9 @@ class SummaryOptions(MenuReportOptions):
include_private_data = menu.get_option_by_name('incl_private') include_private_data = menu.get_option_by_name('incl_private')
include_private_data.set_help(_("Whether to count private data")) include_private_data.set_help(_("Whether to count private data"))
stdoptions.add_living_people_option(menu, category_name,
process_names=False)
stdoptions.add_localization_option(menu, category_name) stdoptions.add_localization_option(menu, category_name)
def make_default_style(self, default_style): def make_default_style(self, default_style):