From a7906886afd73d2a6fa76e806bfc38893e32e750 Mon Sep 17 00:00:00 2001 From: Michiel Nauta Date: Wed, 2 Mar 2011 11:31:57 +0000 Subject: [PATCH] undo revision 16673 svn: r16742 --- src/gen/display/name.py | 4 ++++ src/gui/editors/displaytabs/childmodel.py | 2 +- src/gui/filtereditor.py | 2 +- src/gui/views/treemodels/familymodel.py | 4 ++-- src/gui/views/treemodels/flatbasemodel.py | 9 +++++---- src/gui/views/treemodels/peoplemodel.py | 2 +- src/gui/views/treemodels/treebasemodel.py | 2 +- src/guiQML/views/personview.py | 4 ++-- src/plugins/webreport/NarrativeWeb.py | 2 +- 9 files changed, 18 insertions(+), 13 deletions(-) diff --git a/src/gen/display/name.py b/src/gen/display/name.py index 950c42cbf..a17253c15 100644 --- a/src/gen/display/name.py +++ b/src/gen/display/name.py @@ -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 diff --git a/src/gui/editors/displaytabs/childmodel.py b/src/gui/editors/displaytabs/childmodel.py index a8299b4c4..d20ec7a55 100644 --- a/src/gui/editors/displaytabs/childmodel.py +++ b/src/gui/editors/displaytabs/childmodel.py @@ -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), ]) diff --git a/src/gui/filtereditor.py b/src/gui/filtereditor.py index b0a2f5c01..758fa2f34 100644 --- a/src/gui/filtereditor.py +++ b/src/gui/filtereditor.py @@ -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) diff --git a/src/gui/views/treemodels/familymodel.py b/src/gui/views/treemodels/familymodel.py index 91a12e843..b4393c805 100644 --- a/src/gui/views/treemodels/familymodel.py +++ b/src/gui/views/treemodels/familymodel.py @@ -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"" diff --git a/src/gui/views/treemodels/flatbasemodel.py b/src/gui/views/treemodels/flatbasemodel.py index 6cac46018..f1599f81a 100644 --- a/src/gui/views/treemodels/flatbasemodel.py +++ b/src/gui/views/treemodels/flatbasemodel.py @@ -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 diff --git a/src/gui/views/treemodels/peoplemodel.py b/src/gui/views/treemodels/peoplemodel.py index c47feb851..21f682fd5 100644 --- a/src/gui/views/treemodels/peoplemodel.py +++ b/src/gui/views/treemodels/peoplemodel.py @@ -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] diff --git a/src/gui/views/treemodels/treebasemodel.py b/src/gui/views/treemodels/treebasemodel.py index 52a847227..8fc55dd1c 100644 --- a/src/gui/views/treemodels/treebasemodel.py +++ b/src/gui/views/treemodels/treebasemodel.py @@ -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 diff --git a/src/guiQML/views/personview.py b/src/guiQML/views/personview.py index 970c89c68..5d57b7b50 100644 --- a/src/guiQML/views/personview.py +++ b/src/guiQML/views/personview.py @@ -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() diff --git a/src/plugins/webreport/NarrativeWeb.py b/src/plugins/webreport/NarrativeWeb.py index ab8cbd5a2..5550d69be 100644 --- a/src/plugins/webreport/NarrativeWeb.py +++ b/src/plugins/webreport/NarrativeWeb.py @@ -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 = []