diff --git a/src/PeopleStore.py b/src/PeopleStore.py index 34cbcd790..095aa32cc 100644 --- a/src/PeopleStore.py +++ b/src/PeopleStore.py @@ -85,8 +85,6 @@ class PeopleStore: self.cids.append(name[1]) self.tree.append_column(column) - if self.cids[0] != -1: - self.model.set_sort_column_id(self.cids[0],gtk.SORT_ASCENDING) self.connect_model() if select_func: @@ -95,6 +93,10 @@ class PeopleStore: self.double_click = event_func self.tree.connect('event',self.button_press) + def enable_sort(self): + if self.cids[0] != -1: + self.model.set_sort_column_id(self.cids[0],gtk.SORT_ASCENDING) + def unselect(self): self.selection.unselect_all() diff --git a/src/PeopleView.py b/src/PeopleView.py index 1ec592fc7..29156618d 100644 --- a/src/PeopleView.py +++ b/src/PeopleView.py @@ -206,7 +206,7 @@ class PeopleView: if change: self.parent.change_active_person(person) self.goto_active_person() - model.sort() + model.enable_sort() def goto_active_person(self,first=0): if not self.parent.active_person: @@ -269,7 +269,7 @@ class PeopleView: if current_model == None: self.id2col = {} - for key in self.parent.db.getPersonKeys(): + for key in self.parent.db.sortPersonKeys(): person = self.parent.db.getPerson(key) val = self.parent.db.getPersonDisplay(key) pg = val[5] diff --git a/src/RelLib.py b/src/RelLib.py index 8e877bb82..3e1574c96 100644 --- a/src/RelLib.py +++ b/src/RelLib.py @@ -2197,7 +2197,15 @@ class GrampsDB(Persistent): def getPersonKeys(self): return self.personTable.keys() - + + def sortbyname(self,f,s): + return cmp(self.personTable[f][5],self.personTable[s][5]) + + def sortPersonKeys(self): + keys = self.personTable.keys() + keys.sort(self.sortbyname) + return keys + def getPersonDisplay(self,key): return self.personTable[key]