2006-05-19 Alex Roitman <shura@gramps-project.org>
* src/GrampsDb/_DbUtils.py (db_copy): Copy custom types. svn: r6726
This commit is contained in:
parent
1175831c49
commit
2fbeb27535
@ -1,3 +1,6 @@
|
|||||||
|
2006-05-19 Alex Roitman <shura@gramps-project.org>
|
||||||
|
* src/GrampsDb/_DbUtils.py (db_copy): Copy custom types.
|
||||||
|
|
||||||
2006-05-19 Martin Hawlisch <Martin.Hawlisch@gmx.de>
|
2006-05-19 Martin Hawlisch <Martin.Hawlisch@gmx.de>
|
||||||
* src/DataViews/_MapView.py (WMSMapTile): Start of map download inside
|
* src/DataViews/_MapView.py (WMSMapTile): Start of map download inside
|
||||||
an idle handler.
|
an idle handler.
|
||||||
|
@ -160,6 +160,14 @@ def get_total(db):
|
|||||||
place_len + source_len + obj_len + repo_len
|
place_len + source_len + obj_len + repo_len
|
||||||
|
|
||||||
def db_copy(from_db,to_db,callback):
|
def db_copy(from_db,to_db,callback):
|
||||||
|
"""
|
||||||
|
Copy all data in from_db into to_db.
|
||||||
|
|
||||||
|
Both databases must be loaded.
|
||||||
|
It is assumed that to_db is an empty database,
|
||||||
|
so no care is taken to prevent handle collision or merge data.
|
||||||
|
"""
|
||||||
|
|
||||||
uc = UpdateCallback(callback)
|
uc = UpdateCallback(callback)
|
||||||
uc.set_total(get_total(from_db))
|
uc.set_total(get_total(from_db))
|
||||||
|
|
||||||
@ -233,8 +241,20 @@ def db_copy(from_db,to_db,callback):
|
|||||||
# Copy gender stats
|
# Copy gender stats
|
||||||
to_db.genderStats = from_db.genderStats
|
to_db.genderStats = from_db.genderStats
|
||||||
|
|
||||||
# FIXME: need to also copy event/attr names
|
# Copy custom types
|
||||||
# TODO: need to also copy event/attr names
|
to_db.family_event_names = from_db.family_event_names
|
||||||
|
to_db.individual_event_names = from_db.individual_event_names
|
||||||
|
to_db.family_attributes = from_db.family_attributes
|
||||||
|
to_db.individual_attributes = from_db.individual_attributes
|
||||||
|
to_db.marker_names = from_db.marker_names
|
||||||
|
to_db.child_ref_types = from_db.child_ref_types
|
||||||
|
to_db.family_rel_types = from_db.family_rel_types
|
||||||
|
to_db.event_role_names = from_db.event_role_names
|
||||||
|
to_db.name_types = from_db.name_types
|
||||||
|
to_db.repository_types = from_db.repository_types
|
||||||
|
to_db.source_media_types = from_db.source_media_types
|
||||||
|
to_db.url_types = from_db.url_types
|
||||||
|
to_db.media_attributes = from_db.media_attributes
|
||||||
|
|
||||||
def add_data_txn(db,table,handle,data):
|
def add_data_txn(db,table,handle,data):
|
||||||
the_txn = db.env.txn_begin()
|
the_txn = db.env.txn_begin()
|
||||||
|
@ -914,32 +914,36 @@ class GrampsDbBase(GrampsDBCallback):
|
|||||||
assert False, "Needs to be overridden in the derived class"
|
assert False, "Needs to be overridden in the derived class"
|
||||||
|
|
||||||
def get_place_from_gramps_id(self, val):
|
def get_place_from_gramps_id(self, val):
|
||||||
"""finds a Place in the database from the passed gramps' ID.
|
"""
|
||||||
If no such Place exists, a new Person is added to the database.
|
Finds a Place in the database from the passed gramps' ID.
|
||||||
|
If no such Place exists, None is returned.
|
||||||
|
|
||||||
Needs to be overridden by the derrived class.
|
Needs to be overridden by the derrived class.
|
||||||
"""
|
"""
|
||||||
assert False, "Needs to be overridden in the derived class"
|
assert False, "Needs to be overridden in the derived class"
|
||||||
|
|
||||||
def get_source_from_gramps_id(self, val):
|
def get_source_from_gramps_id(self, val):
|
||||||
"""finds a Source in the database from the passed gramps' ID.
|
"""
|
||||||
If no such Source exists, a new Person is added to the database.
|
Finds a Source in the database from the passed gramps' ID.
|
||||||
|
If no such Source exists, None is returned.
|
||||||
|
|
||||||
Needs to be overridden by the derrived class.
|
Needs to be overridden by the derrived class.
|
||||||
"""
|
"""
|
||||||
assert False, "Needs to be overridden in the derived class"
|
assert False, "Needs to be overridden in the derived class"
|
||||||
|
|
||||||
def get_object_from_gramps_id(self, val):
|
def get_object_from_gramps_id(self, val):
|
||||||
"""finds a MediaObject in the database from the passed gramps' ID.
|
"""
|
||||||
If no such MediaObject exists, a new Person is added to the database.
|
Finds a MediaObject in the database from the passed gramps' ID.
|
||||||
|
If no such MediaObject exists, None is returned.
|
||||||
|
|
||||||
Needs to be overridden by the derrived class.
|
Needs to be overridden by the derrived class.
|
||||||
"""
|
"""
|
||||||
assert False, "Needs to be overridden in the derived class"
|
assert False, "Needs to be overridden in the derived class"
|
||||||
|
|
||||||
def get_repository_from_gramps_id(self, val):
|
def get_repository_from_gramps_id(self, val):
|
||||||
"""finds a Repository in the database from the passed gramps' ID.
|
"""
|
||||||
If no such Repository exists, a new Repository is added to the database.
|
Finds a Repository in the database from the passed gramps' ID.
|
||||||
|
If no such MediaObject exists, None is returned.
|
||||||
|
|
||||||
Needs to be overridden by the derrived class.
|
Needs to be overridden by the derrived class.
|
||||||
"""
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user