diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index 55cae68a3..8c5a2c38c 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -1,3 +1,7 @@ +2005-08-17 Don Allingham + * src/ChooseParents.py: disconnect signals on close, do fewer + commits + 2005-08-17 Richard Taylor * src/plugins/ExportVCalendar.py: fixed import for localtime, corrected type of Utils and params to Until.family_name diff --git a/gramps2/src/ChooseParents.py b/gramps2/src/ChooseParents.py index ce44794ee..9a9f636e1 100644 --- a/gramps2/src/ChooseParents.py +++ b/gramps2/src/ChooseParents.py @@ -91,10 +91,11 @@ class ChooseParents: self.parent_selected = 0 self.renderer = gtk.CellRendererText() - db.connect('person-add', self.person_added) - db.connect('person-update', self.redraw) - db.connect('person-delete', self.redraw) - db.connect('person-rebuild', self.redraw_all) + self.sig_keys = [ + db.connect('person-add', self.person_added), + db.connect('person-update', self.redraw), + db.connect('person-delete', self.redraw), + db.connect('person-rebuild', self.redraw_all)] # set default filters self.all_males_filter = GenericFilter.GenericFilter() @@ -400,7 +401,7 @@ class ChooseParents: self.mother_filter = self.likely_females_filter self.redrawm() - def find_family(self,father_handle,mother_handle,trans): + def find_family(self,father_handle,mother_handle): """ Finds the family associated with the father and mother. If one does not exist, it is created. @@ -413,30 +414,25 @@ class ChooseParents: if (family.get_father_handle() == father_handle and family.get_mother_handle() == mother_handle): family.add_child_handle(self.person.get_handle()) - self.db.commit_family(family,trans) return family elif (family.get_father_handle() == mother_handle and family.get_mother_handle() == father_handle): family.add_child_handle(self.person.get_handle()) - self.db.commit_family(family,trans) return family family = RelLib.Family() family.set_father_handle(father_handle) family.set_mother_handle(mother_handle) family.add_child_handle(self.person.get_handle()) - self.db.add_family(family,trans) + family.set_handle(self.db.create_id()) + family.set_gramps_id(self.db.find_next_family_gramps_id()) if father_handle: self.father = self.db.get_person_from_handle(father_handle) self.father.add_family_handle(family.get_handle()) - self.db.commit_person(self.father,trans) if mother_handle: self.mother = self.db.get_person_from_handle(mother_handle) self.mother.add_family_handle(family.get_handle()) - self.db.commit_person(self.mother,trans) - - self.db.commit_family(family,trans) return family def father_select_function(self,store,path,iter,id_list): @@ -514,6 +510,10 @@ class ChooseParents: Called with the OK button is pressed. Saves the selected people as parents of the main person. """ + + for key in self.sig_keys: + self.db.disconnect(key) + try: mother_rel = self.mcombo.get_active() except KeyError: @@ -563,10 +563,15 @@ class ChooseParents: return if father_handle or mother_handle: - self.family = self.find_family(father_handle,mother_handle,trans) + self.family = self.find_family(father_handle,mother_handle) self.family.add_child_handle(self.person.get_handle()) self.family.set_relationship(self.type) - self.change_family_type(self.family,mother_rel,father_rel) + self.change_family_type(self.family,mother_rel,father_rel,trans) + self.db.commit_person(self.person,trans) + if self.father: + self.db.commit_person(self.father,trans) + if self.mother: + self.db.commit_person(self.mother,trans) self.db.commit_family(self.family,trans) else: self.family = None @@ -629,7 +634,7 @@ class ChooseParents: import DisplayTrace DisplayTrace.DisplayTrace() - def change_family_type(self,family,mother_rel,father_rel): + def change_family_type(self,family,mother_rel,father_rel,trans): """ Changes the family type of the specified family. If the family is None, the the relationship type shoud be deleted. @@ -650,15 +655,6 @@ class ChooseParents: self.person.add_parent_family_handle(family_handle, mother_rel,father_rel) - trans = self.db.transaction_begin() - self.db.commit_person(self.person,trans) - self.db.commit_family(family,trans) - if self.father: - self.db.commit_person(self.father,trans) - if self.mother: - self.db.commit_person(self.mother,trans) - self.db.transaction_commit(trans,_("Choose Parents")) - #------------------------------------------------------------------------- # # ModifyParents diff --git a/gramps2/src/GrampsDbBase.py b/gramps2/src/GrampsDbBase.py index 3fce4afe6..e7406ecaa 100644 --- a/gramps2/src/GrampsDbBase.py +++ b/gramps2/src/GrampsDbBase.py @@ -281,7 +281,7 @@ class GrampsDbBase(GrampsDBCallback.GrampsDBCallback): as part of the transaction. """ if self.readonly or not person or not person.get_handle(): - return + return if change_time: person.change = int(change_time) else: