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 a name parameter to the get_person_mark utility #1636

Draft
wants to merge 1 commit into
base: maintenance/gramps52
Choose a base branch
from
Draft
Show file tree
Hide file tree
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
Add a name parameter to the get_person_mark utility
This allows an alphabetical index entry for a person to use the
selected name format.  Previously a "Surname, Given Suffix"
format was always used.

Fixes #13155.
  • Loading branch information
Nick-Hall committed Jan 26, 2024
commit 99041bce04fbe50315018b45df1d70439aa31c9a
5 changes: 3 additions & 2 deletions gramps/gen/plug/report/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ def find_marriage(database, family):
# Indexing function
#
# -------------------------------------------------------------------------
def get_person_mark(dbase, person):
def get_person_mark(dbase, person, name=None):
"""
Return a IndexMark that can be used to index a person in a report

Expand All @@ -228,7 +228,8 @@ def get_person_mark(dbase, person):
if not person:
return None

name = person.get_primary_name().get_name()
if name is None:
name = person.get_primary_name().get_name()
birth = " "
death = " "
key = ""
Expand Down
11 changes: 6 additions & 5 deletions gramps/plugins/textreport/detancestralreport.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ def write_more_header(first, name):
name = self._nd.display(person)
if not name:
name = self._("Unknown")
mark = utils.get_person_mark(self._db, person)
mark = utils.get_person_mark(self._db, person, name)

self.doc.start_bold()
self.doc.write_text(name, mark)
Expand Down Expand Up @@ -559,14 +559,14 @@ def write_parents(self, person):
if mother_handle:
mother = self._db.get_person_from_handle(mother_handle)
mother_name = self._nd.display_name(mother.get_primary_name())
mother_mark = utils.get_person_mark(self._db, mother)
mother_mark = utils.get_person_mark(self._db, mother, mother_name)
else:
mother_name = ""
mother_mark = ""
if father_handle:
father = self._db.get_person_from_handle(father_handle)
father_name = self._nd.display_name(father.get_primary_name())
father_mark = utils.get_person_mark(self._db, father)
father_mark = utils.get_person_mark(self._db, father, father_name)
else:
father_name = ""
father_mark = ""
Expand All @@ -589,7 +589,8 @@ def write_marriage(self, person):
spouse_handle = utils.find_spouse(person, family)
if spouse_handle:
spouse = self._db.get_person_from_handle(spouse_handle)
spouse_mark = utils.get_person_mark(self._db, spouse)
spouse_name = self._nd.display_name(spouse.get_primary_name())
spouse_mark = utils.get_person_mark(self._db, spouse, spouse_name)
else:
spouse_mark = None

Expand Down Expand Up @@ -642,7 +643,7 @@ def write_children(self, family):
child_name = self._nd.display(child)
if not child_name:
child_name = self._("Unknown")
child_mark = utils.get_person_mark(self._db, child)
child_mark = utils.get_person_mark(self._db, child, child_name)

if self.childref and self.prev_gen_handles.get(child_handle):
value = int(self.prev_gen_handles.get(child_handle))
Expand Down
Loading