* src/ReadGrdb.py: Disable signals and request rebuild at the end;
properly set transaction. svn: r5506
This commit is contained in:
parent
681ac86b81
commit
bc1bb4bede
@ -11,6 +11,8 @@
|
|||||||
* src/po/ru.po: Translation update.
|
* src/po/ru.po: Translation update.
|
||||||
* doc/gramps-manual/Makefile.am: Remove existing link before
|
* doc/gramps-manual/Makefile.am: Remove existing link before
|
||||||
creating a new one.
|
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>
|
2005-12-07 Don Allingham <don@gramps-project.org>
|
||||||
* src/Report.py: change from gtk.FILE_CHOOSER_CREATE_FOLDER to
|
* src/Report.py: change from gtk.FILE_CHOOSER_CREATE_FOLDER to
|
||||||
|
@ -61,12 +61,17 @@ def importData(database, filename, callback=None,cl=0,use_trans=True):
|
|||||||
return
|
return
|
||||||
if not other_database.version_supported():
|
if not other_database.version_supported():
|
||||||
if cl:
|
if cl:
|
||||||
print "Error: %s could not be opened.\n%s Exiting." % (filename,\
|
print "Error: %s could not be opened.\n%s Exiting." \
|
||||||
_("The database version is not supported by this version of GRAMPS.\n"\
|
% (filename,
|
||||||
"Please upgrade to the corresponding version or use XML for porting data between different database versions."))
|
_("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:
|
else:
|
||||||
ErrorDialog(_("%s could not be opened") % filename,
|
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
|
return
|
||||||
|
|
||||||
# Check for duplicate handles. At the moment we simply exit here,
|
# 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):
|
if handles.intersection(other_handles):
|
||||||
raise Errors.HandleError('Event handles in two databases overlap.')
|
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,
|
# copy all data from new_database to database,
|
||||||
# rename gramps IDs of first-class objects when conflicts are found
|
# rename gramps IDs of first-class objects when conflicts are found
|
||||||
trans = database.transaction_begin(_("Import database"))
|
|
||||||
|
|
||||||
# People table
|
# People table
|
||||||
for person_handle in other_database.person_map.keys():
|
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
|
# Events don't have gramps IDs, so we don't need to check here
|
||||||
database.add_event(event,trans)
|
database.add_event(event,trans)
|
||||||
|
|
||||||
|
# close the other database and clean things up
|
||||||
|
other_database.close()
|
||||||
|
|
||||||
database.transaction_commit(trans,_("Import database"))
|
database.transaction_commit(trans,_("Import database"))
|
||||||
|
database.enable_signals()
|
||||||
|
database.request_rebuild()
|
||||||
|
Loading…
Reference in New Issue
Block a user