Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add gender symbol option to the detailed ancestral report #1818

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions gramps/plugins/textreport/detancestralreport.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# Copyright (C) 2013-2014 Paul Franklin
# Copyright (C) 2014 Gerald Kunzmann <[email protected]>
# Copyright (C) 2017 Robert Carnell <bertcarnell_at_gmail.com>
# Copyright (C) 2024-2025 Dave Khuon
#
# 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
Expand Down Expand Up @@ -70,6 +71,7 @@
from gramps.gen.proxy import CacheProxyDb
from gramps.gen.display.name import displayer as _nd


# ------------------------------------------------------------------------
#
# Constants
Expand Down Expand Up @@ -105,6 +107,7 @@ def __init__(self, database, options, user):
pageben - Whether to include page break before End Notes.
firstName - Whether to use first names instead of pronouns.
fulldate - Whether to use full dates instead of just year.
showgender - Whether to include prepend person name with gender.
listchildren - Whether to list children.
list_children_spouses - Whether to list the spouses of the children
includenotes - Whether to include notes.
Expand Down Expand Up @@ -147,6 +150,7 @@ def __init__(self, database, options, user):
self.pgbrkenotes = get_value("pageben")
self.fulldate = get_value("fulldates")
use_fulldate = self.fulldate
self.showgender = get_value("showgender")
self.listchildren = get_value("listc")
self.list_children_spouses = get_value("listc_spouses")
self.includenotes = get_value("incnotes")
Expand Down Expand Up @@ -318,6 +322,8 @@ def write_more_header(first, name):
mark = utils.get_person_mark(self._db, person)

self.doc.start_bold()
if self.showgender:
self.doc.write_text(utils.get_gender_symbol(person) + " ")
self.doc.write_text(name, mark)
if name[-1:] == ".":
self.doc.write_text_citation("%s " % self.endnotes(person))
Expand Down Expand Up @@ -642,6 +648,8 @@ def write_children(self, family):
child_name = self._nd.display(child)
if not child_name:
child_name = self._("Unknown")
if self.showgender:
child_name = utils.get_gender_symbol(child) + " " + child_name
child_mark = utils.get_person_mark(self._db, child)

if self.childref and self.prev_gen_handles.get(child_handle):
Expand Down Expand Up @@ -770,6 +778,8 @@ def write_mate(self, person):
name = self._("Unknown")
mark = utils.get_person_mark(self._db, ind)

if self.showgender:
name = utils.get_gender_symbol(ind) + " " + name
if family.get_relationship() == FamilyRelType.MARRIED:
self.doc.write_text(self._("Spouse: %s") % name, mark)
else:
Expand Down Expand Up @@ -918,6 +928,10 @@ def add_menu_options(self, menu):

addopt = partial(menu.add_option, _("Include"))

showgender = BooleanOption(_("Show gender symbol in front of name"), True)
showgender.set_help(_("Whether to show gender symbol in front of name."))
addopt("showgender", showgender)

listc = BooleanOption(_("Include children"), True)
listc.set_help(_("Whether to list children."))
addopt("listc", listc)
Expand Down
Loading