diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index d7da09c4b..e6de05df6 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -1,3 +1,10 @@ +2006-01-25 Don Allingham + * 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 * src/DisplayTabs.py: SourceRef tab * src/EditSource.py: New source ref dialog diff --git a/gramps2/src/DisplayTabs.py b/gramps2/src/DisplayTabs.py index 6ae91f73b..a3a59c187 100644 --- a/gramps2/src/DisplayTabs.py +++ b/gramps2/src/DisplayTabs.py @@ -255,6 +255,9 @@ class SourceBackRefList(EmbeddedList): EmbeddedList.__init__(self, dbstate, uistate, track, _('References'), SourceBackRefModel) + def close(self): + self.model.close() + def set_label(self): self.tab_image.show() self.label.set_text("%s" % self.tab_name) @@ -685,7 +688,15 @@ class SourceBackRefModel(gtk.ListStore): def __init__(self,sref_list,db): gtk.ListStore.__init__(self,str,str,str,str) 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] if dtype == 'Person': p = self.db.get_person_from_handle(ref[1]) @@ -722,7 +733,9 @@ class SourceBackRefModel(gtk.ListStore): handle = p.handle self.append(row=[dtype,gid,name,handle]) - + yield True + yield False + #------------------------------------------------------------------------- # # FamilyAttrModel diff --git a/gramps2/src/EditSource.py b/gramps2/src/EditSource.py index 51aa8d10d..767083d07 100644 --- a/gramps2/src/EditSource.py +++ b/gramps2/src/EditSource.py @@ -275,6 +275,7 @@ class EditSource(DisplayState.ManagedWindow): return (label, _('Source Editor')) def on_delete_event(self,obj,b): + self.backref_tab.close() self.gladeif.close() def on_help_clicked(self,obj): @@ -282,6 +283,7 @@ class EditSource(DisplayState.ManagedWindow): GrampsDisplay.help('adv-src') def close_window(self,obj): + self.backref_tab.close() self.gladeif.close() self.close() diff --git a/gramps2/src/GrampsDb/_GrampsBSDDB.py b/gramps2/src/GrampsDb/_GrampsBSDDB.py index 698aeb433..94877719a 100644 --- a/gramps2/src/GrampsDb/_GrampsBSDDB.py +++ b/gramps2/src/GrampsDb/_GrampsBSDDB.py @@ -783,14 +783,6 @@ class GrampsBSDDB(GrampsDbBase): if not self.db_is_open: return 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: self.metadata['bookmarks'] = self.bookmarks self.metadata['gender_stats'] = self.genderStats.save_stats() @@ -811,6 +803,17 @@ class GrampsBSDDB(GrampsDbBase): self.pid_trans.close() self.reference_map_primary_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.close()