* src/GrampsDb/_DbUtils.py (db_copy): Copy bookmarks and gender stats.

(importData): Import bookmarks.


svn: r6715
This commit is contained in:
Alex Roitman 2006-05-18 22:56:13 +00:00
parent b970a24a1b
commit 53269db447
3 changed files with 26 additions and 5 deletions

View File

@ -1,4 +1,5 @@
2006-05-18 Alex Roitman <shura@gramps-project.org>
* src/GrampsDb/_DbUtils.py (db_copy): Copy bookmarks and gender stats.
* data/grampsxml.dtd: Update for new bookmarks.
* data/grampsxml.rng: Update for new bookmarks.
* src/GrampsDb/_WriteXML.py (write_bookmarks): Add method to write
@ -6,6 +7,7 @@
* src/GrampsDb/_ReadXML.py (start_bmark): Parse new bookmarks
* INSTALL: Clarify; list build-dependencies.
* src/GrampsDb/_ReadGrdb.py: Update progress.
(importData): Import bookmarks.
2006-05-18 Don Allingham <don@gramps-project.org>
* src/GrampsDb/_ReadGedcom.py: fix parsing level so that CHAR is not

View File

@ -220,12 +220,21 @@ def db_copy(from_db,to_db,callback):
# Commit batch transaction: does nothing, except undoing the tricks
to_db.transaction_commit(trans,"")
# The metadata is always transactionless,
# and the table is small, so using key iteration is OK here.
for handle in from_db.metadata.keys():
data = from_db.metadata.get(handle)
to_db.metadata[handle] = data
# Copy bookmarks over:
# we already know that there's no overlap in handles anywhere
to_db.bookmarks = from_db.bookmarks
to_db.family_bookmarks = from_db.family_bookmarks
to_db.event_bookmarks = from_db.event_bookmarks
to_db.source_bookmarks = from_db.source_bookmarks
to_db.place_bookmarks = from_db.place_bookmarks
to_db.media_bookmarks = from_db.media_bookmarks
to_db.repo_bookmarks = from_db.repo_bookmarks
# Copy gender stats
to_db.genderStats = from_db.genderStats
# FIXME: need to also copy event/attr names
# TODO: need to also copy event/attr names
def add_data_txn(db,table,handle,data):
the_txn = db.env.txn_begin()

View File

@ -176,6 +176,16 @@ def importData(database, filename, callback=None,cl=0,use_trans=True):
import_table(id_table,add_obj,find_next_gramps_id,
other_table,other_get_from_handle,trans,uc)
# Copy bookmarks over:
# we already know that there's no overlap in handles anywhere
database.bookmarks += other_database.bookmarks
database.family_bookmarks += other_database.family_bookmarks
database.event_bookmarks += other_database.event_bookmarks
database.source_bookmarks += other_database.source_bookmarks
database.place_bookmarks += other_database.place_bookmarks
database.media_bookmarks += other_database.media_bookmarks
database.repo_bookmarks += other_database.repo_bookmarks
# close the other database and clean things up
other_database.close()