From 76961fd675837418544793c12e9a69bb76f2d0b8 Mon Sep 17 00:00:00 2001 From: SNoiraud Date: Sun, 10 Mar 2019 11:36:49 +0100 Subject: [PATCH] Webcal: Include only events after year --- gramps/plugins/webreport/webcal.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/gramps/plugins/webreport/webcal.py b/gramps/plugins/webreport/webcal.py index 3389d46d5..74d208825 100644 --- a/gramps/plugins/webreport/webcal.py +++ b/gramps/plugins/webreport/webcal.py @@ -140,6 +140,7 @@ class WebCalReport(Report): self.multiyear = mgobn('multiyear') self.start_year = mgobn('start_year') self.end_year = mgobn('end_year') + self.after_year = mgobn('after_year') if not self.multiyear: self.end_year = self.start_year if self.end_year < self.start_year: @@ -291,6 +292,9 @@ class WebCalReport(Report): the age_at_death """ + if year <= self.after_year: + return + # This may happen for certain "about" dates. # Use first day of the month if day == 0: @@ -1633,6 +1637,7 @@ class WebCalOptions(MenuReportOptions): self.__multiyear = None self.__start_year = None self.__end_year = None + self.__after_year = None def add_menu_options(self, menu): """ @@ -1641,8 +1646,8 @@ class WebCalOptions(MenuReportOptions): self.__add_report_options(menu) self.__add_report2_options(menu) self.__add_content_options(menu) - self.__add_notes_options(menu) self.__add_advanced_options(menu) + self.__add_notes_options(menu) def __add_report_options(self, menu): """ @@ -1891,6 +1896,16 @@ class WebCalOptions(MenuReportOptions): menu.add_option(category_name, 'link_to_narweb', self.__links) self.__links.connect('value-changed', self.__links_changed) + today = Today() + default_before = config.get('behavior.max-age-prob-alive') + self.__after_year = NumberOption(_('Show data only after year'), + (today.get_year() - default_before), + 0, today.get_year()) + self.__after_year.set_help(_("Don't show data before this year." + " should be before current year - " + " 100")) + menu.add_option(category_name, 'after_year', self.__after_year) + dbname = self.__db.get_dbname() default_prefix = '../../' + dbname + "_NAVWEB/" self.__prefix = StringOption(_('Link prefix'), default_prefix)