2007-01-22 Don Allingham <don@gramps-project.org>

* src/DisplayModels/_BaseModel.py: avoid rebuild on delete
	* src/PageView.py:  avoid rebuild on delete



svn: r7960
This commit is contained in:
Don Allingham 2007-01-23 04:24:41 +00:00
parent b4c43863fd
commit e82aa0c3a3
3 changed files with 19 additions and 17 deletions

View File

@ -1,3 +1,7 @@
2007-01-22 Don Allingham <don@gramps-project.org>
* src/DisplayModels/_BaseModel.py: avoid rebuild on delete
* src/PageView.py: avoid rebuild on delete
2007-01-22 Alex Roitman <shura@gramps-project.org> 2007-01-22 Alex Roitman <shura@gramps-project.org>
* src/Editors/_EditSource.py (query_response): Remove sourcerefs * src/Editors/_EditSource.py (query_response): Remove sourcerefs
from repos (indirectly, through secondary objects). from repos (indirectly, through secondary objects).

View File

@ -104,16 +104,13 @@ class BaseModel(gtk.GenericTreeModel):
data = cursor.next() data = cursor.next()
cursor.close() cursor.close()
sarray.sort() sarray.sort(reverse=self.reverse)
if self.reverse:
sarray.reverse()
return [ x[1] for x in sarray ] return [ x[1] for x in sarray ]
def _rebuild_search(self,ignore=None): def _rebuild_search(self,ignore=None):
if self.db.is_open(): if self.db.is_open():
if self.search: if self.search and self.search.text:
self.datalist = [h for h in self.sort_keys()\ self.datalist = [h for h in self.sort_keys()\
if self.search.match(h) and \ if self.search.match(h) and \
h not in self.skip and h != ignore] h not in self.skip and h != ignore]
@ -123,7 +120,6 @@ class BaseModel(gtk.GenericTreeModel):
i = 0 i = 0
self.indexlist = {} self.indexlist = {}
for key in self.datalist: for key in self.datalist:
if key not in self.skip and key != ignore:
self.indexlist[key] = i self.indexlist[key] = i
i += 1 i += 1
else: else:
@ -150,16 +146,19 @@ class BaseModel(gtk.GenericTreeModel):
self.datalist = [] self.datalist = []
self.indexlist = {} self.indexlist = {}
def add_row_by_handle(self,handle): # def add_row_by_handle(self,handle):
self.rebuild_data() # self.build_tree()
index = self.indexlist.get(handle)
if index:
node = self.get_iter(index)
self.row_inserted(index, node)
def delete_row_by_handle(self,handle): def delete_row_by_handle(self,handle):
index = self.indexlist[handle] index = self.indexlist[handle]
self.rebuild_data(ignore=handle)
del self.datalist[index]
del self.indexlist[handle]
for key in self.indexlist:
if self.indexlist[key] > index:
self.indexlist[key] -= 1
#self.rebuild_data(ignore=handle)
self.row_deleted(index) self.row_deleted(index)
def update_row_by_handle(self,handle): def update_row_by_handle(self,handle):

View File

@ -739,8 +739,7 @@ class ListView(BookMarkView):
def row_add(self,handle_list): def row_add(self,handle_list):
if self.active: if self.active:
for handle in handle_list: self.build_tree()
self.model.add_row_by_handle(handle)
else: else:
self.dirty = True self.dirty = True