Skip to content

Commit

Permalink
Added option to display birth and death info in descendant report
Browse files Browse the repository at this point in the history
  • Loading branch information
Utheri Wagura committed Oct 8, 2023
1 parent 892fc27 commit afc5840
Showing 1 changed file with 21 additions and 9 deletions.
30 changes: 21 additions & 9 deletions gramps/plugins/textreport/descendreport.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.

#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
Expand Down Expand Up @@ -247,6 +247,7 @@ def __init__(
numbering,
showmarriage,
showdivorce,
showlifespan,
name_display,
rlocale,
want_ids,
Expand All @@ -260,6 +261,7 @@ def __init__(
# variables
self.showmarriage = showmarriage
self.showdivorce = showdivorce
self.showlifespan = showlifespan
self.want_ids = want_ids
self._ = rlocale.translation.sgettext # needed for English
self._get_date = rlocale.get_date
Expand All @@ -286,15 +288,17 @@ def __date_place(self, event):

def dump_string(self, person, family=None):
"""generate a descriptive string for a person"""
string = self.__date_place(get_birth_or_fallback(self.database, person))
string = ""

tmp = self.__date_place(get_death_or_fallback(self.database, person))
if string and tmp:
string += self._(", ") # Arabic OK
string += tmp
if self.showlifespan:
string += self.__date_place(get_birth_or_fallback(self.database, person))
tmp = self.__date_place(get_death_or_fallback(self.database, person))
if string and tmp:
string += self._(", ") # Arabic OK
string += tmp

if string:
string = " (" + string + ")"
if string:
string = " (" + string + ")"

if family and self.showmarriage:
tmp = self.__date_place(get_marriage_or_fallback(self.database, family))
Expand Down Expand Up @@ -431,7 +435,7 @@ def recurse(self, level, person, curdepth):
#
# ------------------------------------------------------------------------
class DescendantReport(Report):
"""Descendant report"""
"""Descendant Report"""

def __init__(self, database, options, user):
"""
Expand Down Expand Up @@ -495,6 +499,7 @@ def __init__(self, database, options, user):

marrs = menu.get_option_by_name("marrs").get_value()
divs = menu.get_option_by_name("divs").get_value()
lifespan = menu.get_option_by_name("lifespan").get_value()

stdoptions.run_name_format_option(self, menu)

Expand All @@ -506,6 +511,7 @@ def __init__(self, database, options, user):
obj,
marrs,
divs,
lifespan,
self._name_display,
self._locale,
self.want_ids,
Expand Down Expand Up @@ -588,6 +594,12 @@ def add_menu_options(self, menu):
divs.set_help(_("Whether to show divorce information in the report."))
menu.add_option(category_name, "divs", divs)

lifespan = BooleanOption(_("Show birth and death info"), True)
lifespan.set_help(
_("Whether to show birth and death information in the report.")
)
menu.add_option(category_name, "lifespan", lifespan)

dups = BooleanOption(_("Show duplicate trees"), True)
dups.set_help(_("Whether to show duplicate Family Trees in the report."))
menu.add_option(category_name, "dups", dups)
Expand Down

0 comments on commit afc5840

Please sign in to comment.