From fd8c8f59488ee78aa1bf2d3930375fc311314ef6 Mon Sep 17 00:00:00 2001 From: Paul Franklin Date: Wed, 20 Apr 2016 19:11:35 -0700 Subject: [PATCH] add "living people" option to Database Summary report --- gramps/gen/plug/report/stdoptions.py | 18 +++++++++++------- gramps/plugins/textreport/summary.py | 15 ++++++++++----- 2 files changed, 21 insertions(+), 12 deletions(-) diff --git a/gramps/gen/plug/report/stdoptions.py b/gramps/gen/plug/report/stdoptions.py index 8661959c6..9939f09e7 100644 --- a/gramps/gen/plug/report/stdoptions.py +++ b/gramps/gen/plug/report/stdoptions.py @@ -109,7 +109,8 @@ def run_private_data_option(report, menu): def add_living_people_option(menu, category, 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 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. :type after_death_years: int :return: nothing + :param process_names: whether to offer name-oriented option choices + :type process_names: Boolean """ def living_people_changed(): @@ -160,12 +163,13 @@ def add_living_people_option(menu, category, living_people = EnumeratedListOption(_("Living People"), mode) living_people.add_item(LivingProxyDb.MODE_INCLUDE_ALL, _("Include living people and their data")) - living_people.add_item(LivingProxyDb.MODE_INCLUDE_FULL_NAME_ONLY, - _("Include full names but no data")) - living_people.add_item(LivingProxyDb.MODE_INCLUDE_LAST_NAME_ONLY, - _("Replace given names and include no data")) - living_people.add_item(LivingProxyDb.MODE_REPLACE_COMPLETE_NAME, - _("Replace complete names and include no data")) + if process_names: + living_people.add_item(LivingProyDb.MODE_INCLUDE_FULL_NAME_ONLY, + _("Include full names but no data")) + living_people.add_item(LivingProxyDb.MODE_INCLUDE_LAST_NAME_ONLY, + _("Replace given 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, _("Do not include living people")) living_people.set_help(_("How to handle living people")) diff --git a/gramps/plugins/textreport/summary.py b/gramps/plugins/textreport/summary.py index d9fd74a57..34b9ac8d8 100644 --- a/gramps/plugins/textreport/summary.py +++ b/gramps/plugins/textreport/summary.py @@ -68,16 +68,18 @@ class SummaryReport(Report): database - the GRAMPS database instance options - instance of the Options class for this report user - a gen.user.User() instance - 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) - stdoptions.run_private_data_option(self, options.menu) - self.__db = self.database - 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): """ @@ -281,6 +283,9 @@ class SummaryOptions(MenuReportOptions): include_private_data = menu.get_option_by_name('incl_private') 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) def make_default_style(self, default_style):