Correcting the spelling of Names

Sometimes it’s good to have firstnames unsorted: in not grouped people view and in some other cases.

To avoid these issues, I’ve created this SuperTool script to set or unset this sorting mechanism:

[Gramps SuperTool script file]

version=1

[title]
Individus - Sort_as des individus groupés

[category]
People

[initial_statements]
# The last Format entry in name preferences must be / La dernière entrée du Format des noms dans les Préférences doit être: Prénom, Patronyme[nom]
# /!\ Do not checked Commit Changes, it's implicit in the script/ Ne pas cocher Commit Changes, le commit est explicite dans le script

sort_by_fn = True # By firtsname / Par prénom -> True; By lastname / Par nom -> False 

if sort_by_fn:
    sort_order = -1
else:
    sort_order = 0

[statements]
nobjs = nameobjs
if "<<" in db.get_name_group_mapping(nobjs[0].get_group_name()):
    modifie = False
    for n in nobjs:
        if n.get_sort_as() != sort_order:
            n.set_sort_as(sort_order)
            modifie = True
    if modifie:
        db.commit_person(person, trans)

[filter]

[expressions]

[scope]
all

[unwind_lists]
False

[commit_changes]
False

[summary_only]
False

Note that I use if “<<” in … as test to find grouped people because I name them all like that. You should probably need to change this.

2 Likes