* src/DisplayTabs.py: use idle_loop to load data for source

backreferences
* src/EditSource.py: close the BackReferences tab to turn off the
idle loop if still active
* src/GrampsDb/_GrampsBSDDB.py: close secondary indexes before primary


svn: r5829
This commit is contained in:
Don Allingham 2006-01-25 17:59:22 +00:00
parent 086b1f5e17
commit 3f1c047124
4 changed files with 35 additions and 10 deletions

View File

@ -1,3 +1,10 @@
2006-01-25 Don Allingham <don@gramps-project.org>
* src/DisplayTabs.py: use idle_loop to load data for source
backreferences
* src/EditSource.py: close the BackReferences tab to turn off the
idle loop if still active
* src/GrampsDb/_GrampsBSDDB.py: close secondary indexes before primary
2006-01-24 Don Allingham <don@gramps-project.org> 2006-01-24 Don Allingham <don@gramps-project.org>
* src/DisplayTabs.py: SourceRef tab * src/DisplayTabs.py: SourceRef tab
* src/EditSource.py: New source ref dialog * src/EditSource.py: New source ref dialog

View File

@ -255,6 +255,9 @@ class SourceBackRefList(EmbeddedList):
EmbeddedList.__init__(self, dbstate, uistate, track, EmbeddedList.__init__(self, dbstate, uistate, track,
_('References'), SourceBackRefModel) _('References'), SourceBackRefModel)
def close(self):
self.model.close()
def set_label(self): def set_label(self):
self.tab_image.show() self.tab_image.show()
self.label.set_text("<b>%s</b>" % self.tab_name) self.label.set_text("<b>%s</b>" % self.tab_name)
@ -685,7 +688,15 @@ class SourceBackRefModel(gtk.ListStore):
def __init__(self,sref_list,db): def __init__(self,sref_list,db):
gtk.ListStore.__init__(self,str,str,str,str) gtk.ListStore.__init__(self,str,str,str,str)
self.db = db self.db = db
for ref in sref_list: self.sref_list = sref_list
self.idle = 0
self.idle = gobject.idle_add(self.load_model().next)
def close(self):
gobject.source_remove(self.idle)
def load_model(self):
for ref in self.sref_list:
dtype = ref[0] dtype = ref[0]
if dtype == 'Person': if dtype == 'Person':
p = self.db.get_person_from_handle(ref[1]) p = self.db.get_person_from_handle(ref[1])
@ -722,6 +733,8 @@ class SourceBackRefModel(gtk.ListStore):
handle = p.handle handle = p.handle
self.append(row=[dtype,gid,name,handle]) self.append(row=[dtype,gid,name,handle])
yield True
yield False
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #

View File

@ -275,6 +275,7 @@ class EditSource(DisplayState.ManagedWindow):
return (label, _('Source Editor')) return (label, _('Source Editor'))
def on_delete_event(self,obj,b): def on_delete_event(self,obj,b):
self.backref_tab.close()
self.gladeif.close() self.gladeif.close()
def on_help_clicked(self,obj): def on_help_clicked(self,obj):
@ -282,6 +283,7 @@ class EditSource(DisplayState.ManagedWindow):
GrampsDisplay.help('adv-src') GrampsDisplay.help('adv-src')
def close_window(self,obj): def close_window(self,obj):
self.backref_tab.close()
self.gladeif.close() self.gladeif.close()
self.close() self.close()

View File

@ -783,14 +783,6 @@ class GrampsBSDDB(GrampsDbBase):
if not self.db_is_open: if not self.db_is_open:
return return
self.name_group.close() self.name_group.close()
self.person_map.close()
self.family_map.close()
self.repository_map.close()
self.place_map.close()
self.source_map.close()
self.media_map.close()
self.event_map.close()
self.reference_map.close()
if not self.readonly: if not self.readonly:
self.metadata['bookmarks'] = self.bookmarks self.metadata['bookmarks'] = self.bookmarks
self.metadata['gender_stats'] = self.genderStats.save_stats() self.metadata['gender_stats'] = self.genderStats.save_stats()
@ -811,6 +803,17 @@ class GrampsBSDDB(GrampsDbBase):
self.pid_trans.close() self.pid_trans.close()
self.reference_map_primary_map.close() self.reference_map_primary_map.close()
self.reference_map_referenced_map.close() self.reference_map_referenced_map.close()
self.reference_map.close()
# primary databases must be closed after secondary indexes, or
# we run into problems with any active cursors.
self.person_map.close()
self.family_map.close()
self.repository_map.close()
self.place_map.close()
self.source_map.close()
self.media_map.close()
self.event_map.close()
self.env.txn_checkpoint() self.env.txn_checkpoint()
self.env.close() self.env.close()