* src/RelLib.py: Add a "sortbynames" to presort keys before adding to
the tables * src/PeopleView.py: Presort names before adding, delay enabling of autosorting until data has been added * src/PeopleStore.py: Add enable sort task svn: r2267
This commit is contained in:
parent
a3694c57e0
commit
adf6c47c96
@ -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()
|
||||
|
||||
|
@ -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]
|
||||
|
@ -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]
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user