The gramps.gen.display Module

Name

Class handling language-specific displaying of names.

Specific symbols for parts of a name are defined:

Symbol Description
‘t’ title
‘f’ given (first names)
‘l’ full surname (lastname)
‘c’ callname
‘x’ nick name if existing, otherwise first first name (common name)
‘i’ initials of the first names
‘m’ primary surname (main)
‘0m’ primary surname prefix
‘1m’ primary surname surname
‘2m’ primary surname connector
‘y’ pa/matronymic surname (father/mother) - assumed unique
‘0y’ pa/matronymic prefix
‘1y’ pa/matronymic surname
‘2y’ pa/matronymic connector
‘o’ surnames without pa/matronymic and primary
‘r’ non primary surnames (rest)
‘p’ list of all prefixes
‘q’ surnames without prefixes and connectors
‘s’ suffix
‘n’ nick name
‘g’ family nick name
class gramps.gen.display.name.NameDisplay(xlocale=<gramps.gen.utils.grampslocale.GrampsLocale object at 0x2b07d2b06f10>)[source]

Bases: object

Base class for displaying of Name instances.

Property:
default_format
the default name format to use
pas_as_surn
if only one surname, see if pa/ma should be considered as ‘the’ surname.
add_name_format(name, fmt_str)[source]
change_pa_sur(*args)[source]

How to handle single patronymic as surname is changed

cmp_to_key(mycmp)[source]

python 2 to 3 conversion, python recipe http://code.activestate.com/recipes/576653/ Convert a cmp() function into a key() function We use this in Gramps as understanding the old compare function is not trivial. This should be replaced by a proper key function

del_name_format(num)[source]
display(person)[source]

Return a text string representing the Person instance’s Name in a manner that should be used for normal displaying.

Parameters:person (Person) – Person instance that contains the Name that is to be displayed. The primary name is used for the display.
Returns:Returns the Person instance’s name
Return type:str
display_formal(person)[source]

Return a text string representing the Person instance’s Name in a manner that should be used for formal displaying.

Parameters:person (Person) – Person instance that contains the Name that is to be displayed. The primary name is used for the display.
Returns:Returns the Person instance’s name
Return type:str
display_given(person)[source]
display_name(name)[source]

Return a text string representing the Name instance in a manner that should be used for normal displaying.

Parameters:name (Name) – Name instance that is to be displayed.
Returns:Returns the Name string representation
Return type:str
edit_name_format(num, name, fmt_str)[source]
format_funcs = {}
format_str(name, format_str)[source]
format_str_raw(raw_data, format_str)[source]

Format a name from the raw name list. To make this as fast as possible this uses _gen_raw_func() to generate a new method for each new format_string.

Is does not call _format_str_base() because it would introduce an extra method call and we need all the speed we can squeeze out of this.

get_default_format()[source]
get_name_format(also_default=False, only_custom=False, only_active=True)[source]

Get a list of tuples (num, name,fmt_str,act)

get_pat_as_surn()[source]
name_grouping(db, person)[source]

Return the name under which to group this person. This is defined as:

  1. if group name is defined on primary name, use that
  2. if group name is defined for the primary surname of the primary name, use that
  3. use primary surname of primary name otherwise
name_grouping_data(db, pn)[source]

Return the name under which to group. This is defined as:

  1. if group name is defined, use that
  2. if group name is defined for the primary surname, use that
  3. use primary surname itself otherwise
Parameters:pn (tuple) – raw unserialized data of name
Returns:Returns the groupname string representation
Return type:str
name_grouping_name(db, pn)[source]

Return the name under which to group. This is defined as:

  1. if group name is defined, use that
  2. if group name is defined for the primary surname, use that
  3. use primary surname itself otherwise
Parameters:pn (Name instance) – Name object
Returns:Returns the groupname string representation
Return type:str
primary_surname(name)[source]
raw_display_name(raw_data)[source]

Return a text string representing the Name instance in a manner that should be used for normal displaying.

Parameters:name (tuple) – raw unserialized data of name that is to be displayed.
Returns:Returns the Name string representation
Return type:str
raw_format_funcs = {}
raw_sorted_name(raw_data)[source]

Return a text string representing the Name instance in a manner that should be used for sorting the name in a list.

Parameters:name (tuple) – raw unserialized data of name that is to be displayed.
Returns:Returns the Name string representation
Return type:str
set_default_format(num)[source]
set_format_inactive(num)[source]
set_name_format(formats)[source]
sort_string(name)[source]
sorted(person)[source]

Return a text string representing the Person instance’s Name in a manner that should be used for displaying a sortedname.

Parameters:person (Person) – Person instance that contains the Name that is to be displayed. The primary name is used for the display.
Returns:Returns the Person instance’s name
Return type:str
sorted_name(name)[source]

Return a text string representing the Name instance in a manner that should be used for sorting the name in a list.

Parameters:name (Name) – Name instance that is to be displayed.
Returns:Returns the Name string representation
Return type:str
truncate(full_name, max_length=15, elipsis='...')[source]
exception gramps.gen.display.name.NameDisplayError(value)[source]

Bases: exceptions.Exception

Error used to report that the name display format string is invalid.

gramps.gen.display.name.cleanup_name(namestring)[source]

Remove too long white space due to missing name parts, so “a b” becomes “a b” and “a , b” becomes “a, b”

Table Of Contents

Previous topic

The gramps.gen.db Module

Next topic

The gramps.gen.plug Module

This Page