add "living people" option to the EndOfLine Report

This commit is contained in:
Paul Franklin 2016-04-24 13:49:39 -07:00
parent b1fc20f5b9
commit 585a2e046c

View File

@ -68,21 +68,24 @@ class EndOfLineReport(Report):
that come in the options class. that come in the options class.
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
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)
menu = options.menu menu = options.menu
lang = menu.get_option_by_name('trans').get_value()
rlocale = self.set_locale(lang)
stdoptions.run_private_data_option(self, menu) stdoptions.run_private_data_option(self, menu)
stdoptions.run_living_people_option(self, menu, rlocale)
pid = menu.get_option_by_name('pid').get_value() pid = menu.get_option_by_name('pid').get_value()
self.center_person = self.database.get_person_from_gramps_id(pid) self.center_person = self.database.get_person_from_gramps_id(pid)
if (self.center_person == None) : if (self.center_person == None) :
raise ReportError(_("Person %s is not in the Database") % pid ) raise ReportError(_("Person %s is not in the Database") % pid )
self.set_locale(menu.get_option_by_name('trans').get_value())
stdoptions.run_name_format_option(self, menu) stdoptions.run_name_format_option(self, menu)
# eol_map is a map whose: # eol_map is a map whose:
@ -194,15 +197,16 @@ class EndOfLineReport(Report):
if birth_ref: if birth_ref:
event = self.database.get_event_from_handle(birth_ref.ref) event = self.database.get_event_from_handle(birth_ref.ref)
birth_date = self._get_date(event.get_date_object()) birth_date = self._get_date(event.get_date_object())
death_date = "" death_date = ""
death_ref = person.get_death_ref() death_ref = person.get_death_ref()
if death_ref: if death_ref:
event = self.database.get_event_from_handle(death_ref.ref) event = self.database.get_event_from_handle(death_ref.ref)
death_date = self._get_date(event.get_date_object()) death_date = self._get_date(event.get_date_object())
dates = self._(" (%(birth_date)s - %(death_date)s)") % { dates = ''
'birth_date' : birth_date, if birth_date or death_date:
'death_date' : death_date } dates = self._(" (%(birth_date)s - %(death_date)s)") % {
'birth_date' : birth_date,
'death_date' : death_date }
self.doc.start_row() self.doc.start_row()
self.doc.start_cell('EOL-TableCell', 2) self.doc.start_cell('EOL-TableCell', 2)
@ -261,6 +265,8 @@ class EndOfLineOptions(MenuReportOptions):
stdoptions.add_private_data_option(menu, category_name) stdoptions.add_private_data_option(menu, category_name)
stdoptions.add_living_people_option(menu, category_name)
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):