* data/gramps.schemas.in: Remove unused key.
* src/Config/_GrampsConfigKeys.py: Regenerate file. * src/NameDisplay.py (NameDisplay._format_str_base): Document the format string interface. svn: r7003
This commit is contained in:
parent
712d0828e2
commit
30b8f1bce2
@ -1,3 +1,9 @@
|
||||
2006-07-06 Alex Roitman <shura@phy.ucsf.edu>
|
||||
* data/gramps.schemas.in: Remove unused key.
|
||||
* src/Config/_GrampsConfigKeys.py: Regenerate file.
|
||||
* src/NameDisplay.py (NameDisplay._format_str_base): Document the
|
||||
format string interface.
|
||||
|
||||
2006-07-06 Don Allingham <don@gramps-project.org>
|
||||
* src/GrampsCfg.py: add cell renderer to combobox
|
||||
* help/C/gramps-manual.xml: update doc
|
||||
|
@ -405,33 +405,18 @@
|
||||
<applyto>/apps/gramps/preferences/name-format</applyto>
|
||||
<owner>gramps</owner>
|
||||
<type>int</type>
|
||||
<default>0</default>
|
||||
<default>1</default>
|
||||
<locale name="C">
|
||||
<short>Name display format</short>
|
||||
<long>This key determines the name display format. Use
|
||||
0 for "Surname, Firstname",
|
||||
1 for "Firstname Surname",
|
||||
2 for "Patronymic Firstname", and
|
||||
3 for "Firstname" style.
|
||||
For custom styles, use -1 and set the name-format-str key.</long>
|
||||
</locale>
|
||||
</schema>
|
||||
|
||||
<schema>
|
||||
<key>/schemas/apps/gramps/preferences/name-format-str</key>
|
||||
<applyto>/apps/gramps/preferences/name-format-str</applyto>
|
||||
<owner>gramps</owner>
|
||||
<type>string</type>
|
||||
<default></default>
|
||||
<locale name="C">
|
||||
<short>Name display format string</short>
|
||||
<long>This key determines the custom name display format.
|
||||
Its value is unimportant unless the name-format keyis set to -1.
|
||||
When used, the following substitutions are made:
|
||||
%t -> title, %f -> given name, %p -> prefix, %s -> suffix,
|
||||
%l -> family name, %y -> patronymic, %c -> call name.
|
||||
The capital letters are substituted for capitalized name components.
|
||||
The %% is substituted with the single % character.</long>
|
||||
1 for "Surname, Firstname",
|
||||
2 for "Firstname Surname",
|
||||
3 for "Patronymic Firstname", and
|
||||
4 for "Firstname" style.
|
||||
For custom styles, use negative integers, whose meaning
|
||||
is database-specific. Zero is reserved for internal purposes
|
||||
and should not be used. If used, it will be changed to 1
|
||||
by GRAMPS.</long>
|
||||
</locale>
|
||||
</schema>
|
||||
|
||||
|
@ -53,7 +53,6 @@ RECENT_FILE = ('paths','recent-file', 2)
|
||||
RECENT_IMPORT_DIR = ('paths','recent-import-dir', 2)
|
||||
RECENT_EXPORT_DIR = ('paths','recent-export-dir', 2)
|
||||
NAME_FORMAT = ('preferences','name-format', 1)
|
||||
NAME_FORMAT_STR = ('preferences','name-format-str', 2)
|
||||
REPORT_DIRECTORY = ('paths','report-directory', 2)
|
||||
RESEARCHER_ADDR = ('researcher','researcher-addr', 2)
|
||||
RESEARCHER_CITY = ('researcher','researcher-city', 2)
|
||||
@ -110,7 +109,6 @@ default_value = {
|
||||
RECENT_IMPORT_DIR : '',
|
||||
RECENT_EXPORT_DIR : '',
|
||||
NAME_FORMAT : 0,
|
||||
NAME_FORMAT_STR : '',
|
||||
REPORT_DIRECTORY : './',
|
||||
RESEARCHER_ADDR : '',
|
||||
RESEARCHER_CITY : '',
|
||||
|
@ -283,7 +283,20 @@ class NameDisplay:
|
||||
def _format_str_base(self,first,surname,prefix,suffix,patronymic,
|
||||
title,call,format_str):
|
||||
"""
|
||||
Generates name from a format string, e.g. '%T. %p %F %L (%p)' .
|
||||
Generates name from a format string.
|
||||
|
||||
The following substitutions are made:
|
||||
%t -> title
|
||||
%f -> given name (first name)
|
||||
%p -> prefix
|
||||
%s -> suffix
|
||||
%l -> family name (last name, surname)
|
||||
%y -> patronymic
|
||||
%c -> call name
|
||||
The capital letters are substituted for capitalized name components.
|
||||
The %% is substituted with the single % character.
|
||||
All the other characters in the fmt_str are unaffected.
|
||||
|
||||
"""
|
||||
|
||||
output = format_str
|
||||
@ -295,6 +308,7 @@ class NameDisplay:
|
||||
output = output.replace("%s",suffix)
|
||||
output = output.replace("%y",patronymic)
|
||||
output = output.replace("%c",call)
|
||||
|
||||
output = output.replace("%T",title.upper())
|
||||
output = output.replace("%F",first.upper())
|
||||
output = output.replace("%P",prefix.upper())
|
||||
|
Loading…
Reference in New Issue
Block a user