undo revision 16673
svn: r16742
This commit is contained in:
parent
97e0b95e2d
commit
a7906886af
@ -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
|
||||
|
@ -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),
|
||||
])
|
||||
|
@ -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)
|
||||
|
@ -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""
|
||||
|
||||
|
@ -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
|
||||
|
@ -196,7 +196,7 @@ class PeopleBaseModel(object):
|
||||
def sort_name(self, data):
|
||||
n = Name()
|
||||
n.unserialize(data[COLUMN_NAME])
|
||||
return name_displayer.sorted_name(n)
|
||||
return (n.get_primary_surname().get_surname(), n.get_first_name())
|
||||
|
||||
def column_name(self, data):
|
||||
handle = data[0]
|
||||
|
@ -84,7 +84,7 @@ class Node(object):
|
||||
def __init__(self, ref, parent, sortkey, handle):
|
||||
self.name = sortkey
|
||||
if sortkey:
|
||||
self.sortkey = conv_unicode_tosrtkey_ongtk(sortkey)
|
||||
self.sortkey = map(conv_unicode_tosrtkey_ongtk, sortkey)
|
||||
else:
|
||||
self.sortkey = None
|
||||
self.ref = ref
|
||||
|
@ -131,8 +131,8 @@ class QMLPersonListModel(QtCore.QAbstractListModel):
|
||||
# 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 sort_name(self, data):
|
||||
n = Name()
|
||||
|
@ -6795,7 +6795,7 @@ def sort_people(db, handle_list):
|
||||
surname = db.get_name_group_mapping(
|
||||
primary_name.get_primary_surname().get_surname())
|
||||
|
||||
sortnames[person_handle] = _nd.sorted_name(primary_name)
|
||||
sortnames[person_handle] = _nd.sort_string(primary_name)
|
||||
sname_sub[surname].append(person_handle)
|
||||
|
||||
sorted_lists = []
|
||||
|
Loading…
Reference in New Issue
Block a user