* src/plugins/ChangeTypes.py: Use transaction for commits.

svn: r3161
This commit is contained in:
Alex Roitman 2004-05-13 04:21:27 +00:00
parent 653d5499ee
commit 4f3839e0d0
2 changed files with 10 additions and 3 deletions

View File

@ -10,6 +10,7 @@
* src/plugins/Check.py: Use transaction for commits.
* src/plugins/PatchNames.py: Use transaction for commits.
* src/plugins/ChangeTypes.py: Use transaction for commits.
2004-05-11 Don Allingham <donaldallingham@users.sourceforge.net>
* src/GrampsCfg.py: remove unused options

View File

@ -40,8 +40,13 @@ import AutoComp
#-------------------------------------------------------------------------
def runTool(database,person,callback,parent=None):
try:
ChangeTypes(database,person,parent)
trans = database.start_transaction()
ChangeTypes(database,person,parent,trans)
database.add_transaction(trans)
except:
database.add_transaction(trans)
database.undo()
import DisplayTrace
DisplayTrace.DisplayTrace()
@ -51,9 +56,10 @@ def runTool(database,person,callback,parent=None):
#
#-------------------------------------------------------------------------
class ChangeTypes:
def __init__(self,db,person,parent):
def __init__(self,db,person,parent,trans):
self.person = person
self.db = db
self.trans = trans
base = os.path.dirname(__file__)
glade_file = "%s/%s" % (base,"changetype.glade")
@ -87,7 +93,7 @@ class ChangeTypes:
if event.get_name() == original:
event.set_name(new)
modified = modified + 1
self.db.commit_event(event)
self.db.commit_event(event,self.trans)
if modified == 1:
msg = _("1 event record was modified")