2007-01-16 Alex Roitman <shura@gramps-project.org>
* src/NameDisplay.py (set_name_format): Use hard-coded methods for the pre-set name displays formats. svn: r7922
This commit is contained in:
parent
17f22fc0c7
commit
86ba5b60b6
@ -1,3 +1,7 @@
|
||||
2007-01-16 Alex Roitman <shura@gramps-project.org>
|
||||
* src/NameDisplay.py (set_name_format): Use hard-coded methods for
|
||||
the pre-set name displays formats.
|
||||
|
||||
2007-01-16 Don Allingham <don@gramps-project.org>
|
||||
* src/GrampsDb/_ReadGedcom.py: handle missing place in LDS ord
|
||||
* src/DataViews/_PersonView.py: optimization
|
||||
|
@ -108,11 +108,47 @@ class NameDisplay:
|
||||
def _format_raw_fn(self,fmt_str):
|
||||
return lambda x: self.format_str_raw(x,fmt_str)
|
||||
|
||||
def _raw_lnfn(self,raw_data):
|
||||
result = "%s %s, %s %s %s" % (raw_data[_PREFIX],
|
||||
raw_data[_SURNAME],
|
||||
raw_data[_FIRSTNAME],
|
||||
raw_data[_PATRONYM],
|
||||
raw_data[_SUFFIX])
|
||||
return ' '.join([ x for x in result.split(" ") if x != ''])
|
||||
|
||||
def _raw_fnln(self,raw_data):
|
||||
result = "%s %s %s %s %s" % (raw_data[_FIRSTNAME],
|
||||
raw_data[_PATRONYM],
|
||||
raw_data[_PREFIX],
|
||||
raw_data[_SURNAME],
|
||||
raw_data[_SUFFIX])
|
||||
return ' '.join([ x for x in result.split(" ") if x != ''])
|
||||
|
||||
def _raw_ptfn(self,raw_data):
|
||||
result = "%s %s, %s %s" % (raw_data[_PREFIX],
|
||||
raw_data[_PATRONYM],
|
||||
raw_data[_SUFFIX],
|
||||
raw_data[_FIRSTNAME])
|
||||
return ' '.join([ x for x in result.split(" ") if x != ''])
|
||||
|
||||
def _raw_fn(self,raw_data):
|
||||
result = raw_data[_FIRSTNAME]
|
||||
return ' '.join([ x for x in result.split(" ") if x != ''])
|
||||
|
||||
def set_name_format(self,formats):
|
||||
raw_func_dict = {
|
||||
Name.LNFN : self._raw_lnfn,
|
||||
Name.FNLN : self._raw_fnln,
|
||||
Name.PTFN : self._raw_ptfn,
|
||||
Name.FN : self._raw_fn,
|
||||
}
|
||||
|
||||
for (num,name,fmt_str,act) in formats:
|
||||
self.name_formats[num] = (name,fmt_str,act,
|
||||
self._format_fn(fmt_str),
|
||||
self._format_raw_fn(fmt_str))
|
||||
func = self._format_fn(fmt_str)
|
||||
func_raw = raw_func_dict.get(num)
|
||||
if func_raw == None:
|
||||
func_raw = self._format_raw_fn(fmt_str)
|
||||
self.name_formats[num] = (name,fmt_str,act,func,func_raw)
|
||||
|
||||
def add_name_format(self,name,fmt_str):
|
||||
num = -1
|
||||
|
Loading…
x
Reference in New Issue
Block a user