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, call, or 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>)[source]¶ Bases:
objectBase 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.
-
cmp_to_key(mycmp)[source]¶ python 2 to 3 conversion, python recipe http://code.activestate.com/recipes/576653/ Convert a
cmp()function into akey()function We use this in Gramps as understanding the old compare function is not trivial. This should be replaced by a proper key function
-
display(person)[source]¶ Return a text string representing the
Personinstance’sNamein a manner that should be used for normal displaying.Parameters: person ( Person) –Personinstance that contains theNamethat is to be displayed. The primary name is used for the display.Returns: Returns the Personinstance’s nameReturn type: str
-
display_formal(person)[source]¶ Return a text string representing the
Personinstance’sNamein a manner that should be used for formal displaying.Parameters: person ( Person) –Personinstance that contains theNamethat is to be displayed. The primary name is used for the display.Returns: Returns the Personinstance’s nameReturn type: str
-
display_format(person, num)[source]¶ Return a text string representing the L{gen.lib.Person} instance’s L{Name} using num format.
@param person: L{gen.lib.Person} instance that contains the L{Name} that is to be displayed. The primary name is used for the display. @type person: L{gen.lib.Person} @param num: num of the format to be used, as return by name_displayer.add_name_format(‘name’,’format’) @type num: int @returns: Returns the L{gen.lib.Person} instance’s name @rtype: str
-
display_name(name)[source]¶ Return a text string representing the
Nameinstance in a manner that should be used for normal displaying.Parameters: name ( Name) –Nameinstance that is to be displayed.Returns: Returns the Namestring representationReturn type: str
-
format_funcs= {}¶
-
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_name_format(also_default=False, only_custom=False, only_active=True)[source]¶ Get a list of tuples (num, name,fmt_str,act)
-
name_grouping(db, person)[source]¶ Return the name under which to group this person. This is defined as:
- if group name is defined on primary name, use that
- if group name is defined for the primary surname of the primary name, use that
- use primary surname of primary name otherwise
-
name_grouping_data(db, pn)[source]¶ Return the name under which to group. This is defined as:
- if group name is defined, use that
- if group name is defined for the primary surname, use that
- 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:
- if group name is defined, use that
- if group name is defined for the primary surname, use that
- use primary surname itself otherwise
Parameters: pn ( Nameinstance) –NameobjectReturns: Returns the groupname string representation Return type: str
-
raw_display_name(raw_data)[source]¶ Return a text string representing the
Nameinstance 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 Namestring representationReturn type: str
-
raw_format_funcs= {}¶
-
raw_sorted_name(raw_data)[source]¶ Return a text string representing the
Nameinstance 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 Namestring representationReturn type: str
-
sorted(person)[source]¶ Return a text string representing the
Personinstance’sNamein a manner that should be used for displaying a sortedname.Parameters: person ( Person) –Personinstance that contains theNamethat is to be displayed. The primary name is used for the display.Returns: Returns the Personinstance’s nameReturn type: str