2004-09-29 08:49:01 +05:30
|
|
|
#
|
2004-08-01 09:51:31 +05:30
|
|
|
# Gramps - a GTK+/GNOME based genealogy program
|
|
|
|
#
|
2007-02-20 06:09:10 +05:30
|
|
|
# Copyright (C) 2000-2007 Donald N. Allingham
|
2010-10-23 04:52:33 +05:30
|
|
|
# Copyright (C) 2010 Nick Hall
|
2011-07-25 00:00:28 +05:30
|
|
|
# Copyright (C) 2011 Tim G L Lyons
|
2004-08-01 09:51:31 +05:30
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation; either version 2 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
2006-04-08 02:36:20 +05:30
|
|
|
# This program is distributed in the hope that it will be useful,
|
2004-08-01 09:51:31 +05:30
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program; if not, write to the Free Software
|
|
|
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
#
|
|
|
|
|
|
|
|
# $Id$
|
|
|
|
|
2004-08-13 10:04:07 +05:30
|
|
|
"""
|
|
|
|
Base class for the GRAMPS databases. All database interfaces should inherit
|
|
|
|
from this class.
|
|
|
|
"""
|
2009-12-27 19:19:15 +05:30
|
|
|
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# Python libraries
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
2010-01-18 10:12:17 +05:30
|
|
|
from gen.ggettext import gettext as _
|
2009-12-27 19:19:15 +05:30
|
|
|
|
2005-01-09 07:48:49 +05:30
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# GRAMPS libraries
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
2009-12-21 09:48:31 +05:30
|
|
|
import gen.lib
|
2011-02-20 16:22:06 +05:30
|
|
|
from txn import DbTxn
|
2011-08-10 02:04:21 +05:30
|
|
|
from exceptions import DbTransactionCancel
|
2009-12-23 21:25:58 +05:30
|
|
|
|
|
|
|
class DbReadBase(object):
|
2004-08-13 10:04:07 +05:30
|
|
|
"""
|
|
|
|
GRAMPS database object. This object is a base class for all
|
2009-09-01 00:12:29 +05:30
|
|
|
database interfaces. All methods raise NotImplementedError
|
|
|
|
and must be implemented in the derived class as required.
|
2004-08-13 10:04:07 +05:30
|
|
|
"""
|
2004-08-01 09:51:31 +05:30
|
|
|
|
|
|
|
def __init__(self):
|
2004-08-13 10:04:07 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Create a new DbReadBase instance.
|
2008-02-23 14:08:55 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
A new DbReadBase class should never be directly created. Only classes
|
2008-02-23 14:08:55 +05:30
|
|
|
derived from this class should be created.
|
2004-08-13 10:04:07 +05:30
|
|
|
"""
|
2010-05-26 04:59:37 +05:30
|
|
|
self.basedb = self
|
2012-05-31 19:27:05 +05:30
|
|
|
self.__feature = {} # {"feature": VALUE, ...}
|
|
|
|
|
|
|
|
def get_feature(self, feature):
|
|
|
|
"""
|
|
|
|
Databases can implement certain features or not. The default is
|
|
|
|
None, unless otherwise explicitly stated.
|
|
|
|
"""
|
|
|
|
return self.__feature.get(feature, None) # can also be explitily None
|
|
|
|
|
|
|
|
def set_feature(self, feature, value):
|
|
|
|
"""
|
|
|
|
Databases can implement certain features.
|
|
|
|
"""
|
|
|
|
self.__feature[feature] = value
|
2004-08-13 10:04:07 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def all_handles(self, table):
|
2009-09-01 00:12:29 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Return all handles from the specified table as a list
|
2009-09-01 00:12:29 +05:30
|
|
|
"""
|
|
|
|
raise NotImplementedError
|
2007-02-04 06:48:17 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def close(self):
|
2009-09-01 00:12:29 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Close the specified database.
|
2009-09-01 00:12:29 +05:30
|
|
|
"""
|
|
|
|
raise NotImplementedError
|
2005-08-18 11:28:28 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def create_id(self):
|
|
|
|
"""
|
|
|
|
Create an id
|
|
|
|
"""
|
2009-09-01 00:12:29 +05:30
|
|
|
raise NotImplementedError
|
2005-06-05 09:31:56 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def db_has_bm_changes(self):
|
2009-09-01 00:12:29 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Return whethere there were bookmark changes during the session.
|
2009-09-01 00:12:29 +05:30
|
|
|
"""
|
|
|
|
raise NotImplementedError
|
2005-03-03 11:03:22 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def find_backlink_handles(self, handle, include_classes=None):
|
2009-09-01 00:12:29 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Find all objects that hold a reference to the object handle.
|
|
|
|
|
|
|
|
Returns an iterator over a list of (class_name, handle) tuples.
|
|
|
|
|
|
|
|
:param handle: handle of the object to search for.
|
|
|
|
:type handle: database handle
|
|
|
|
:param include_classes: list of class names to include in the results.
|
|
|
|
Default is None which includes all classes.
|
|
|
|
:type include_classes: list of class names
|
|
|
|
|
|
|
|
This default implementation does a sequential scan through all
|
|
|
|
the primary object databases and is very slow. Backends can
|
|
|
|
override this method to provide much faster implementations that
|
|
|
|
make use of additional capabilities of the backend.
|
|
|
|
|
|
|
|
Note that this is a generator function, it returns a iterator for
|
|
|
|
use in loops. If you want a list of the results use::
|
|
|
|
|
|
|
|
result_list = list(find_backlink_handles(handle))
|
2009-09-01 00:12:29 +05:30
|
|
|
"""
|
2009-09-04 01:14:01 +05:30
|
|
|
raise NotImplementedError
|
2006-01-07 02:25:49 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def find_initial_person(self):
|
2009-09-01 00:12:29 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Returns first person in the database
|
2009-09-01 00:12:29 +05:30
|
|
|
"""
|
2009-09-04 01:14:01 +05:30
|
|
|
raise NotImplementedError
|
2006-01-07 02:25:49 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def find_next_event_gramps_id(self):
|
|
|
|
"""
|
|
|
|
Return the next available GRAMPS' ID for a Event object based off the
|
|
|
|
event ID prefix.
|
|
|
|
"""
|
2009-09-04 01:14:01 +05:30
|
|
|
raise NotImplementedError
|
2006-01-07 02:25:49 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def find_next_family_gramps_id(self):
|
2009-09-01 00:12:29 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Return the next available GRAMPS' ID for a Family object based off the
|
|
|
|
family ID prefix.
|
2009-09-01 00:12:29 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
raise NotImplementedError
|
2005-01-09 07:48:49 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def find_next_note_gramps_id(self):
|
2009-09-01 00:12:29 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Return the next available GRAMPS' ID for a Note object based off the
|
|
|
|
note ID prefix.
|
2009-09-01 00:12:29 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
raise NotImplementedError
|
2004-12-05 09:45:48 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def find_next_object_gramps_id(self):
|
2009-09-01 00:12:29 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Return the next available GRAMPS' ID for a MediaObject object based
|
|
|
|
off the media object ID prefix.
|
2009-09-01 00:12:29 +05:30
|
|
|
"""
|
2007-05-07 09:09:46 +05:30
|
|
|
raise NotImplementedError
|
2004-12-10 06:58:43 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def find_next_person_gramps_id(self):
|
2009-09-01 00:12:29 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Return the next available GRAMPS' ID for a Person object based off the
|
|
|
|
person ID prefix.
|
2009-09-01 00:12:29 +05:30
|
|
|
"""
|
2007-05-07 09:09:46 +05:30
|
|
|
raise NotImplementedError
|
2005-06-07 10:38:50 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def find_next_place_gramps_id(self):
|
2009-09-01 00:12:29 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Return the next available GRAMPS' ID for a Place object based off the
|
|
|
|
place ID prefix.
|
2009-09-01 00:12:29 +05:30
|
|
|
"""
|
2007-05-07 09:09:46 +05:30
|
|
|
raise NotImplementedError
|
2004-12-10 06:58:43 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def find_next_repository_gramps_id(self):
|
2009-09-01 00:12:29 +05:30
|
|
|
"""
|
2010-04-04 16:33:43 +05:30
|
|
|
Return the next available GRAMPS' ID for a Repository object based
|
2009-12-23 21:25:58 +05:30
|
|
|
off the repository ID prefix.
|
2009-09-01 00:12:29 +05:30
|
|
|
"""
|
2007-05-07 09:09:46 +05:30
|
|
|
raise NotImplementedError
|
2004-12-10 06:58:43 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def find_next_source_gramps_id(self):
|
2009-09-01 00:12:29 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Return the next available GRAMPS' ID for a Source object based off the
|
|
|
|
source ID prefix.
|
2009-09-01 00:12:29 +05:30
|
|
|
"""
|
2007-05-07 09:09:46 +05:30
|
|
|
raise NotImplementedError
|
2004-12-10 06:58:43 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def get_bookmarks(self):
|
2009-09-01 00:12:29 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Return the list of Person handles in the bookmarks.
|
2009-09-01 00:12:29 +05:30
|
|
|
"""
|
|
|
|
raise NotImplementedError
|
2007-02-05 02:50:46 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def get_child_reference_types(self):
|
2009-09-01 00:12:29 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Return a list of all child reference types associated with Family
|
|
|
|
instances in the database.
|
2009-09-01 00:12:29 +05:30
|
|
|
"""
|
2007-05-07 09:09:46 +05:30
|
|
|
raise NotImplementedError
|
2005-05-27 23:13:04 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def get_default_handle(self):
|
2009-09-01 00:12:29 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Return the default Person of the database.
|
2009-09-01 00:12:29 +05:30
|
|
|
"""
|
|
|
|
raise NotImplementedError
|
2007-02-05 02:50:46 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def get_default_person(self):
|
2009-09-01 00:12:29 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Return the default Person of the database.
|
2009-09-01 00:12:29 +05:30
|
|
|
"""
|
2007-05-07 09:09:46 +05:30
|
|
|
raise NotImplementedError
|
2007-02-20 06:09:10 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def get_event_bookmarks(self):
|
2009-09-01 00:12:29 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Return the list of Person handles in the bookmarks.
|
2009-09-01 00:12:29 +05:30
|
|
|
"""
|
|
|
|
raise NotImplementedError
|
2007-02-20 06:09:10 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def get_event_cursor(self):
|
2009-09-01 00:12:29 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Return a reference to a cursor over Family objects
|
2009-09-01 00:12:29 +05:30
|
|
|
"""
|
|
|
|
raise NotImplementedError
|
2006-05-07 10:52:44 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def get_event_from_gramps_id(self, val):
|
2004-08-13 10:04:07 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Find an Event in the database from the passed GRAMPS ID.
|
|
|
|
|
|
|
|
If no such Event exists, None is returned.
|
|
|
|
Needs to be overridden by the derived class.
|
2004-08-13 10:04:07 +05:30
|
|
|
"""
|
2007-05-07 09:09:46 +05:30
|
|
|
raise NotImplementedError
|
2004-08-01 09:51:31 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def get_event_from_handle(self, handle):
|
2004-08-13 10:04:07 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Find a Event in the database from the passed gramps' ID.
|
2004-08-11 09:12:38 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
If no such Event exists, None is returned.
|
2004-08-13 10:04:07 +05:30
|
|
|
"""
|
2009-09-01 00:12:29 +05:30
|
|
|
raise NotImplementedError
|
2005-04-04 22:11:01 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def get_event_handles(self):
|
2005-04-04 22:11:01 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Return a list of database handles, one handle for each Event in the
|
|
|
|
database.
|
2005-04-04 22:11:01 +05:30
|
|
|
"""
|
2009-09-01 00:12:29 +05:30
|
|
|
raise NotImplementedError
|
2009-12-23 21:25:58 +05:30
|
|
|
|
|
|
|
def get_event_roles(self):
|
2004-08-13 10:04:07 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Return a list of all custom event role names associated with Event
|
|
|
|
instances in the database.
|
2004-08-13 10:04:07 +05:30
|
|
|
"""
|
2009-09-01 00:12:29 +05:30
|
|
|
raise NotImplementedError
|
2005-07-09 01:54:54 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def get_family_attribute_types(self):
|
2005-04-18 04:04:56 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Return a list of all Attribute types associated with Family instances
|
|
|
|
in the database.
|
2005-04-18 04:04:56 +05:30
|
|
|
"""
|
2009-09-01 00:12:29 +05:30
|
|
|
raise NotImplementedError
|
2006-05-20 01:18:36 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def get_family_bookmarks(self):
|
2004-08-13 10:04:07 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Return the list of Person handles in the bookmarks.
|
2004-08-13 10:04:07 +05:30
|
|
|
"""
|
2009-09-01 00:12:29 +05:30
|
|
|
raise NotImplementedError
|
2009-12-23 21:25:58 +05:30
|
|
|
|
|
|
|
def get_family_cursor(self):
|
2004-08-13 10:04:07 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Return a reference to a cursor over Family objects
|
2004-08-13 10:04:07 +05:30
|
|
|
"""
|
2009-09-01 00:12:29 +05:30
|
|
|
raise NotImplementedError
|
2006-05-19 06:09:22 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def get_family_event_types(self):
|
2004-08-13 10:04:07 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Return a list of all Event types associated with Family instances in
|
|
|
|
the database.
|
2004-08-13 10:04:07 +05:30
|
|
|
"""
|
2009-09-01 00:12:29 +05:30
|
|
|
raise NotImplementedError
|
2006-05-20 01:18:36 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def get_family_from_gramps_id(self, val):
|
2009-09-01 00:12:29 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Find a Family in the database from the passed GRAMPS ID.
|
|
|
|
|
|
|
|
If no such Family exists, None is returned.
|
|
|
|
Need to be overridden by the derived class.
|
2009-09-01 00:12:29 +05:30
|
|
|
"""
|
|
|
|
raise NotImplementedError
|
2005-08-18 11:28:28 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def get_family_from_handle(self, handle):
|
2009-09-01 00:12:29 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Find a Family in the database from the passed gramps' ID.
|
|
|
|
|
|
|
|
If no such Family exists, None is returned.
|
2009-09-01 00:12:29 +05:30
|
|
|
"""
|
|
|
|
raise NotImplementedError
|
2005-08-18 11:28:28 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def get_family_handles(self):
|
2004-08-13 10:04:07 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Return a list of database handles, one handle for each Family in
|
|
|
|
the database.
|
2004-08-13 10:04:07 +05:30
|
|
|
"""
|
2009-09-01 00:12:29 +05:30
|
|
|
raise NotImplementedError
|
2006-05-20 01:18:36 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def get_family_relation_types(self):
|
2005-05-27 23:13:04 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Return a list of all relationship types associated with Family
|
|
|
|
instances in the database.
|
2005-05-27 23:13:04 +05:30
|
|
|
"""
|
2009-09-01 00:12:29 +05:30
|
|
|
raise NotImplementedError
|
2006-05-19 06:09:22 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def get_from_handle(self, handle, class_type, data_map):
|
2007-02-20 06:09:10 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Return unserialized data from database given handle and object class
|
2007-02-20 06:09:10 +05:30
|
|
|
"""
|
2009-09-01 00:12:29 +05:30
|
|
|
raise NotImplementedError
|
2007-02-20 06:09:10 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def get_gramps_ids(self, obj_key):
|
2004-08-13 10:04:07 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Returns all the keys from a table given a table name
|
2004-08-13 10:04:07 +05:30
|
|
|
"""
|
2009-09-01 00:12:29 +05:30
|
|
|
raise NotImplementedError
|
2004-08-01 09:51:31 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def get_media_attribute_types(self):
|
2004-08-13 10:04:07 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Return a list of all Attribute types associated with Media and MediaRef
|
|
|
|
instances in the database.
|
2004-08-13 10:04:07 +05:30
|
|
|
"""
|
2009-09-01 00:12:29 +05:30
|
|
|
raise NotImplementedError
|
2004-08-11 09:12:38 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def get_media_bookmarks(self):
|
2004-08-13 10:04:07 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Return the list of Person handles in the bookmarks.
|
2004-08-13 10:04:07 +05:30
|
|
|
"""
|
2009-09-01 00:12:29 +05:30
|
|
|
raise NotImplementedError
|
2004-08-11 09:12:38 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def get_media_cursor(self):
|
2004-08-13 10:04:07 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Return a reference to a cursor over Media objects
|
2004-08-13 10:04:07 +05:30
|
|
|
"""
|
2009-09-01 00:12:29 +05:30
|
|
|
raise NotImplementedError
|
2004-08-11 09:12:38 +05:30
|
|
|
|
2011-05-20 02:06:17 +05:30
|
|
|
def get_media_object_handles(self, sort_handles=False):
|
2005-05-27 23:13:04 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Return a list of database handles, one handle for each MediaObject in
|
|
|
|
the database.
|
|
|
|
|
|
|
|
If sort_handles is True, the list is sorted by title.
|
2005-05-27 23:13:04 +05:30
|
|
|
"""
|
2009-09-01 00:12:29 +05:30
|
|
|
raise NotImplementedError
|
2005-05-27 23:13:04 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def get_mediapath(self):
|
2007-02-20 06:09:10 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Return the default media path of the database.
|
2007-02-20 06:09:10 +05:30
|
|
|
"""
|
2009-09-01 00:12:29 +05:30
|
|
|
raise NotImplementedError
|
2007-02-20 06:09:10 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def get_name_group_keys(self):
|
2009-09-01 00:12:29 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Return the defined names that have been assigned to a default grouping.
|
2009-09-01 00:12:29 +05:30
|
|
|
"""
|
|
|
|
raise NotImplementedError
|
2004-08-11 09:12:38 +05:30
|
|
|
|
2010-10-29 01:26:46 +05:30
|
|
|
def get_name_group_mapping(self, surname):
|
2005-04-18 04:04:56 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Return the default grouping name for a surname.
|
2005-04-18 04:04:56 +05:30
|
|
|
"""
|
2009-09-01 00:12:29 +05:30
|
|
|
raise NotImplementedError
|
2004-08-11 09:12:38 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def get_name_types(self):
|
2005-04-18 04:04:56 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Return a list of all custom names types associated with Person
|
|
|
|
instances in the database.
|
2005-04-18 04:04:56 +05:30
|
|
|
"""
|
2009-09-01 00:12:29 +05:30
|
|
|
raise NotImplementedError
|
2004-08-11 09:12:38 +05:30
|
|
|
|
2010-10-03 17:09:47 +05:30
|
|
|
def get_origin_types(self):
|
|
|
|
"""
|
|
|
|
Return a list of all custom origin types associated with Person/Surname
|
|
|
|
instances in the database.
|
|
|
|
"""
|
|
|
|
raise NotImplementedError
|
2004-08-11 09:12:38 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def get_note_bookmarks(self):
|
2005-04-18 04:04:56 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Return the list of Note handles in the bookmarks.
|
2005-04-18 04:04:56 +05:30
|
|
|
"""
|
2009-09-01 00:12:29 +05:30
|
|
|
raise NotImplementedError
|
2004-08-11 09:12:38 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def get_note_cursor(self):
|
2005-04-18 04:04:56 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Return a reference to a cursor over Note objects
|
2005-04-18 04:04:56 +05:30
|
|
|
"""
|
2009-09-01 00:12:29 +05:30
|
|
|
raise NotImplementedError
|
2004-08-11 09:12:38 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def get_note_from_gramps_id(self, val):
|
2005-04-18 04:04:56 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Find a Note in the database from the passed gramps' ID.
|
2004-08-11 09:12:38 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
If no such Note exists, None is returned.
|
|
|
|
Needs to be overridden by the derived classderri.
|
2005-05-27 23:13:04 +05:30
|
|
|
"""
|
2009-09-01 00:12:29 +05:30
|
|
|
raise NotImplementedError
|
2005-05-27 23:13:04 +05:30
|
|
|
|
2007-02-20 06:09:10 +05:30
|
|
|
def get_note_from_handle(self, handle):
|
|
|
|
"""
|
2008-02-23 14:08:55 +05:30
|
|
|
Find a Note in the database from the passed gramps' ID.
|
|
|
|
|
2007-02-20 06:09:10 +05:30
|
|
|
If no such Note exists, None is returned.
|
|
|
|
"""
|
2009-09-01 00:12:29 +05:30
|
|
|
raise NotImplementedError
|
2007-02-20 06:09:10 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def get_note_handles(self):
|
2004-08-20 07:50:06 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Return a list of database handles, one handle for each Note in the
|
|
|
|
database.
|
2004-08-20 07:50:06 +05:30
|
|
|
"""
|
2007-05-07 09:09:46 +05:30
|
|
|
raise NotImplementedError
|
2004-08-20 07:50:06 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def get_note_types(self):
|
2004-08-20 07:50:06 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Return a list of all custom note types associated with Note instances
|
|
|
|
in the database.
|
2004-08-20 07:50:06 +05:30
|
|
|
"""
|
2007-05-07 09:09:46 +05:30
|
|
|
raise NotImplementedError
|
2004-08-20 07:50:06 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def get_number_of_events(self):
|
2006-01-27 12:24:35 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Return the number of events currently in the database.
|
2006-01-27 12:24:35 +05:30
|
|
|
"""
|
2007-05-07 09:09:46 +05:30
|
|
|
raise NotImplementedError
|
2006-01-27 12:24:35 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def get_number_of_families(self):
|
2006-05-20 06:22:47 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Return the number of families currently in the database.
|
2004-08-24 10:39:50 +05:30
|
|
|
"""
|
2007-05-07 09:09:46 +05:30
|
|
|
raise NotImplementedError
|
2004-08-24 10:39:50 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def get_number_of_media_objects(self):
|
2006-05-20 06:22:47 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Return the number of media objects currently in the database.
|
2004-08-24 10:39:50 +05:30
|
|
|
"""
|
2007-05-07 09:09:46 +05:30
|
|
|
raise NotImplementedError
|
2004-08-24 10:39:50 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def get_number_of_notes(self):
|
2006-05-20 06:22:47 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Return the number of notes currently in the database.
|
2004-08-24 10:39:50 +05:30
|
|
|
"""
|
2007-05-07 09:09:46 +05:30
|
|
|
raise NotImplementedError
|
2004-08-24 10:39:50 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def get_number_of_people(self):
|
2006-05-20 06:22:47 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Return the number of people currently in the database.
|
2007-02-20 06:09:10 +05:30
|
|
|
"""
|
2007-05-07 09:09:46 +05:30
|
|
|
raise NotImplementedError
|
2007-02-20 06:09:10 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def get_number_of_places(self):
|
2007-02-20 06:09:10 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Return the number of places currently in the database.
|
|
|
|
"""
|
|
|
|
raise NotImplementedError
|
2005-05-27 23:13:04 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def get_number_of_repositories(self):
|
|
|
|
"""
|
|
|
|
Return the number of source repositories currently in the database.
|
2005-05-27 23:13:04 +05:30
|
|
|
"""
|
2007-05-07 09:09:46 +05:30
|
|
|
raise NotImplementedError
|
2005-05-27 23:13:04 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def get_number_of_sources(self):
|
2005-07-09 01:54:54 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Return the number of sources currently in the database.
|
2005-07-09 01:54:54 +05:30
|
|
|
"""
|
2009-09-01 00:12:29 +05:30
|
|
|
raise NotImplementedError
|
2005-07-09 01:54:54 +05:30
|
|
|
|
2010-09-21 23:22:37 +05:30
|
|
|
def get_number_of_tags(self):
|
|
|
|
"""
|
|
|
|
Return the number of tags currently in the database.
|
|
|
|
"""
|
|
|
|
raise NotImplementedError
|
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def get_object_from_gramps_id(self, val):
|
2004-08-13 10:04:07 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Find a MediaObject in the database from the passed gramps' ID.
|
|
|
|
|
|
|
|
If no such MediaObject exists, None is returned.
|
|
|
|
Needs to be overridden by the derived class.
|
2004-08-13 10:04:07 +05:30
|
|
|
"""
|
2009-09-01 00:12:29 +05:30
|
|
|
raise NotImplementedError
|
2004-08-11 09:12:38 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def get_object_from_handle(self, handle):
|
2004-08-13 10:04:07 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Find an Object in the database from the passed gramps' ID.
|
2008-02-23 14:08:55 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
If no such Object exists, None is returned.
|
2007-10-10 01:32:02 +05:30
|
|
|
"""
|
2009-09-01 00:12:29 +05:30
|
|
|
raise NotImplementedError
|
2009-12-23 21:25:58 +05:30
|
|
|
|
|
|
|
def get_person_attribute_types(self):
|
2004-08-13 10:04:07 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Return a list of all Attribute types associated with Person instances
|
|
|
|
in the database.
|
2004-08-13 10:04:07 +05:30
|
|
|
"""
|
2009-09-01 00:12:29 +05:30
|
|
|
raise NotImplementedError
|
2004-08-11 09:12:38 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def get_person_cursor(self):
|
2006-04-01 05:16:34 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Return a reference to a cursor over Person objects
|
2006-04-01 05:16:34 +05:30
|
|
|
"""
|
2009-09-01 00:12:29 +05:30
|
|
|
raise NotImplementedError
|
2006-04-01 05:16:34 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def get_person_event_types(self):
|
2004-08-13 10:04:07 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Return a list of all Event types associated with Person instances in
|
|
|
|
the database.
|
2004-08-13 10:04:07 +05:30
|
|
|
"""
|
2009-09-01 00:12:29 +05:30
|
|
|
raise NotImplementedError
|
2004-08-11 09:12:38 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def get_person_from_gramps_id(self, val):
|
2004-08-13 10:04:07 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Find a Person in the database from the passed GRAMPS ID.
|
2008-02-23 14:08:55 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
If no such Person exists, None is returned.
|
|
|
|
Needs to be overridden by the derived class.
|
2004-08-13 10:04:07 +05:30
|
|
|
"""
|
2009-09-01 00:12:29 +05:30
|
|
|
raise NotImplementedError
|
2004-08-11 09:12:38 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def get_person_from_handle(self, handle):
|
2005-05-27 23:13:04 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Find a Person in the database from the passed gramps' ID.
|
2008-02-23 14:08:55 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
If no such Person exists, None is returned.
|
2005-05-27 23:13:04 +05:30
|
|
|
"""
|
2009-09-01 00:12:29 +05:30
|
|
|
raise NotImplementedError
|
2005-05-27 23:13:04 +05:30
|
|
|
|
2011-05-20 02:06:17 +05:30
|
|
|
def get_person_handles(self, sort_handles=False):
|
2007-02-20 06:09:10 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Return a list of database handles, one handle for each Person in
|
|
|
|
the database.
|
2008-02-23 14:08:55 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
If sort_handles is True, the list is sorted by surnames.
|
2007-02-20 06:09:10 +05:30
|
|
|
"""
|
2009-09-01 00:12:29 +05:30
|
|
|
raise NotImplementedError
|
2007-02-20 06:09:10 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def get_place_bookmarks(self):
|
2004-10-01 00:02:56 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Return the list of Person handles in the bookmarks.
|
2004-10-01 00:02:56 +05:30
|
|
|
"""
|
2009-09-01 00:12:29 +05:30
|
|
|
raise NotImplementedError
|
2004-10-01 00:02:56 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def get_place_cursor(self):
|
2007-12-09 15:48:59 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Return a reference to a cursor over Place objects
|
2007-12-09 15:48:59 +05:30
|
|
|
"""
|
2009-09-01 00:12:29 +05:30
|
|
|
raise NotImplementedError
|
2007-12-09 15:48:59 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def get_place_from_gramps_id(self, val):
|
2004-10-01 00:02:56 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Find a Place in the database from the passed gramps' ID.
|
2008-02-23 14:08:55 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
If no such Place exists, None is returned.
|
|
|
|
Needs to be overridden by the derived class.
|
2004-10-01 00:02:56 +05:30
|
|
|
"""
|
2007-05-07 09:09:46 +05:30
|
|
|
raise NotImplementedError
|
2009-12-23 21:25:58 +05:30
|
|
|
|
|
|
|
def get_place_from_handle(self, handle):
|
2004-08-13 10:04:07 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Find a Place in the database from the passed gramps' ID.
|
|
|
|
|
|
|
|
If no such Place exists, None is returned.
|
2004-08-13 10:04:07 +05:30
|
|
|
"""
|
2009-09-01 00:12:29 +05:30
|
|
|
raise NotImplementedError
|
2004-08-01 09:51:31 +05:30
|
|
|
|
2011-05-20 02:06:17 +05:30
|
|
|
def get_place_handles(self, sort_handles=False):
|
2005-08-18 11:28:28 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Return a list of database handles, one handle for each Place in
|
|
|
|
the database.
|
|
|
|
|
|
|
|
If sort_handles is True, the list is sorted by Place title.
|
2005-08-18 11:28:28 +05:30
|
|
|
"""
|
2009-09-01 00:12:29 +05:30
|
|
|
raise NotImplementedError
|
2005-08-18 11:28:28 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def get_raw_event_data(self, handle):
|
2005-08-18 11:28:28 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Return raw (serialized and pickled) Event object from handle
|
2005-08-18 11:28:28 +05:30
|
|
|
"""
|
2009-09-01 00:12:29 +05:30
|
|
|
raise NotImplementedError
|
2005-08-18 11:28:28 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def get_raw_family_data(self, handle):
|
2005-08-18 11:28:28 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Return raw (serialized and pickled) Family object from handle
|
2005-08-18 11:28:28 +05:30
|
|
|
"""
|
2009-09-01 00:12:29 +05:30
|
|
|
raise NotImplementedError
|
2005-08-18 11:28:28 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def get_raw_note_data(self, handle):
|
2005-08-18 11:28:28 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Return raw (serialized and pickled) Note object from handle
|
2005-08-18 11:28:28 +05:30
|
|
|
"""
|
2009-09-01 00:12:29 +05:30
|
|
|
raise NotImplementedError
|
2005-08-18 11:28:28 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def get_raw_object_data(self, handle):
|
2005-08-18 11:28:28 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Return raw (serialized and pickled) Family object from handle
|
2005-08-18 11:28:28 +05:30
|
|
|
"""
|
2009-09-01 00:12:29 +05:30
|
|
|
raise NotImplementedError
|
2005-08-18 11:28:28 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def get_raw_person_data(self, handle):
|
2006-01-07 02:25:49 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Return raw (serialized and pickled) Person object from handle
|
2006-01-07 02:25:49 +05:30
|
|
|
"""
|
2009-09-01 00:12:29 +05:30
|
|
|
raise NotImplementedError
|
2006-01-07 02:25:49 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def get_raw_place_data(self, handle):
|
2007-02-20 06:09:10 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Return raw (serialized and pickled) Place object from handle
|
2007-02-20 06:09:10 +05:30
|
|
|
"""
|
2009-09-01 00:12:29 +05:30
|
|
|
raise NotImplementedError
|
2007-02-20 06:09:10 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def get_raw_repository_data(self, handle):
|
2004-08-13 10:04:07 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Return raw (serialized and pickled) Repository object from handle
|
2004-08-13 10:04:07 +05:30
|
|
|
"""
|
2009-09-01 00:12:29 +05:30
|
|
|
raise NotImplementedError
|
2004-08-01 09:51:31 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def get_raw_source_data(self, handle):
|
2009-06-12 21:47:07 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Return raw (serialized and pickled) Source object from handle
|
2009-06-12 21:47:07 +05:30
|
|
|
"""
|
2009-09-01 00:12:29 +05:30
|
|
|
raise NotImplementedError
|
2009-09-04 01:14:01 +05:30
|
|
|
|
2011-07-25 00:00:28 +05:30
|
|
|
def get_raw_citation_data(self, handle):
|
|
|
|
"""
|
|
|
|
Return raw (serialized and pickled) Citation object from handle
|
|
|
|
"""
|
|
|
|
raise NotImplementedError
|
|
|
|
|
2010-09-21 23:22:37 +05:30
|
|
|
def get_raw_tag_data(self, handle):
|
|
|
|
"""
|
|
|
|
Return raw (serialized and pickled) Tag object from handle
|
|
|
|
"""
|
|
|
|
raise NotImplementedError
|
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def get_reference_map_cursor(self):
|
2009-09-01 00:12:29 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Returns a reference to a cursor over the reference map
|
2009-09-01 00:12:29 +05:30
|
|
|
"""
|
|
|
|
raise NotImplementedError
|
2009-06-12 21:47:07 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def get_reference_map_primary_cursor(self):
|
2004-08-13 10:04:07 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Returns a reference to a cursor over the reference map primary map
|
2004-08-13 10:04:07 +05:30
|
|
|
"""
|
2009-09-01 00:12:29 +05:30
|
|
|
raise NotImplementedError
|
2009-09-04 01:14:01 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def get_reference_map_referenced_cursor(self):
|
2004-08-13 10:04:07 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Returns a reference to a cursor over the reference map referenced map
|
2004-08-13 10:04:07 +05:30
|
|
|
"""
|
2009-09-01 00:12:29 +05:30
|
|
|
raise NotImplementedError
|
2009-09-04 01:14:01 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def get_repo_bookmarks(self):
|
2004-08-13 10:04:07 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Return the list of Person handles in the bookmarks.
|
2004-08-13 10:04:07 +05:30
|
|
|
"""
|
2009-09-01 00:12:29 +05:30
|
|
|
raise NotImplementedError
|
2004-08-01 09:51:31 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def get_repository_cursor(self):
|
2009-06-12 21:47:07 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Return a reference to a cursor over Repository objects
|
2009-06-12 21:47:07 +05:30
|
|
|
"""
|
2009-09-01 00:12:29 +05:30
|
|
|
raise NotImplementedError
|
2004-08-01 09:51:31 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def get_repository_from_gramps_id(self, val):
|
2004-08-13 10:04:07 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Find a Repository in the database from the passed gramps' ID.
|
|
|
|
|
|
|
|
If no such Repository exists, None is returned.
|
|
|
|
Needs to be overridden by the derived class.
|
2004-08-13 10:04:07 +05:30
|
|
|
"""
|
2009-09-01 00:12:29 +05:30
|
|
|
raise NotImplementedError
|
2009-12-23 21:25:58 +05:30
|
|
|
|
|
|
|
def get_repository_from_handle(self, handle):
|
|
|
|
"""
|
|
|
|
Find a Repository in the database from the passed gramps' ID.
|
2009-06-12 21:47:07 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
If no such Repository exists, None is returned.
|
2009-06-12 21:47:07 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
raise NotImplementedError
|
|
|
|
|
|
|
|
def get_repository_handles(self):
|
|
|
|
"""
|
|
|
|
Return a list of database handles, one handle for each Repository in
|
|
|
|
the database.
|
2009-06-12 21:47:07 +05:30
|
|
|
"""
|
2009-09-04 01:14:01 +05:30
|
|
|
raise NotImplementedError
|
2009-12-23 21:25:58 +05:30
|
|
|
|
|
|
|
def get_repository_types(self):
|
2009-09-04 01:14:01 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Return a list of all custom repository types associated with Repository
|
|
|
|
instances in the database.
|
2009-09-04 01:14:01 +05:30
|
|
|
"""
|
|
|
|
raise NotImplementedError
|
2009-12-23 21:25:58 +05:30
|
|
|
|
|
|
|
def get_researcher(self):
|
2009-09-04 01:14:01 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Return the Researcher instance, providing information about the owner
|
|
|
|
of the database.
|
2009-09-04 01:14:01 +05:30
|
|
|
"""
|
|
|
|
raise NotImplementedError
|
2004-08-13 10:04:07 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def get_save_path(self):
|
2005-05-27 23:13:04 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Return the save path of the file, or "" if one does not exist.
|
2005-05-27 23:13:04 +05:30
|
|
|
"""
|
2009-09-01 00:12:29 +05:30
|
|
|
raise NotImplementedError
|
2009-12-23 21:25:58 +05:30
|
|
|
|
|
|
|
def get_source_bookmarks(self):
|
2009-06-12 21:47:07 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Return the list of Person handles in the bookmarks.
|
2009-06-12 21:47:07 +05:30
|
|
|
"""
|
2009-09-01 00:12:29 +05:30
|
|
|
raise NotImplementedError
|
2005-05-27 23:13:04 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def get_source_cursor(self):
|
2009-06-12 21:47:07 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Return a reference to a cursor over Source objects
|
2009-06-12 21:47:07 +05:30
|
|
|
"""
|
2009-09-01 00:12:29 +05:30
|
|
|
raise NotImplementedError
|
2007-02-20 06:09:10 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def get_source_from_gramps_id(self, val):
|
2009-09-04 01:14:01 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Find a Source in the database from the passed gramps' ID.
|
|
|
|
|
|
|
|
If no such Source exists, None is returned.
|
|
|
|
Needs to be overridden by the derived class.
|
2009-09-04 01:14:01 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
raise NotImplementedError
|
2009-09-04 01:14:01 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def get_source_from_handle(self, handle):
|
2009-09-04 01:14:01 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Find a Source in the database from the passed gramps' ID.
|
|
|
|
|
|
|
|
If no such Source exists, None is returned.
|
2009-09-04 01:14:01 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
raise NotImplementedError
|
2009-09-04 01:14:01 +05:30
|
|
|
|
2011-05-20 02:06:17 +05:30
|
|
|
def get_source_handles(self, sort_handles=False):
|
2009-09-04 01:14:01 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Return a list of database handles, one handle for each Source in
|
|
|
|
the database.
|
|
|
|
|
|
|
|
If sort_handles is True, the list is sorted by Source title.
|
2009-09-04 01:14:01 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
raise NotImplementedError
|
2009-09-04 01:14:01 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def get_source_media_types(self):
|
2009-09-04 01:14:01 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Return a list of all custom source media types associated with Source
|
|
|
|
instances in the database.
|
2009-09-04 01:14:01 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
raise NotImplementedError
|
2009-09-04 01:14:01 +05:30
|
|
|
|
2011-07-25 00:00:28 +05:30
|
|
|
def get_citation_bookmarks(self):
|
|
|
|
"""
|
|
|
|
Return the list of Citation handles in the bookmarks.
|
|
|
|
"""
|
|
|
|
raise NotImplementedError
|
|
|
|
|
|
|
|
def get_citation_cursor(self):
|
|
|
|
"""
|
|
|
|
Return a reference to a cursor over Citation objects
|
|
|
|
"""
|
|
|
|
raise NotImplementedError
|
|
|
|
|
|
|
|
def get_citation_from_gramps_id(self, val):
|
|
|
|
"""
|
|
|
|
Find a Citation in the database from the passed gramps' ID.
|
|
|
|
|
|
|
|
If no such Citation exists, None is returned.
|
|
|
|
Needs to be overridden by the derived class.
|
|
|
|
"""
|
|
|
|
raise NotImplementedError
|
|
|
|
|
|
|
|
def get_citation_from_handle(self, handle):
|
|
|
|
"""
|
|
|
|
Find a Citation in the database from the passed gramps' ID.
|
|
|
|
|
|
|
|
If no such Citation exists, None is returned.
|
|
|
|
"""
|
|
|
|
raise NotImplementedError
|
|
|
|
|
|
|
|
def get_citation_handles(self, sort_handles=False):
|
|
|
|
"""
|
|
|
|
Return a list of database handles, one handle for each Citation in
|
|
|
|
the database.
|
|
|
|
|
|
|
|
If sort_handles is True, the list is sorted by Citation title.
|
|
|
|
"""
|
|
|
|
raise NotImplementedError
|
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def get_surname_list(self):
|
2009-09-04 01:14:01 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Return the list of locale-sorted surnames contained in the database.
|
2009-09-04 01:14:01 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
raise NotImplementedError
|
2009-09-04 01:14:01 +05:30
|
|
|
|
2010-09-21 23:22:37 +05:30
|
|
|
def get_tag_cursor(self):
|
2009-09-04 01:14:01 +05:30
|
|
|
"""
|
2010-09-21 23:22:37 +05:30
|
|
|
Return a reference to a cursor over Tag objects
|
2009-09-04 01:14:01 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
raise NotImplementedError
|
2009-09-04 01:14:01 +05:30
|
|
|
|
2010-09-21 23:22:37 +05:30
|
|
|
def get_tag_from_handle(self, handle):
|
2009-09-04 01:14:01 +05:30
|
|
|
"""
|
2010-09-21 23:22:37 +05:30
|
|
|
Find a Tag in the database from the passed handle.
|
|
|
|
|
|
|
|
If no such Tag exists, None is returned.
|
2009-09-04 01:14:01 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
raise NotImplementedError
|
2009-09-04 01:14:01 +05:30
|
|
|
|
2010-09-21 23:22:37 +05:30
|
|
|
def get_tag_from_name(self, val):
|
2009-09-04 01:14:01 +05:30
|
|
|
"""
|
2010-09-21 23:22:37 +05:30
|
|
|
Find a Tag in the database from the passed Tag name.
|
|
|
|
|
|
|
|
If no such Tag exists, None is returned.
|
|
|
|
Needs to be overridden by the derived class.
|
2009-09-04 01:14:01 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
raise NotImplementedError
|
2009-09-04 01:14:01 +05:30
|
|
|
|
2011-05-20 02:06:17 +05:30
|
|
|
def get_tag_handles(self, sort_handles=False):
|
2009-09-01 00:12:29 +05:30
|
|
|
"""
|
2010-09-21 23:22:37 +05:30
|
|
|
Return a list of database handles, one handle for each Tag in
|
|
|
|
the database.
|
|
|
|
|
|
|
|
If sort_handles is True, the list is sorted by Tag name.
|
2009-09-01 00:12:29 +05:30
|
|
|
"""
|
|
|
|
raise NotImplementedError
|
2009-12-23 21:25:58 +05:30
|
|
|
|
2010-09-21 23:22:37 +05:30
|
|
|
def get_url_types(self):
|
2009-09-01 00:12:29 +05:30
|
|
|
"""
|
2010-09-21 23:22:37 +05:30
|
|
|
Return a list of all custom names types associated with Url instances
|
|
|
|
in the database.
|
2009-09-01 00:12:29 +05:30
|
|
|
"""
|
|
|
|
raise NotImplementedError
|
2006-01-31 07:11:55 +05:30
|
|
|
|
2010-09-21 23:22:37 +05:30
|
|
|
def gramps_upgrade(self):
|
2009-09-01 00:12:29 +05:30
|
|
|
"""
|
2010-09-21 23:22:37 +05:30
|
|
|
Return True if database is upgraded
|
2009-09-01 00:12:29 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
raise NotImplementedError
|
2009-09-01 00:12:29 +05:30
|
|
|
|
2010-09-21 23:22:37 +05:30
|
|
|
def has_event_handle(self, handle):
|
2010-08-30 00:06:42 +05:30
|
|
|
"""
|
2010-09-21 23:22:37 +05:30
|
|
|
Return True if the handle exists in the current Event database.
|
2010-08-30 00:06:42 +05:30
|
|
|
"""
|
|
|
|
raise NotImplementedError
|
|
|
|
|
2010-09-21 23:22:37 +05:30
|
|
|
def has_family_handle(self, handle):
|
2010-08-30 00:06:42 +05:30
|
|
|
"""
|
2010-09-21 23:22:37 +05:30
|
|
|
Return True if the handle exists in the current Family database.
|
2010-08-30 00:06:42 +05:30
|
|
|
"""
|
|
|
|
raise NotImplementedError
|
|
|
|
|
2010-09-21 23:22:37 +05:30
|
|
|
def has_gramps_id(self, obj_key, gramps_id):
|
2010-08-30 00:06:42 +05:30
|
|
|
"""
|
2010-09-21 23:22:37 +05:30
|
|
|
Returns True if the key exists in table given a table name
|
|
|
|
|
|
|
|
Not used in current codebase
|
2010-08-30 00:06:42 +05:30
|
|
|
"""
|
|
|
|
raise NotImplementedError
|
|
|
|
|
2010-09-21 23:22:37 +05:30
|
|
|
def has_name_group_key(self, name):
|
2010-08-30 00:06:42 +05:30
|
|
|
"""
|
2010-09-21 23:22:37 +05:30
|
|
|
Return if a key exists in the name_group table.
|
2010-08-30 00:06:42 +05:30
|
|
|
"""
|
|
|
|
raise NotImplementedError
|
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def has_note_handle(self, handle):
|
2004-08-13 10:04:07 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Return True if the handle exists in the current Note database.
|
2004-08-13 10:04:07 +05:30
|
|
|
"""
|
2009-09-01 00:12:29 +05:30
|
|
|
raise NotImplementedError
|
2009-12-23 21:25:58 +05:30
|
|
|
|
|
|
|
def has_object_handle(self, handle):
|
2004-08-13 10:04:07 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Return True if the handle exists in the current MediaObjectdatabase.
|
2004-08-13 10:04:07 +05:30
|
|
|
"""
|
2009-09-01 00:12:29 +05:30
|
|
|
raise NotImplementedError
|
2004-08-01 09:51:31 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def has_person_handle(self, handle):
|
2004-08-13 10:04:07 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Return True if the handle exists in the current Person database.
|
2004-08-13 10:04:07 +05:30
|
|
|
"""
|
2009-09-01 00:12:29 +05:30
|
|
|
raise NotImplementedError
|
2004-08-01 09:51:31 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def has_place_handle(self, handle):
|
2004-08-13 10:04:07 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Return True if the handle exists in the current Place database.
|
2004-08-13 10:04:07 +05:30
|
|
|
"""
|
2009-09-01 00:12:29 +05:30
|
|
|
raise NotImplementedError
|
2004-08-01 09:51:31 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def has_repository_handle(self, handle):
|
2004-08-13 10:04:07 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Return True if the handle exists in the current Repository database.
|
2004-08-13 10:04:07 +05:30
|
|
|
"""
|
2009-09-01 00:12:29 +05:30
|
|
|
raise NotImplementedError
|
2005-05-27 23:13:04 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def has_source_handle(self, handle):
|
2005-05-27 23:13:04 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Return True if the handle exists in the current Source database.
|
2005-05-27 23:13:04 +05:30
|
|
|
"""
|
2009-09-01 00:12:29 +05:30
|
|
|
raise NotImplementedError
|
2006-10-29 10:06:08 +05:30
|
|
|
|
2010-09-21 23:22:37 +05:30
|
|
|
def has_tag_handle(self, handle):
|
|
|
|
"""
|
|
|
|
Return True if the handle exists in the current Tag database.
|
|
|
|
"""
|
|
|
|
raise NotImplementedError
|
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def is_open(self):
|
2007-02-20 06:09:10 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Return True if the database has been opened.
|
2007-02-20 06:09:10 +05:30
|
|
|
"""
|
2009-09-01 00:12:29 +05:30
|
|
|
raise NotImplementedError
|
2007-02-20 06:09:10 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def iter_event_handles(self):
|
2004-08-13 10:04:07 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Return an iterator over handles for Events in the database
|
2004-08-13 10:04:07 +05:30
|
|
|
"""
|
2009-09-01 00:12:29 +05:30
|
|
|
raise NotImplementedError
|
2004-08-01 09:51:31 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def iter_events(self):
|
2004-08-13 10:04:07 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Return an iterator over objects for Events in the database
|
2004-08-13 10:04:07 +05:30
|
|
|
"""
|
2009-09-01 00:12:29 +05:30
|
|
|
raise NotImplementedError
|
2006-01-13 03:32:58 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def iter_families(self):
|
2004-08-13 10:04:07 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Return an iterator over objects for Families in the database
|
2004-08-13 10:04:07 +05:30
|
|
|
"""
|
2009-09-01 00:12:29 +05:30
|
|
|
raise NotImplementedError
|
2004-08-13 10:04:07 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def iter_family_handles(self):
|
2004-08-13 10:04:07 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Return an iterator over handles for Families in the database
|
2004-08-13 10:04:07 +05:30
|
|
|
"""
|
2009-09-01 00:12:29 +05:30
|
|
|
raise NotImplementedError
|
2004-08-13 10:04:07 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def iter_media_object_handles(self):
|
2004-08-13 10:04:07 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Return an iterator over handles for Media in the database
|
2007-01-19 22:23:49 +05:30
|
|
|
"""
|
2009-09-01 00:12:29 +05:30
|
|
|
raise NotImplementedError
|
2007-01-19 22:23:49 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def iter_media_objects(self):
|
2007-01-19 22:23:49 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Return an iterator over objects for MediaObjects in the database
|
2007-01-19 22:23:49 +05:30
|
|
|
"""
|
2007-05-07 09:09:46 +05:30
|
|
|
raise NotImplementedError
|
2007-01-19 22:23:49 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def iter_note_handles(self):
|
2009-09-01 00:12:29 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Return an iterator over handles for Notes in the database
|
2009-09-01 00:12:29 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
raise NotImplementedError
|
2007-01-19 22:23:49 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def iter_notes(self):
|
2009-09-01 00:12:29 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Return an iterator over objects for Notes in the database
|
2009-09-01 00:12:29 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
raise NotImplementedError
|
2007-01-19 22:23:49 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def iter_people(self):
|
2007-01-19 22:23:49 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Return an iterator over objects for Persons in the database
|
2004-08-13 10:04:07 +05:30
|
|
|
"""
|
2007-05-07 09:09:46 +05:30
|
|
|
raise NotImplementedError
|
2004-08-13 10:04:07 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def iter_person_handles(self):
|
|
|
|
"""
|
|
|
|
Return an iterator over handles for Persons in the database
|
|
|
|
"""
|
2009-09-01 00:12:29 +05:30
|
|
|
raise NotImplementedError
|
2004-08-01 09:51:31 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def iter_place_handles(self):
|
|
|
|
"""
|
|
|
|
Return an iterator over handles for Places in the database
|
|
|
|
"""
|
2009-09-01 00:12:29 +05:30
|
|
|
raise NotImplementedError
|
2006-04-27 03:18:13 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def iter_places(self):
|
|
|
|
"""
|
|
|
|
Return an iterator over objects for Places in the database
|
|
|
|
"""
|
2009-09-01 00:12:29 +05:30
|
|
|
raise NotImplementedError
|
2006-04-27 03:18:13 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def iter_repositories(self):
|
|
|
|
"""
|
|
|
|
Return an iterator over objects for Repositories in the database
|
|
|
|
"""
|
2009-09-01 00:12:29 +05:30
|
|
|
raise NotImplementedError
|
2006-04-27 03:18:13 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def iter_repository_handles(self):
|
|
|
|
"""
|
|
|
|
Return an iterator over handles for Repositories in the database
|
|
|
|
"""
|
2009-09-01 00:12:29 +05:30
|
|
|
raise NotImplementedError
|
2006-04-27 03:18:13 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def iter_source_handles(self):
|
|
|
|
"""
|
|
|
|
Return an iterator over handles for Sources in the database
|
|
|
|
"""
|
2009-09-01 00:12:29 +05:30
|
|
|
raise NotImplementedError
|
2006-04-27 03:18:13 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def iter_sources(self):
|
|
|
|
"""
|
|
|
|
Return an iterator over objects for Sources in the database
|
|
|
|
"""
|
2009-09-01 00:12:29 +05:30
|
|
|
raise NotImplementedError
|
2006-04-27 03:18:13 +05:30
|
|
|
|
2010-09-21 23:22:37 +05:30
|
|
|
def iter_tag_handles(self):
|
|
|
|
"""
|
|
|
|
Return an iterator over handles for Tags in the database
|
|
|
|
"""
|
|
|
|
raise NotImplementedError
|
|
|
|
|
|
|
|
def iter_tags(self):
|
|
|
|
"""
|
|
|
|
Return an iterator over objects for Tags in the database
|
|
|
|
"""
|
|
|
|
raise NotImplementedError
|
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def load(self, name, callback, mode=None, upgrade=False):
|
|
|
|
"""
|
|
|
|
Open the specified database.
|
|
|
|
"""
|
2009-09-01 00:12:29 +05:30
|
|
|
raise NotImplementedError
|
2007-02-20 06:09:10 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def report_bm_change(self):
|
|
|
|
"""
|
|
|
|
Add 1 to the number of bookmark changes during this session.
|
|
|
|
"""
|
2009-09-01 00:12:29 +05:30
|
|
|
raise NotImplementedError
|
2004-08-01 09:51:31 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def request_rebuild(self):
|
2008-02-23 14:08:55 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Notify clients that the data has changed significantly, and that all
|
|
|
|
internal data dependent on the database should be rebuilt.
|
|
|
|
Note that all rebuild signals on all objects are emitted at the same
|
|
|
|
time. It is correct to assume that this is always the case.
|
|
|
|
TODO: it might be better to replace these rebuild signals by one single
|
|
|
|
database-rebuild signal.
|
2008-02-23 14:08:55 +05:30
|
|
|
"""
|
2009-09-01 00:12:29 +05:30
|
|
|
raise NotImplementedError
|
2004-08-01 09:51:31 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def version_supported(self):
|
|
|
|
"""
|
|
|
|
Return True when the file has a supported version.
|
|
|
|
"""
|
2009-09-01 00:12:29 +05:30
|
|
|
raise NotImplementedError
|
2004-08-01 09:51:31 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def set_event_id_prefix(self, val):
|
|
|
|
"""
|
|
|
|
Set the naming template for GRAMPS Event ID values.
|
|
|
|
|
|
|
|
The string is expected to be in the form of a simple text string, or
|
|
|
|
in a format that contains a C/Python style format string using %d,
|
|
|
|
such as E%d or E%04d.
|
|
|
|
"""
|
2009-09-01 00:12:29 +05:30
|
|
|
raise NotImplementedError
|
2004-08-01 09:51:31 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def set_family_id_prefix(self, val):
|
|
|
|
"""
|
|
|
|
Set the naming template for GRAMPS Family ID values. The string is
|
|
|
|
expected to be in the form of a simple text string, or in a format
|
|
|
|
that contains a C/Python style format string using %d, such as F%d
|
|
|
|
or F%04d.
|
|
|
|
"""
|
2009-09-01 00:12:29 +05:30
|
|
|
raise NotImplementedError
|
2006-05-09 09:45:04 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def set_note_id_prefix(self, val):
|
|
|
|
"""
|
|
|
|
Set the naming template for GRAMPS Note ID values.
|
|
|
|
|
|
|
|
The string is expected to be in the form of a simple text string, or
|
|
|
|
in a format that contains a C/Python style format string using %d,
|
|
|
|
such as N%d or N%04d.
|
|
|
|
"""
|
2009-09-01 00:12:29 +05:30
|
|
|
raise NotImplementedError
|
2004-08-01 09:51:31 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def set_object_id_prefix(self, val):
|
|
|
|
"""
|
|
|
|
Set the naming template for GRAMPS MediaObject ID values.
|
|
|
|
|
|
|
|
The string is expected to be in the form of a simple text string, or
|
|
|
|
in a format that contains a C/Python style format string using %d,
|
|
|
|
such as O%d or O%04d.
|
|
|
|
"""
|
2009-09-01 00:12:29 +05:30
|
|
|
raise NotImplementedError
|
2004-08-01 09:51:31 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def set_person_id_prefix(self, val):
|
2008-02-23 14:08:55 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Set the naming template for GRAMPS Person ID values.
|
|
|
|
|
|
|
|
The string is expected to be in the form of a simple text string, or
|
|
|
|
in a format that contains a C/Python style format string using %d,
|
|
|
|
such as I%d or I%04d.
|
2008-02-23 14:08:55 +05:30
|
|
|
"""
|
2009-09-01 00:12:29 +05:30
|
|
|
raise NotImplementedError
|
2009-12-23 21:25:58 +05:30
|
|
|
|
|
|
|
def set_place_id_prefix(self, val):
|
2008-02-23 14:08:55 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Set the naming template for GRAMPS Place ID values.
|
|
|
|
|
|
|
|
The string is expected to be in the form of a simple text string, or
|
|
|
|
in a format that contains a C/Python style format string using %d,
|
|
|
|
such as P%d or P%04d.
|
2008-02-23 14:08:55 +05:30
|
|
|
"""
|
2009-09-01 00:12:29 +05:30
|
|
|
raise NotImplementedError
|
2009-12-23 21:25:58 +05:30
|
|
|
|
2011-03-25 03:08:04 +05:30
|
|
|
def set_prefixes(self, person, media, family, source, place, event,
|
|
|
|
repository, note):
|
2008-02-23 14:08:55 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Set the prefixes for the gramps ids for all gramps objects
|
2008-02-23 14:08:55 +05:30
|
|
|
"""
|
2009-09-01 00:12:29 +05:30
|
|
|
raise NotImplementedError
|
2009-12-23 21:25:58 +05:30
|
|
|
|
|
|
|
def set_repository_id_prefix(self, val):
|
2008-02-23 14:08:55 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Set the naming template for GRAMPS Repository ID values.
|
|
|
|
|
|
|
|
The string is expected to be in the form of a simple text string, or
|
|
|
|
in a format that contains a C/Python style format string using %d,
|
|
|
|
such as R%d or R%04d.
|
2008-02-23 14:08:55 +05:30
|
|
|
"""
|
2009-09-01 00:12:29 +05:30
|
|
|
raise NotImplementedError
|
2009-12-23 21:25:58 +05:30
|
|
|
|
|
|
|
def set_source_id_prefix(self, val):
|
|
|
|
"""
|
|
|
|
Set the naming template for GRAMPS Source ID values.
|
2009-09-01 00:12:29 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
The string is expected to be in the form of a simple text string, or
|
|
|
|
in a format that contains a C/Python style format string using %d,
|
|
|
|
such as S%d or S%04d.
|
2008-02-23 14:08:55 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
raise NotImplementedError
|
|
|
|
|
|
|
|
def set_mediapath(self, path):
|
2009-09-01 00:12:29 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Set the default media path for database, path should be utf-8.
|
2009-09-01 00:12:29 +05:30
|
|
|
"""
|
|
|
|
raise NotImplementedError
|
2004-08-13 10:04:07 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def set_redo_callback(self, callback):
|
2004-08-13 10:04:07 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Define the callback function that is called whenever an redo operation
|
|
|
|
is executed.
|
2008-02-23 14:08:55 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
The callback function receives a single argument that is a text string
|
|
|
|
that defines the operation.
|
2004-08-13 10:04:07 +05:30
|
|
|
"""
|
2009-09-01 00:12:29 +05:30
|
|
|
raise NotImplementedError
|
2004-08-13 10:04:07 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def set_researcher(self, owner):
|
2004-08-13 10:04:07 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Set the information about the owner of the database.
|
2004-08-13 10:04:07 +05:30
|
|
|
"""
|
2009-09-01 00:12:29 +05:30
|
|
|
raise NotImplementedError
|
2004-08-01 09:51:31 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def set_save_path(self, path):
|
2004-08-13 10:04:07 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Set the save path for the database.
|
2004-08-13 10:04:07 +05:30
|
|
|
"""
|
2009-09-01 00:12:29 +05:30
|
|
|
raise NotImplementedError
|
2004-08-11 09:12:38 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def set_undo_callback(self, callback):
|
2004-08-13 10:04:07 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Define the callback function that is called whenever an undo operation
|
|
|
|
is executed.
|
2008-02-23 14:08:55 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
The callback function receives a single argument that is a text string
|
|
|
|
that defines the operation.
|
2004-08-13 10:04:07 +05:30
|
|
|
"""
|
2009-09-01 00:12:29 +05:30
|
|
|
raise NotImplementedError
|
2004-08-13 10:04:07 +05:30
|
|
|
|
2010-08-22 01:50:34 +05:30
|
|
|
def get_dbid(self):
|
|
|
|
"""
|
|
|
|
A unique ID for this database on this computer.
|
|
|
|
"""
|
|
|
|
raise NotImplementedError
|
|
|
|
|
|
|
|
def get_dbname(self):
|
|
|
|
"""
|
|
|
|
A name for this database on this computer.
|
|
|
|
"""
|
|
|
|
raise NotImplementedError
|
|
|
|
|
2011-03-25 03:08:04 +05:30
|
|
|
class DbWriteBase(DbReadBase):
|
2009-12-23 21:25:58 +05:30
|
|
|
"""
|
|
|
|
GRAMPS database object. This object is a base class for all
|
|
|
|
database interfaces. All methods raise NotImplementedError
|
|
|
|
and must be implemented in the derived class as required.
|
|
|
|
"""
|
|
|
|
|
|
|
|
def __init__(self):
|
2004-12-03 07:19:09 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Create a new DbWriteBase instance.
|
2008-02-23 14:08:55 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
A new DbWriteBase class should never be directly created. Only classes
|
|
|
|
derived from this class should be created.
|
2004-12-03 07:19:09 +05:30
|
|
|
"""
|
2011-03-25 03:08:04 +05:30
|
|
|
DbReadBase.__init__(self)
|
2004-12-03 07:19:09 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def add_event(self, event, transaction, set_gid=True):
|
2005-05-27 23:13:04 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Add an Event to the database, assigning internal IDs if they have
|
|
|
|
not already been defined.
|
2008-02-23 14:08:55 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
If not set_gid, then gramps_id is not set.
|
2005-05-27 23:13:04 +05:30
|
|
|
"""
|
2009-09-01 00:12:29 +05:30
|
|
|
raise NotImplementedError
|
2005-05-27 23:13:04 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def add_family(self, family, transaction, set_gid=True):
|
2007-02-20 06:09:10 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Add a Family to the database, assigning internal IDs if they have
|
|
|
|
not already been defined.
|
2008-02-23 14:08:55 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
If not set_gid, then gramps_id is not set.
|
2007-02-20 06:09:10 +05:30
|
|
|
"""
|
2009-09-01 00:12:29 +05:30
|
|
|
raise NotImplementedError
|
2007-02-20 06:09:10 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def add_family_event(self, event, transaction):
|
2009-09-01 00:12:29 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Add an Event to the database, assigning internal IDs if they have
|
|
|
|
not already been defined.
|
2009-09-01 00:12:29 +05:30
|
|
|
"""
|
|
|
|
raise NotImplementedError
|
2006-01-07 03:38:40 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def add_note(self, obj, transaction, set_gid=True):
|
2009-09-01 00:12:29 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Add a Note to the database, assigning internal IDs if they have
|
|
|
|
not already been defined.
|
|
|
|
|
|
|
|
If not set_gid, then gramps_id is not set.
|
2009-09-01 00:12:29 +05:30
|
|
|
"""
|
|
|
|
raise NotImplementedError
|
2006-01-07 03:38:40 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def add_object(self, obj, transaction, set_gid=True):
|
2009-09-01 00:12:29 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Add a MediaObject to the database, assigning internal IDs if they have
|
|
|
|
not already been defined.
|
|
|
|
|
|
|
|
If not set_gid, then gramps_id is not set.
|
2009-09-01 00:12:29 +05:30
|
|
|
"""
|
|
|
|
raise NotImplementedError
|
2006-01-07 03:38:40 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def add_person(self, person, transaction, set_gid=True):
|
2009-09-01 00:12:29 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Add a Person to the database, assigning internal IDs if they have
|
|
|
|
not already been defined.
|
|
|
|
|
|
|
|
If not set_gid, then gramps_id is not set.
|
2009-09-01 00:12:29 +05:30
|
|
|
"""
|
|
|
|
raise NotImplementedError
|
2006-01-07 03:38:40 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def add_person_event(self, event, transaction):
|
2009-09-01 00:12:29 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Add an Event to the database, assigning internal IDs if they have
|
|
|
|
not already been defined.
|
2009-09-01 00:12:29 +05:30
|
|
|
"""
|
|
|
|
raise NotImplementedError
|
2006-01-07 03:38:40 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def add_place(self, place, transaction, set_gid=True):
|
2009-09-01 00:12:29 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Add a Place to the database, assigning internal IDs if they have
|
|
|
|
not already been defined.
|
|
|
|
|
|
|
|
If not set_gid, then gramps_id is not set.
|
|
|
|
"""
|
|
|
|
raise NotImplementedError
|
|
|
|
|
|
|
|
def add_repository(self, obj, transaction, set_gid=True):
|
|
|
|
"""
|
|
|
|
Add a Repository to the database, assigning internal IDs if they have
|
|
|
|
not already been defined.
|
|
|
|
|
|
|
|
If not set_gid, then gramps_id is not set.
|
2009-09-01 00:12:29 +05:30
|
|
|
"""
|
|
|
|
raise NotImplementedError
|
2006-01-07 03:38:40 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def add_source(self, source, transaction, set_gid=True):
|
2009-09-01 00:12:29 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Add a Source to the database, assigning internal IDs if they have
|
|
|
|
not already been defined.
|
|
|
|
|
|
|
|
If not set_gid, then gramps_id is not set.
|
2009-09-01 00:12:29 +05:30
|
|
|
"""
|
|
|
|
raise NotImplementedError
|
2006-01-07 03:38:40 +05:30
|
|
|
|
2010-09-21 23:22:37 +05:30
|
|
|
def add_tag(self, tag, transaction):
|
|
|
|
"""
|
|
|
|
Add a Tag to the database, assigning a handle if it has not already
|
|
|
|
been defined.
|
|
|
|
"""
|
|
|
|
raise NotImplementedError
|
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def add_to_surname_list(self, person, batch_transaction, name):
|
2009-09-01 00:12:29 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Add surname from given person to list of surnames
|
2009-09-01 00:12:29 +05:30
|
|
|
"""
|
|
|
|
raise NotImplementedError
|
2007-02-20 06:09:10 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def build_surname_list(self):
|
2004-08-13 10:04:07 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Build the list of locale-sorted surnames contained in the database.
|
2004-08-13 10:04:07 +05:30
|
|
|
"""
|
2009-09-01 00:12:29 +05:30
|
|
|
raise NotImplementedError
|
2004-08-13 10:04:07 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def commit_base(self, obj, data_map, key, transaction, change_time):
|
2006-01-07 03:38:40 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Commit the specified object to the database, storing the changes as
|
|
|
|
part of the transaction.
|
2006-01-07 03:38:40 +05:30
|
|
|
"""
|
2009-09-01 00:12:29 +05:30
|
|
|
raise NotImplementedError
|
2006-01-07 03:38:40 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def commit_event(self, event, transaction, change_time=None):
|
2006-01-07 03:38:40 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Commit the specified Event to the database, storing the changes as
|
|
|
|
part of the transaction.
|
2006-01-07 03:38:40 +05:30
|
|
|
"""
|
2009-09-01 00:12:29 +05:30
|
|
|
raise NotImplementedError
|
2006-01-07 03:38:40 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def commit_family(self, family, transaction, change_time=None):
|
2006-01-07 03:38:40 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Commit the specified Family to the database, storing the changes as
|
|
|
|
part of the transaction.
|
2006-01-07 03:38:40 +05:30
|
|
|
"""
|
2009-09-01 00:12:29 +05:30
|
|
|
raise NotImplementedError
|
2006-01-07 03:38:40 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def commit_family_event(self, event, transaction, change_time=None):
|
2004-08-13 10:04:07 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Commit the specified family Event to the database, storing the
|
|
|
|
changes as part of the transaction.
|
2004-08-13 10:04:07 +05:30
|
|
|
"""
|
2009-09-01 00:12:29 +05:30
|
|
|
raise NotImplementedError
|
2004-08-11 09:12:38 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def commit_media_object(self, obj, transaction, change_time=None):
|
2004-08-13 10:04:07 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Commit the specified MediaObject to the database, storing the changes
|
|
|
|
as part of the transaction.
|
2004-08-13 10:04:07 +05:30
|
|
|
"""
|
2009-09-01 00:12:29 +05:30
|
|
|
raise NotImplementedError
|
2004-08-01 09:51:31 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def commit_note(self, note, transaction, change_time=None):
|
2005-05-27 23:13:04 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Commit the specified Note to the database, storing the changes as part
|
|
|
|
of the transaction.
|
2005-05-27 23:13:04 +05:30
|
|
|
"""
|
2009-09-01 00:12:29 +05:30
|
|
|
raise NotImplementedError
|
2005-05-27 23:13:04 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def commit_person(self, person, transaction, change_time=None):
|
2007-02-20 06:09:10 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Commit the specified Person to the database, storing the changes as
|
|
|
|
part of the transaction.
|
2007-02-20 06:09:10 +05:30
|
|
|
"""
|
2009-09-01 00:12:29 +05:30
|
|
|
raise NotImplementedError
|
2009-06-12 21:47:07 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def commit_personal_event(self, event, transaction, change_time=None):
|
2009-09-04 01:14:01 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Commit the specified personal Event to the database, storing the
|
|
|
|
changes as part of the transaction.
|
2009-09-04 01:14:01 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
raise NotImplementedError
|
2009-09-04 01:14:01 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def commit_place(self, place, transaction, change_time=None):
|
2004-08-13 10:04:07 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Commit the specified Place to the database, storing the changes as
|
|
|
|
part of the transaction.
|
2004-08-13 10:04:07 +05:30
|
|
|
"""
|
2009-09-01 00:12:29 +05:30
|
|
|
raise NotImplementedError
|
2004-08-01 09:51:31 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def commit_repository(self, repository, transaction, change_time=None):
|
2006-01-08 11:14:19 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Commit the specified Repository to the database, storing the changes
|
|
|
|
as part of the transaction.
|
2006-01-08 11:14:19 +05:30
|
|
|
"""
|
2009-09-01 00:12:29 +05:30
|
|
|
raise NotImplementedError
|
2006-01-08 11:14:19 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def commit_source(self, source, transaction, change_time=None):
|
2004-11-19 01:51:06 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Commit the specified Source to the database, storing the changes as
|
|
|
|
part of the transaction.
|
2004-11-19 01:51:06 +05:30
|
|
|
"""
|
2009-09-01 00:12:29 +05:30
|
|
|
raise NotImplementedError
|
2004-11-19 01:51:06 +05:30
|
|
|
|
2010-09-21 23:22:37 +05:30
|
|
|
def commit_tag(self, tag, transaction, change_time=None):
|
|
|
|
"""
|
|
|
|
Commit the specified Tag to the database, storing the changes as
|
|
|
|
part of the transaction.
|
|
|
|
"""
|
|
|
|
raise NotImplementedError
|
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def delete_primary_from_reference_map(self, handle, transaction):
|
2004-08-13 10:04:07 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Called each time an object is removed from the database.
|
|
|
|
|
|
|
|
This can be used by subclasses to update any additional index tables
|
|
|
|
that might need to be changed.
|
2004-08-13 10:04:07 +05:30
|
|
|
"""
|
2009-09-01 00:12:29 +05:30
|
|
|
raise NotImplementedError
|
2004-08-01 09:51:31 +05:30
|
|
|
|
2011-02-20 16:22:06 +05:30
|
|
|
def get_undodb(self):
|
|
|
|
"""
|
|
|
|
Return the database that keeps track of Undo/Redo operations.
|
|
|
|
"""
|
|
|
|
raise NotImplementedError
|
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def need_upgrade(self):
|
2004-08-13 10:04:07 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Return True if database needs to be upgraded
|
2004-08-13 10:04:07 +05:30
|
|
|
"""
|
2009-09-01 00:12:29 +05:30
|
|
|
raise NotImplementedError
|
2004-08-01 09:51:31 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def rebuild_secondary(self, callback):
|
2004-08-13 10:04:07 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Rebuild secondary indices
|
2004-08-13 10:04:07 +05:30
|
|
|
"""
|
2009-09-01 00:12:29 +05:30
|
|
|
raise NotImplementedError
|
2004-08-01 09:51:31 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def reindex_reference_map(self, callback):
|
2005-06-08 21:05:31 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Reindex all primary records in the database.
|
2005-06-08 21:05:31 +05:30
|
|
|
"""
|
2009-09-01 00:12:29 +05:30
|
|
|
raise NotImplementedError
|
2005-06-08 21:05:31 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def remove_event(self, handle, transaction):
|
2005-05-27 23:13:04 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Remove the Event specified by the database handle from the
|
|
|
|
database, preserving the change in the passed transaction.
|
|
|
|
|
|
|
|
This method must be overridden in the derived class.
|
2005-05-27 23:13:04 +05:30
|
|
|
"""
|
2009-09-01 00:12:29 +05:30
|
|
|
raise NotImplementedError
|
2005-05-27 23:13:04 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def remove_family(self, handle, transaction):
|
2007-02-20 06:09:10 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Remove the Family specified by the database handle from the
|
|
|
|
database, preserving the change in the passed transaction.
|
|
|
|
|
|
|
|
This method must be overridden in the derived class.
|
2007-02-20 06:09:10 +05:30
|
|
|
"""
|
2009-09-01 00:12:29 +05:30
|
|
|
raise NotImplementedError
|
2004-08-01 09:51:31 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def remove_from_surname_list(self, person):
|
2005-04-18 04:04:56 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Check whether there are persons with the same surname left in
|
|
|
|
the database.
|
|
|
|
|
|
|
|
If not then we need to remove the name from the list.
|
|
|
|
The function must be overridden in the derived class.
|
2005-04-18 04:04:56 +05:30
|
|
|
"""
|
2009-09-01 00:12:29 +05:30
|
|
|
raise NotImplementedError
|
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def remove_note(self, handle, transaction):
|
2006-01-08 11:14:19 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Remove the Note specified by the database handle from the
|
|
|
|
database, preserving the change in the passed transaction.
|
|
|
|
|
|
|
|
This method must be overridden in the derived class.
|
2006-01-08 11:14:19 +05:30
|
|
|
"""
|
2009-09-01 00:12:29 +05:30
|
|
|
raise NotImplementedError
|
2006-01-08 11:14:19 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def remove_object(self, handle, transaction):
|
2004-11-19 01:51:06 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Remove the MediaObjectPerson specified by the database handle from the
|
|
|
|
database, preserving the change in the passed transaction.
|
|
|
|
|
|
|
|
This method must be overridden in the derived class.
|
2004-11-19 01:51:06 +05:30
|
|
|
"""
|
2009-09-01 00:12:29 +05:30
|
|
|
raise NotImplementedError
|
2004-11-19 01:51:06 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def remove_person(self, handle, transaction):
|
2004-08-13 10:04:07 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Remove the Person specified by the database handle from the database,
|
|
|
|
preserving the change in the passed transaction.
|
|
|
|
|
|
|
|
This method must be overridden in the derived class.
|
2004-08-13 10:04:07 +05:30
|
|
|
"""
|
2009-09-01 00:12:29 +05:30
|
|
|
raise NotImplementedError
|
2004-08-01 09:51:31 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def remove_place(self, handle, transaction):
|
2004-08-13 10:04:07 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Remove the Place specified by the database handle from the
|
|
|
|
database, preserving the change in the passed transaction.
|
|
|
|
|
|
|
|
This method must be overridden in the derived class.
|
2004-08-13 10:04:07 +05:30
|
|
|
"""
|
2009-09-01 00:12:29 +05:30
|
|
|
raise NotImplementedError
|
2004-08-01 09:51:31 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def remove_repository(self, handle, transaction):
|
2004-08-13 10:04:07 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Remove the Repository specified by the database handle from the
|
|
|
|
database, preserving the change in the passed transaction.
|
|
|
|
|
|
|
|
This method must be overridden in the derived class.
|
2004-08-13 10:04:07 +05:30
|
|
|
"""
|
2009-09-01 00:12:29 +05:30
|
|
|
raise NotImplementedError
|
2004-10-23 09:26:48 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def remove_source(self, handle, transaction):
|
2005-06-07 10:38:50 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Remove the Source specified by the database handle from the
|
|
|
|
database, preserving the change in the passed transaction.
|
|
|
|
|
|
|
|
This method must be overridden in the derived class.
|
2005-06-07 10:38:50 +05:30
|
|
|
"""
|
2009-09-01 00:12:29 +05:30
|
|
|
raise NotImplementedError
|
2005-06-07 10:38:50 +05:30
|
|
|
|
2010-09-21 23:22:37 +05:30
|
|
|
def remove_tag(self, handle, transaction):
|
|
|
|
"""
|
|
|
|
Remove the Tag specified by the database handle from the
|
|
|
|
database, preserving the change in the passed transaction.
|
|
|
|
|
|
|
|
This method must be overridden in the derived class.
|
|
|
|
"""
|
|
|
|
raise NotImplementedError
|
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def set_auto_remove(self):
|
2005-05-27 23:13:04 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
BSDDB change log settings using new method with renamed attributes
|
2005-05-27 23:13:04 +05:30
|
|
|
"""
|
2009-09-01 00:12:29 +05:30
|
|
|
raise NotImplementedError
|
2005-05-27 23:13:04 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def set_default_person_handle(self, handle):
|
2007-02-20 06:09:10 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Set the default Person to the passed instance.
|
2007-02-20 06:09:10 +05:30
|
|
|
"""
|
2009-09-01 00:12:29 +05:30
|
|
|
raise NotImplementedError
|
2007-02-20 06:09:10 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def set_name_group_mapping(self, name, group):
|
2008-02-23 14:08:55 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Set the default grouping name for a surname.
|
2008-02-23 14:08:55 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
Needs to be overridden in the derived class.
|
2008-02-23 14:08:55 +05:30
|
|
|
"""
|
2009-09-01 00:12:29 +05:30
|
|
|
raise NotImplementedError
|
2006-01-13 03:32:58 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def sort_surname_list(self):
|
2008-02-23 14:08:55 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Sort the list of surnames contained in the database by locale ordering.
|
2008-02-23 14:08:55 +05:30
|
|
|
"""
|
2009-09-01 00:12:29 +05:30
|
|
|
raise NotImplementedError
|
2005-12-15 17:33:24 +05:30
|
|
|
|
2011-02-20 16:22:06 +05:30
|
|
|
def transaction_begin(self, transaction):
|
2006-12-01 13:53:51 +05:30
|
|
|
"""
|
2011-02-20 16:22:06 +05:30
|
|
|
Prepare the database for the start of a new transaction.
|
2009-12-23 21:25:58 +05:30
|
|
|
|
2011-02-20 16:22:06 +05:30
|
|
|
Two modes should be provided: transaction.batch=False for ordinary
|
|
|
|
database operations that will be encapsulated in database transactions
|
|
|
|
to make them ACID and that are added to Gramps transactions so that
|
|
|
|
they can be undone. And transaction.batch=True for lengthy database
|
|
|
|
operations, that benefit from a speedup by making them none ACID, and
|
|
|
|
that can't be undone. The user is warned and is asked for permission
|
|
|
|
before the start of such database operations.
|
|
|
|
|
|
|
|
:param transaction: Gramps transaction ...
|
|
|
|
:type transaction: DbTxn
|
|
|
|
:returns: Returns the Gramps transaction.
|
|
|
|
:rtype: DbTxn
|
|
|
|
"""
|
|
|
|
raise NotImplementedError
|
|
|
|
|
|
|
|
def transaction_commit(self, transaction):
|
|
|
|
"""
|
|
|
|
Make the changes to the database final and add the content of the
|
|
|
|
transaction to the undo database.
|
2006-12-01 13:53:51 +05:30
|
|
|
"""
|
2009-09-01 00:12:29 +05:30
|
|
|
raise NotImplementedError
|
2006-12-01 13:53:51 +05:30
|
|
|
|
2011-02-20 16:22:06 +05:30
|
|
|
def transaction_abort(self, transaction):
|
2005-12-15 17:33:24 +05:30
|
|
|
"""
|
2011-02-20 16:22:06 +05:30
|
|
|
Revert the changes made to the database so far during the transaction.
|
2009-09-01 00:12:29 +05:30
|
|
|
"""
|
|
|
|
raise NotImplementedError
|
2007-10-05 14:55:31 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def update_reference_map(self, obj, transaction):
|
2007-10-05 15:00:27 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Called each time an object is writen to the database.
|
|
|
|
|
|
|
|
This can be used by subclasses to update any additional index tables
|
|
|
|
that might need to be changed.
|
2008-02-23 14:08:55 +05:30
|
|
|
"""
|
2009-09-01 00:12:29 +05:30
|
|
|
raise NotImplementedError
|
2007-10-05 14:55:31 +05:30
|
|
|
|
2009-12-23 21:25:58 +05:30
|
|
|
def write_version(self, name):
|
2008-02-23 14:08:55 +05:30
|
|
|
"""
|
2009-12-23 21:25:58 +05:30
|
|
|
Write version number for a newly created DB.
|
2007-10-05 15:00:27 +05:30
|
|
|
"""
|
2009-09-01 00:12:29 +05:30
|
|
|
raise NotImplementedError
|
2009-12-21 03:51:59 +05:30
|
|
|
|
2009-12-21 09:48:31 +05:30
|
|
|
def add_child_to_family(self, family, child,
|
|
|
|
mrel=gen.lib.ChildRefType(),
|
|
|
|
frel=gen.lib.ChildRefType(),
|
|
|
|
trans=None):
|
|
|
|
"""
|
|
|
|
Adds a child to a family.
|
|
|
|
"""
|
|
|
|
cref = gen.lib.ChildRef()
|
|
|
|
cref.ref = child.handle
|
|
|
|
cref.set_father_relation(frel)
|
|
|
|
cref.set_mother_relation(mrel)
|
2009-12-23 21:25:58 +05:30
|
|
|
|
2009-12-21 09:48:31 +05:30
|
|
|
family.add_child_ref(cref)
|
|
|
|
child.add_parent_family_handle(family.handle)
|
|
|
|
|
|
|
|
if trans is None:
|
2011-02-20 16:22:06 +05:30
|
|
|
with DbTxn(_('Add child to family'), self) as trans:
|
2011-02-01 03:24:58 +05:30
|
|
|
self.commit_family(family, trans)
|
|
|
|
self.commit_person(child, trans)
|
2009-12-21 09:48:31 +05:30
|
|
|
else:
|
2011-02-01 03:24:58 +05:30
|
|
|
self.commit_family(family, trans)
|
|
|
|
self.commit_person(child, trans)
|
|
|
|
|
2009-12-21 09:48:31 +05:30
|
|
|
def remove_child_from_family(self, person_handle, family_handle, trans=None):
|
|
|
|
"""
|
|
|
|
Remove a person as a child of the family, deleting the family if
|
|
|
|
it becomes empty.
|
|
|
|
"""
|
2011-02-01 03:24:58 +05:30
|
|
|
if trans is None:
|
2011-02-20 16:22:06 +05:30
|
|
|
with DbTxn(_("Remove child from family"), self) as trans:
|
2011-02-01 03:24:58 +05:30
|
|
|
self.__remove_child_from_family(person_handle, family_handle,
|
|
|
|
trans)
|
|
|
|
else:
|
|
|
|
self.__remove_child_from_family(person_handle, family_handle, trans)
|
|
|
|
trans.set_description(_("Remove child from family"))
|
|
|
|
|
|
|
|
def __remove_child_from_family(self, person_handle, family_handle, trans):
|
|
|
|
"""
|
|
|
|
Remove a person as a child of the family, deleting the family if
|
|
|
|
it becomes empty; trans is compulsory.
|
|
|
|
"""
|
2009-12-21 09:48:31 +05:30
|
|
|
person = self.get_person_from_handle(person_handle)
|
|
|
|
family = self.get_family_from_handle(family_handle)
|
|
|
|
person.remove_parent_family_handle(family_handle)
|
|
|
|
family.remove_child_handle(person_handle)
|
|
|
|
|
2011-02-09 21:33:52 +05:30
|
|
|
if (not family.get_father_handle() and not family.get_mother_handle()
|
|
|
|
and not family.get_child_ref_list()):
|
|
|
|
self.remove_family_relationships(family_handle, trans)
|
2009-12-21 09:48:31 +05:30
|
|
|
else:
|
|
|
|
self.commit_family(family, trans)
|
|
|
|
self.commit_person(person, trans)
|
2009-12-23 21:25:58 +05:30
|
|
|
|
2009-12-21 09:48:31 +05:30
|
|
|
def delete_person_from_database(self, person, trans):
|
|
|
|
"""
|
|
|
|
Deletes a person from the database, cleaning up all associated references.
|
|
|
|
"""
|
|
|
|
|
|
|
|
# clear out the default person if the person is the default person
|
|
|
|
if self.get_default_person() == person:
|
|
|
|
self.set_default_person_handle(None)
|
|
|
|
|
|
|
|
# loop through the family list
|
2010-01-25 23:15:21 +05:30
|
|
|
for family_handle in person.get_family_handle_list():
|
2011-03-25 03:08:04 +05:30
|
|
|
if not family_handle:
|
|
|
|
continue
|
2009-12-21 09:48:31 +05:30
|
|
|
|
|
|
|
family = self.get_family_from_handle(family_handle)
|
|
|
|
|
|
|
|
if person.get_handle() == family.get_father_handle():
|
|
|
|
family.set_father_handle(None)
|
|
|
|
else:
|
|
|
|
family.set_mother_handle(None)
|
|
|
|
|
2011-03-25 03:08:04 +05:30
|
|
|
if not family.get_father_handle() and \
|
|
|
|
not family.get_mother_handle() and \
|
2009-12-21 09:48:31 +05:30
|
|
|
not family.get_child_ref_list():
|
2011-02-09 21:33:52 +05:30
|
|
|
self.remove_family_relationships(family_handle, trans)
|
2009-12-21 09:48:31 +05:30
|
|
|
else:
|
|
|
|
self.commit_family(family, trans)
|
|
|
|
|
|
|
|
for family_handle in person.get_parent_family_handle_list():
|
|
|
|
if family_handle:
|
|
|
|
family = self.get_family_from_handle(family_handle)
|
|
|
|
family.remove_child_handle(person.get_handle())
|
2011-02-09 21:33:52 +05:30
|
|
|
if not family.get_father_handle() and \
|
|
|
|
not family.get_mother_handle() and \
|
|
|
|
not family.get_child_ref_list():
|
|
|
|
self.remove_family_relationships(family_handle, trans)
|
|
|
|
else:
|
|
|
|
self.commit_family(family, trans)
|
2009-12-21 09:48:31 +05:30
|
|
|
|
|
|
|
handle = person.get_handle()
|
|
|
|
|
|
|
|
person_list = [
|
|
|
|
item[1] for item in
|
|
|
|
self.find_backlink_handles(handle,['Person'])]
|
2010-02-15 17:43:43 +05:30
|
|
|
|
2009-12-21 09:48:31 +05:30
|
|
|
for phandle in person_list:
|
2011-03-25 03:08:04 +05:30
|
|
|
prsn = self.get_person_from_handle(phandle)
|
|
|
|
prsn.remove_handle_references('Person', [handle])
|
|
|
|
self.commit_person(prsn, trans)
|
2009-12-21 09:48:31 +05:30
|
|
|
self.remove_person(handle, trans)
|
2009-12-23 21:25:58 +05:30
|
|
|
|
2009-12-21 09:48:31 +05:30
|
|
|
def remove_family_relationships(self, family_handle, trans=None):
|
|
|
|
"""
|
|
|
|
Remove a family and its relationships.
|
|
|
|
"""
|
|
|
|
if trans is None:
|
2011-02-20 16:22:06 +05:30
|
|
|
with DbTxn(_("Remove Family"), self) as trans:
|
2011-02-01 03:24:58 +05:30
|
|
|
self.__remove_family_relationships(family_handle, trans)
|
2009-12-21 09:48:31 +05:30
|
|
|
else:
|
2011-02-01 03:24:58 +05:30
|
|
|
self.__remove_family_relationships(family_handle, trans)
|
|
|
|
trans.set_description(_("Remove Family"))
|
|
|
|
|
|
|
|
def __remove_family_relationships(self, family_handle, trans):
|
|
|
|
"""
|
2011-02-09 21:33:52 +05:30
|
|
|
Remove a family and all that references it; trans is compulsory.
|
2011-02-01 03:24:58 +05:30
|
|
|
"""
|
2011-02-09 21:33:52 +05:30
|
|
|
person_list = [item[1] for item in
|
|
|
|
self.find_backlink_handles(family_handle, ['Person'])]
|
|
|
|
for phandle in person_list:
|
2009-12-21 09:48:31 +05:30
|
|
|
person = self.get_person_from_handle(phandle)
|
2011-02-09 21:33:52 +05:30
|
|
|
person.remove_handle_references('Family', [family_handle])
|
2009-12-21 09:48:31 +05:30
|
|
|
self.commit_person(person, trans)
|
|
|
|
self.remove_family(family_handle, trans)
|
2011-02-09 21:33:52 +05:30
|
|
|
|
2011-02-01 03:24:58 +05:30
|
|
|
def remove_parent_from_family(self, person_handle, family_handle,
|
|
|
|
trans=None):
|
2009-12-21 09:48:31 +05:30
|
|
|
"""
|
|
|
|
Remove a person as either the father or mother of a family,
|
|
|
|
deleting the family if it becomes empty.
|
|
|
|
"""
|
|
|
|
if trans is None:
|
2011-02-20 16:22:06 +05:30
|
|
|
with DbTxn('', self) as trans:
|
2011-02-01 03:24:58 +05:30
|
|
|
msg = self.__remove_parent_from_family(person_handle,
|
|
|
|
family_handle, trans)
|
|
|
|
trans.set_description(msg)
|
2009-12-21 09:48:31 +05:30
|
|
|
else:
|
2011-02-01 03:24:58 +05:30
|
|
|
msg = self.__remove_parent_from_family(person_handle,
|
|
|
|
family_handle, trans)
|
|
|
|
trans.set_description(msg)
|
|
|
|
|
|
|
|
def __remove_parent_from_family(self, person_handle, family_handle, trans):
|
|
|
|
"""
|
|
|
|
Remove a person as either the father or mother of a family,
|
|
|
|
deleting the family if it becomes empty; trans is compulsory.
|
|
|
|
"""
|
|
|
|
person = self.get_person_from_handle(person_handle)
|
|
|
|
family = self.get_family_from_handle(family_handle)
|
2009-12-21 09:48:31 +05:30
|
|
|
|
|
|
|
person.remove_family_handle(family_handle)
|
|
|
|
if family.get_father_handle() == person_handle:
|
|
|
|
family.set_father_handle(None)
|
|
|
|
msg = _("Remove father from family")
|
|
|
|
elif family.get_mother_handle() == person_handle:
|
|
|
|
msg = _("Remove mother from family")
|
|
|
|
family.set_mother_handle(None)
|
2011-08-10 02:04:21 +05:30
|
|
|
else:
|
|
|
|
raise DbTransactionCancel("The relation between the person and "
|
|
|
|
"the family you try to remove is not consistent, please fix "
|
|
|
|
"that first, for example from the family editor or by running "
|
|
|
|
"the database repair tool, before removing the family.")
|
2009-12-21 09:48:31 +05:30
|
|
|
|
2011-02-09 21:33:52 +05:30
|
|
|
if (not family.get_father_handle() and not family.get_mother_handle()
|
|
|
|
and not family.get_child_ref_list()):
|
|
|
|
self.remove_family_relationships(family_handle, trans)
|
2009-12-21 09:48:31 +05:30
|
|
|
else:
|
|
|
|
self.commit_family(family, trans)
|
|
|
|
self.commit_person(person, trans)
|
2011-02-01 03:24:58 +05:30
|
|
|
return msg
|
|
|
|
|
2009-12-21 09:48:31 +05:30
|
|
|
def marriage_from_eventref_list(self, eventref_list):
|
|
|
|
"""
|
|
|
|
Get the marriage event from an eventref list.
|
|
|
|
"""
|
|
|
|
for eventref in eventref_list:
|
|
|
|
event = self.get_event_from_handle(eventref.ref)
|
|
|
|
if event and event.type.is_marriage():
|
|
|
|
return event
|
|
|
|
return None
|
2009-12-23 21:25:58 +05:30
|
|
|
|
2009-12-21 09:48:31 +05:30
|
|
|
def get_total(self):
|
|
|
|
"""
|
|
|
|
Get the total of primary objects.
|
|
|
|
"""
|
|
|
|
person_len = self.get_number_of_people()
|
|
|
|
family_len = self.get_number_of_families()
|
|
|
|
event_len = self.get_number_of_events()
|
|
|
|
source_len = self.get_number_of_sources()
|
|
|
|
place_len = self.get_number_of_places()
|
|
|
|
repo_len = self.get_number_of_repositories()
|
|
|
|
obj_len = self.get_number_of_media_objects()
|
2009-12-23 21:25:58 +05:30
|
|
|
|
2009-12-21 09:48:31 +05:30
|
|
|
return person_len + family_len + event_len + \
|
|
|
|
place_len + source_len + obj_len + repo_len
|
2009-12-23 21:25:58 +05:30
|
|
|
|
2009-12-21 09:48:31 +05:30
|
|
|
def set_birth_death_index(self, person):
|
|
|
|
"""
|
|
|
|
Set the birth and death indices for a person.
|
|
|
|
"""
|
|
|
|
birth_ref_index = -1
|
|
|
|
death_ref_index = -1
|
|
|
|
event_ref_list = person.get_event_ref_list()
|
|
|
|
for index in range(len(event_ref_list)):
|
|
|
|
ref = event_ref_list[index]
|
|
|
|
event = self.get_event_from_handle(ref.ref)
|
|
|
|
if (event.type.is_birth()
|
|
|
|
and ref.role.is_primary()
|
|
|
|
and (birth_ref_index == -1)):
|
|
|
|
birth_ref_index = index
|
|
|
|
elif (event.type.is_death()
|
|
|
|
and ref.role.is_primary()
|
|
|
|
and (death_ref_index == -1)):
|
|
|
|
death_ref_index = index
|
|
|
|
|
|
|
|
person.birth_ref_index = birth_ref_index
|
|
|
|
person.death_ref_index = death_ref_index
|
2009-12-23 21:25:58 +05:30
|
|
|
|