* 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
8fea0928b0
commit
01237c99a0
@ -85,8 +85,6 @@ class PeopleStore:
|
|||||||
self.cids.append(name[1])
|
self.cids.append(name[1])
|
||||||
self.tree.append_column(column)
|
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()
|
self.connect_model()
|
||||||
|
|
||||||
if select_func:
|
if select_func:
|
||||||
@ -95,6 +93,10 @@ class PeopleStore:
|
|||||||
self.double_click = event_func
|
self.double_click = event_func
|
||||||
self.tree.connect('event',self.button_press)
|
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):
|
def unselect(self):
|
||||||
self.selection.unselect_all()
|
self.selection.unselect_all()
|
||||||
|
|
||||||
|
@ -206,7 +206,7 @@ class PeopleView:
|
|||||||
if change:
|
if change:
|
||||||
self.parent.change_active_person(person)
|
self.parent.change_active_person(person)
|
||||||
self.goto_active_person()
|
self.goto_active_person()
|
||||||
model.sort()
|
model.enable_sort()
|
||||||
|
|
||||||
def goto_active_person(self,first=0):
|
def goto_active_person(self,first=0):
|
||||||
if not self.parent.active_person:
|
if not self.parent.active_person:
|
||||||
@ -269,7 +269,7 @@ class PeopleView:
|
|||||||
if current_model == None:
|
if current_model == None:
|
||||||
self.id2col = {}
|
self.id2col = {}
|
||||||
|
|
||||||
for key in self.parent.db.getPersonKeys():
|
for key in self.parent.db.sortPersonKeys():
|
||||||
person = self.parent.db.getPerson(key)
|
person = self.parent.db.getPerson(key)
|
||||||
val = self.parent.db.getPersonDisplay(key)
|
val = self.parent.db.getPersonDisplay(key)
|
||||||
pg = val[5]
|
pg = val[5]
|
||||||
|
@ -2198,6 +2198,14 @@ class GrampsDB(Persistent):
|
|||||||
def getPersonKeys(self):
|
def getPersonKeys(self):
|
||||||
return self.personTable.keys()
|
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):
|
def getPersonDisplay(self,key):
|
||||||
return self.personTable[key]
|
return self.personTable[key]
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user