undo revision 16673

svn: r16742
This commit is contained in:
Michiel Nauta 2011-03-02 11:31:57 +00:00
parent 97e0b95e2d
commit a7906886af
9 changed files with 18 additions and 13 deletions

View File

@ -673,6 +673,10 @@ def fn(%s):
#-------------------------------------------------------------------------
def sort_string(self, name):
return u"%-25s%-30s%s" % (name.get_primary_surname().get_surname(),
name.first_name, name.suffix)
def sorted(self, person):
"""
Return a text string representing the L{gen.lib.Person} instance's

View File

@ -69,7 +69,7 @@ class ChildModel(gtk.ListStore):
self.column_birth_place(child),
self.column_death_place(child),
child.get_handle(),
name_displayer.sorted_name(child.primary_name),
name_displayer.sort_string(child.primary_name),
self.column_birth_sort(child),
self.column_death_sort(child),
])

View File

@ -936,7 +936,7 @@ class ShowResults(ManagedWindow.ManagedWindow):
def sort_val_from_handle(self, handle):
if self.namespace == 'Person':
name = self.db.get_person_from_handle(handle).get_primary_name()
sortname = _nd.sorted_name(name)
sortname = _nd.sort_string(name)
elif self.namespace == 'Family':
sortname = Utils.family_name(
self.db.get_family_from_handle(handle),self.db)

View File

@ -124,7 +124,7 @@ class FamilyModel(FlatBaseModel):
def sort_father(self, data):
if data[2]:
person = self.db.get_person_from_handle(data[2])
return name_displayer.sorted_name(person.primary_name)
return name_displayer.sort_string(person.primary_name)
else:
return u""
@ -138,7 +138,7 @@ class FamilyModel(FlatBaseModel):
def sort_mother(self, data):
if data[3]:
person = self.db.get_person_from_handle(data[3])
return name_displayer.sorted_name(person.primary_name)
return name_displayer.sort_string(person.primary_name)
else:
return u""

View File

@ -512,8 +512,8 @@ class FlatBaseModel(gtk.GenericTreeModel):
# use cursor as a context manager
with self.gen_cursor() as cursor:
#loop over database and store the sort field, and the handle
return sorted((conv_unicode_tosrtkey_ongtk(self.sort_func(data)),
key) for key, data in cursor)
return sorted((map(conv_unicode_tosrtkey_ongtk,
self.sort_func(data)), key) for key, data in cursor)
def _rebuild_search(self, ignore=None):
""" function called when view must be build, given a search text
@ -580,7 +580,8 @@ class FlatBaseModel(gtk.GenericTreeModel):
Row is only added if search/filter data is such that it must be shown
"""
data = self.map(handle)
insert_val = (conv_unicode_tosrtkey_ongtk(self.sort_func(data)), handle)
insert_val = (map(conv_unicode_tosrtkey_ongtk, self.sort_func(data)),
handle)
if not self.search or \
(self.search and self.search.match(handle, self.db)):
#row needs to be added to the model
@ -614,7 +615,7 @@ class FlatBaseModel(gtk.GenericTreeModel):
return # row is not currently displayed
self.clear_cache(handle)
oldsortkey = self.node_map.get_sortkey(handle)
newsortkey = conv_unicode_tosrtkey_ongtk(self.sort_func(self.map(
newsortkey = map(conv_unicode_tosrtkey_ongtk, self.sort_func(self.map(
handle)))
if oldsortkey is None or oldsortkey != newsortkey:
#or the changed object is not present in the view due to filtering