2007-01-23 Don Allingham <don@gramps-project.org>
* src/GrampsDb/_GrampsBSDDB.py: initialize the next gramps_id indexes to the length of the tables to prevent a walk of the db entries. * src/DisplayModels/_BaseModel.py: handle row-insert properly * src/PageView.py: handle row adding properly svn: r7963
This commit is contained in:
parent
f9cc65b4d5
commit
217a8be23b
@ -1,3 +1,10 @@
|
|||||||
|
2007-01-23 Don Allingham <don@gramps-project.org>
|
||||||
|
* src/GrampsDb/_GrampsBSDDB.py: initialize the next gramps_id
|
||||||
|
indexes to the length of the tables to prevent a walk of the db
|
||||||
|
entries.
|
||||||
|
* src/DisplayModels/_BaseModel.py: handle row-insert properly
|
||||||
|
* src/PageView.py: handle row adding properly
|
||||||
|
|
||||||
2007-01-22 Alex Roitman <shura@gramps-project.org>
|
2007-01-22 Alex Roitman <shura@gramps-project.org>
|
||||||
* src/ViewManager.py (vb_clicked): Put back the code that used to
|
* src/ViewManager.py (vb_clicked): Put back the code that used to
|
||||||
enforce the current view button;
|
enforce the current view button;
|
||||||
|
@ -95,18 +95,18 @@ class BaseModel(gtk.GenericTreeModel):
|
|||||||
|
|
||||||
def sort_keys(self):
|
def sort_keys(self):
|
||||||
cursor = self.gen_cursor()
|
cursor = self.gen_cursor()
|
||||||
sarray = []
|
self.sarray = []
|
||||||
data = cursor.next()
|
data = cursor.next()
|
||||||
|
|
||||||
while data:
|
while data:
|
||||||
key = locale.strxfrm(self.sort_func(data[1]))
|
key = locale.strxfrm(self.sort_func(data[1]))
|
||||||
sarray.append((key,data[0]))
|
self.sarray.append((key,data[0]))
|
||||||
data = cursor.next()
|
data = cursor.next()
|
||||||
cursor.close()
|
cursor.close()
|
||||||
|
|
||||||
sarray.sort(reverse=self.reverse)
|
self.sarray.sort(reverse=self.reverse)
|
||||||
|
|
||||||
return [ x[1] for x in sarray ]
|
return [ x[1] for x in self.sarray ]
|
||||||
|
|
||||||
def _rebuild_search(self,ignore=None):
|
def _rebuild_search(self,ignore=None):
|
||||||
if self.db.is_open():
|
if self.db.is_open():
|
||||||
@ -146,8 +146,26 @@ 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.build_tree()
|
|
||||||
|
if self.search and self.search.match(handle):
|
||||||
|
|
||||||
|
data = self.map(handle)
|
||||||
|
key = locale.strxfrm(self.sort_func(data))
|
||||||
|
self.sarray.append((key,handle))
|
||||||
|
self.sarray.sort(reverse=self.reverse)
|
||||||
|
self.datalist = [ x[1] for x in self.sarray ]
|
||||||
|
|
||||||
|
i = 0
|
||||||
|
self.indexlist = {}
|
||||||
|
for key in self.datalist:
|
||||||
|
self.indexlist[key] = i
|
||||||
|
i += 1
|
||||||
|
|
||||||
|
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]
|
||||||
@ -158,7 +176,6 @@ class BaseModel(gtk.GenericTreeModel):
|
|||||||
for key in self.indexlist:
|
for key in self.indexlist:
|
||||||
if self.indexlist[key] > index:
|
if self.indexlist[key] > index:
|
||||||
self.indexlist[key] -= 1
|
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):
|
||||||
|
@ -91,7 +91,8 @@ class EditEvent(EditPrimary):
|
|||||||
|
|
||||||
def _local_init(self):
|
def _local_init(self):
|
||||||
self.top = gtk.glade.XML(const.gladeFile, "event_edit","gramps")
|
self.top = gtk.glade.XML(const.gladeFile, "event_edit","gramps")
|
||||||
self.set_window(self.top.get_widget("event_edit"), None, self.get_menu_title())
|
self.set_window(self.top.get_widget("event_edit"), None,
|
||||||
|
self.get_menu_title())
|
||||||
|
|
||||||
self.place = self.top.get_widget('place')
|
self.place = self.top.get_widget('place')
|
||||||
self.share_btn = self.top.get_widget('select_place')
|
self.share_btn = self.top.get_widget('select_place')
|
||||||
|
@ -606,6 +606,14 @@ class GrampsBSDDB(GrampsDbBase,UpdateCallback):
|
|||||||
table_flags)
|
table_flags)
|
||||||
self.secondary_connected = True
|
self.secondary_connected = True
|
||||||
|
|
||||||
|
self.smap_index = len(self.source_map)
|
||||||
|
self.emap_index = len(self.event_map)
|
||||||
|
self.pmap_index = len(self.person_map)
|
||||||
|
self.fmap_index = len(self.family_map)
|
||||||
|
self.lmap_index = len(self.place_map)
|
||||||
|
self.omap_index = len(self.media_map)
|
||||||
|
self.rmap_index = len(self.repository_map)
|
||||||
|
|
||||||
|
|
||||||
def rebuild_secondary(self,callback):
|
def rebuild_secondary(self,callback):
|
||||||
if self.readonly:
|
if self.readonly:
|
||||||
|
@ -739,7 +739,8 @@ class ListView(BookMarkView):
|
|||||||
|
|
||||||
def row_add(self,handle_list):
|
def row_add(self,handle_list):
|
||||||
if self.active:
|
if self.active:
|
||||||
self.build_tree()
|
for handle in handle_list:
|
||||||
|
self.model.add_row_by_handle(handle)
|
||||||
else:
|
else:
|
||||||
self.dirty = True
|
self.dirty = True
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user