* 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
This commit is contained in:
Alex Roitman 2006-05-11 00:06:43 +00:00
parent 45b55a402c
commit e5f4a26dd7
4 changed files with 21 additions and 3 deletions

View File

@ -1,4 +1,8 @@
2006-05-10 Alex Roitman <shura@gramps-project.org>
* 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 <don@gramps-project.org>

View File

@ -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.")

View File

@ -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()

View File

@ -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):