From e5f4a26dd718edca6d49631f3c08eaf445e0aa5c Mon Sep 17 00:00:00 2001 From: Alex Roitman Date: Thu, 11 May 2006 00:06:43 +0000 Subject: [PATCH] * src/plugins/ChangeTypes.py (run_tool): Disable/enable signals. * src/plugins/ReorderIds.py (__init__): Disable/enable signals. * src/plugins/PatchNames.py (on_ok_clicked): Start transaction only if doing the changes; disable/enable signals. svn: r6614 --- gramps2/ChangeLog | 4 ++++ gramps2/src/plugins/ChangeTypes.py | 3 +++ gramps2/src/plugins/PatchNames.py | 14 +++++++++++--- gramps2/src/plugins/ReorderIds.py | 3 +++ 4 files changed, 21 insertions(+), 3 deletions(-) diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index bbf79b307..a5185803b 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -1,4 +1,8 @@ 2006-05-10 Alex Roitman + * src/plugins/ChangeTypes.py (run_tool): Disable/enable signals. + * src/plugins/ReorderIds.py (__init__): Disable/enable signals. + * src/plugins/PatchNames.py (on_ok_clicked): Start transaction + only if doing the changes; disable/enable signals. * src/plugins/SoundGen.py: Fix WM. 2006-05-10 Don Allingham diff --git a/gramps2/src/plugins/ChangeTypes.py b/gramps2/src/plugins/ChangeTypes.py index 79792e492..a43c1642e 100644 --- a/gramps2/src/plugins/ChangeTypes.py +++ b/gramps2/src/plugins/ChangeTypes.py @@ -113,6 +113,7 @@ class ChangeTypes(Tool.BatchTool, ManagedWindow.ManagedWindow): modified = 0 self.trans = self.db.transaction_begin("",batch=True) + self.db.disable_signals() if not cli: progress = Utils.ProgressMeter(_('Analyzing events'),'') progress.set_pass('',self.db.get_number_of_people()) @@ -132,6 +133,8 @@ class ChangeTypes(Tool.BatchTool, ManagedWindow.ManagedWindow): if not cli: progress.close() self.db.transaction_commit(self.trans,_('Change types')) + self.db.enable_signals() + self.db.request_rebuild() if modified == 0: msg = _("No event record was modified.") diff --git a/gramps2/src/plugins/PatchNames.py b/gramps2/src/plugins/PatchNames.py index 677ebb75d..fb8bc5946 100644 --- a/gramps2/src/plugins/PatchNames.py +++ b/gramps2/src/plugins/PatchNames.py @@ -39,7 +39,6 @@ from gettext import gettext as _ import gobject import gtk import gtk.glade -import GrampsDisplay #------------------------------------------------------------------------- # @@ -50,6 +49,8 @@ import Utils from PluginUtils import Tool, register_tool from QuestionDialog import OkDialog import ManagedWindow +import GrampsDisplay +import RelLib #------------------------------------------------------------------------- # @@ -96,7 +97,6 @@ class PatchNames(Tool.BatchTool, ManagedWindow.ManagedWindow): ManagedWindow.ManagedWindow.__init__(self,uistate,[],self.__class__) self.cb = callback - self.trans = self.db.transaction_begin("",batch=True) self.title_list = [] self.nick_list = [] self.prefix1_list = [] @@ -276,6 +276,8 @@ class PatchNames(Tool.BatchTool, ManagedWindow.ManagedWindow): GrampsDisplay.help('tools-db') def on_ok_clicked(self,obj): + self.trans = self.db.transaction_begin("",batch=True) + self.db.disable_signals() for grp in self.nick_list: handle = self.nick_hash[grp[0]] val = self.model.get_value(handle,0) @@ -283,7 +285,11 @@ class PatchNames(Tool.BatchTool, ManagedWindow.ManagedWindow): p = self.db.get_person_from_handle(grp[0]) name = p.get_primary_name() name.set_first_name(grp[1].strip()) - p.set_nick_name(grp[2].strip()) + nick_name = grp[2].strip() + attr = RelLib.Attribute() + attr.set_type(RelLib.AttributeType.NICKNAME) + attr.set_value(nick_name) + p.add_attribute(attr) self.db.commit_person(p,self.trans) for grp in self.title_list: @@ -318,6 +324,8 @@ class PatchNames(Tool.BatchTool, ManagedWindow.ManagedWindow): self.db.transaction_commit(self.trans, _("Extract information from names")) + self.db.enable_signals() + self.db.request_rebuild() self.close() self.cb() diff --git a/gramps2/src/plugins/ReorderIds.py b/gramps2/src/plugins/ReorderIds.py index 75944e20e..9fb6ec952 100644 --- a/gramps2/src/plugins/ReorderIds.py +++ b/gramps2/src/plugins/ReorderIds.py @@ -63,6 +63,7 @@ class ReorderIds(Tool.BatchTool): print "Reordering GRAMPS IDs..." self.trans = db.transaction_begin("",batch=True) + db.disable_signals() if uistate: self.progress.set_pass(_('Reordering People IDs'), @@ -142,6 +143,8 @@ class ReorderIds(Tool.BatchTool): print "Done." db.transaction_commit(self.trans,_("Reorder GRAMPS IDs")) + db.enable_signals() + db.request_rebuild() def reorder(self, class_type, find_from_id, find_from_handle, find_next_id, table, commit, prefix):