* src/ReadGrdb.py: Disable signals and request rebuild at the end;

properly set transaction.


svn: r5506
This commit is contained in:
Alex Roitman 2005-12-08 05:44:23 +00:00
parent 681ac86b81
commit bc1bb4bede
2 changed files with 25 additions and 5 deletions

View File

@ -11,6 +11,8 @@
* src/po/ru.po: Translation update.
* doc/gramps-manual/Makefile.am: Remove existing link before
creating a new one.
* src/ReadGrdb.py: Disable signals and request rebuild at the end;
properly set transaction.
2005-12-07 Don Allingham <don@gramps-project.org>
* src/Report.py: change from gtk.FILE_CHOOSER_CREATE_FOLDER to

View File

@ -61,12 +61,17 @@ def importData(database, filename, callback=None,cl=0,use_trans=True):
return
if not other_database.version_supported():
if cl:
print "Error: %s could not be opened.\n%s Exiting." % (filename,\
_("The database version is not supported by this version of GRAMPS.\n"\
"Please upgrade to the corresponding version or use XML for porting data between different database versions."))
print "Error: %s could not be opened.\n%s Exiting." \
% (filename,
_("The database version is not supported "
"by this version of GRAMPS.\n"\
"Please upgrade to the corresponding version "
"or use XML for porting data between different "
"database versions."))
else:
ErrorDialog(_("%s could not be opened") % filename,
_("The Database version is not supported by this version of GRAMPS."))
_("The Database version is not supported "
"by this version of GRAMPS."))
return
# Check for duplicate handles. At the moment we simply exit here,
@ -102,9 +107,17 @@ def importData(database, filename, callback=None,cl=0,use_trans=True):
if handles.intersection(other_handles):
raise Errors.HandleError('Event handles in two databases overlap.')
# Proceed with preparing for import
if use_trans:
trans = database.transaction_begin()
trans.set_batch(True)
else:
trans = None
database.disable_signals()
# copy all data from new_database to database,
# rename gramps IDs of first-class objects when conflicts are found
trans = database.transaction_begin(_("Import database"))
# People table
for person_handle in other_database.person_map.keys():
@ -168,4 +181,9 @@ def importData(database, filename, callback=None,cl=0,use_trans=True):
# Events don't have gramps IDs, so we don't need to check here
database.add_event(event,trans)
# close the other database and clean things up
other_database.close()
database.transaction_commit(trans,_("Import database"))
database.enable_signals()
database.request_rebuild()