* src/RelLib.py: Remove file (replaced by the package dir).
* src/RelLib: Add directory.
* src/RelLib/__init__.py, src/RelLib/_helper.py,
src/RelLib/_secondary.py, src/RelLib/Researcher.py,
src/RelLib/GenderStats.py, src/RelLib/Person.py,
src/RelLib/Family.py, src/RelLib/Event.py, src/RelLib/Place.py,
src/RelLib/Source.py, src/RelLib/MediaObject.py,
src/RelLib/Repository.py, src/RelLib/Makefile.am,
src/RelLib/.cvsignore: Add to CVS.
* src/configure.in: Create Makefile in src/RelLib.
svn: r5587
2005-12-20 08:08:07 +05:30
|
|
|
#
|
|
|
|
# Gramps - a GTK+/GNOME based genealogy program
|
|
|
|
#
|
2006-02-04 03:33:53 +05:30
|
|
|
# Copyright (C) 2000-2006 Donald N. Allingham
|
* src/RelLib.py: Remove file (replaced by the package dir).
* src/RelLib: Add directory.
* src/RelLib/__init__.py, src/RelLib/_helper.py,
src/RelLib/_secondary.py, src/RelLib/Researcher.py,
src/RelLib/GenderStats.py, src/RelLib/Person.py,
src/RelLib/Family.py, src/RelLib/Event.py, src/RelLib/Place.py,
src/RelLib/Source.py, src/RelLib/MediaObject.py,
src/RelLib/Repository.py, src/RelLib/Makefile.am,
src/RelLib/.cvsignore: Add to CVS.
* src/configure.in: Create Makefile in src/RelLib.
svn: r5587
2005-12-20 08:08:07 +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.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# 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$
|
|
|
|
|
|
|
|
"""
|
|
|
|
Family object for GRAMPS
|
|
|
|
"""
|
|
|
|
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# standard python modules
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
from warnings import warn
|
|
|
|
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# GRAMPS modules
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
2005-12-21 02:18:18 +05:30
|
|
|
from _PrimaryObject import PrimaryObject
|
2006-04-13 08:45:22 +05:30
|
|
|
from _SourceBase import SourceBase
|
|
|
|
from _NoteBase import NoteBase
|
2005-12-21 02:18:18 +05:30
|
|
|
from _MediaBase import MediaBase
|
|
|
|
from _AttributeBase import AttributeBase
|
|
|
|
from _EventRef import EventRef
|
2006-04-04 23:37:23 +05:30
|
|
|
from _LdsOrdBase import LdsOrdBase
|
2006-04-13 09:04:41 +05:30
|
|
|
from _ChildRef import ChildRef
|
2006-04-19 23:57:51 +05:30
|
|
|
from _FamilyRelType import FamilyRelType
|
2006-04-20 06:14:44 +05:30
|
|
|
from _MarkerType import MarkerType
|
* src/RelLib.py: Remove file (replaced by the package dir).
* src/RelLib: Add directory.
* src/RelLib/__init__.py, src/RelLib/_helper.py,
src/RelLib/_secondary.py, src/RelLib/Researcher.py,
src/RelLib/GenderStats.py, src/RelLib/Person.py,
src/RelLib/Family.py, src/RelLib/Event.py, src/RelLib/Place.py,
src/RelLib/Source.py, src/RelLib/MediaObject.py,
src/RelLib/Repository.py, src/RelLib/Makefile.am,
src/RelLib/.cvsignore: Add to CVS.
* src/configure.in: Create Makefile in src/RelLib.
svn: r5587
2005-12-20 08:08:07 +05:30
|
|
|
|
2005-12-21 02:18:18 +05:30
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# Family class
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
2006-04-13 08:45:22 +05:30
|
|
|
class Family(PrimaryObject,SourceBase,NoteBase,MediaBase,AttributeBase,
|
|
|
|
LdsOrdBase):
|
* src/RelLib.py: Remove file (replaced by the package dir).
* src/RelLib: Add directory.
* src/RelLib/__init__.py, src/RelLib/_helper.py,
src/RelLib/_secondary.py, src/RelLib/Researcher.py,
src/RelLib/GenderStats.py, src/RelLib/Person.py,
src/RelLib/Family.py, src/RelLib/Event.py, src/RelLib/Place.py,
src/RelLib/Source.py, src/RelLib/MediaObject.py,
src/RelLib/Repository.py, src/RelLib/Makefile.am,
src/RelLib/.cvsignore: Add to CVS.
* src/configure.in: Create Makefile in src/RelLib.
svn: r5587
2005-12-20 08:08:07 +05:30
|
|
|
"""
|
|
|
|
Introduction
|
|
|
|
============
|
|
|
|
The Family record is the GRAMPS in-memory representation of the
|
|
|
|
relationships between people. It contains all the information
|
|
|
|
related to the relationship.
|
|
|
|
|
|
|
|
Usage
|
|
|
|
=====
|
|
|
|
Family objects are usually created in one of two ways.
|
|
|
|
|
|
|
|
1. Creating a new Family object, which is then initialized and
|
|
|
|
added to the database.
|
|
|
|
2. Retrieving an object from the database using the records
|
|
|
|
handle.
|
|
|
|
|
|
|
|
Once a Family object has been modified, it must be committed
|
|
|
|
to the database using the database object's commit_family function,
|
|
|
|
or the changes will be lost.
|
|
|
|
"""
|
|
|
|
|
|
|
|
def __init__(self):
|
|
|
|
"""
|
|
|
|
Creates a new Family instance. After initialization, most
|
|
|
|
data items have empty or null values, including the database
|
|
|
|
handle.
|
|
|
|
"""
|
|
|
|
PrimaryObject.__init__(self)
|
2006-04-13 08:45:22 +05:30
|
|
|
SourceBase.__init__(self)
|
|
|
|
NoteBase.__init__(self)
|
* src/RelLib.py: Remove file (replaced by the package dir).
* src/RelLib: Add directory.
* src/RelLib/__init__.py, src/RelLib/_helper.py,
src/RelLib/_secondary.py, src/RelLib/Researcher.py,
src/RelLib/GenderStats.py, src/RelLib/Person.py,
src/RelLib/Family.py, src/RelLib/Event.py, src/RelLib/Place.py,
src/RelLib/Source.py, src/RelLib/MediaObject.py,
src/RelLib/Repository.py, src/RelLib/Makefile.am,
src/RelLib/.cvsignore: Add to CVS.
* src/configure.in: Create Makefile in src/RelLib.
svn: r5587
2005-12-20 08:08:07 +05:30
|
|
|
MediaBase.__init__(self)
|
|
|
|
AttributeBase.__init__(self)
|
2006-04-04 23:37:23 +05:30
|
|
|
LdsOrdBase.__init__(self)
|
* src/RelLib.py: Remove file (replaced by the package dir).
* src/RelLib: Add directory.
* src/RelLib/__init__.py, src/RelLib/_helper.py,
src/RelLib/_secondary.py, src/RelLib/Researcher.py,
src/RelLib/GenderStats.py, src/RelLib/Person.py,
src/RelLib/Family.py, src/RelLib/Event.py, src/RelLib/Place.py,
src/RelLib/Source.py, src/RelLib/MediaObject.py,
src/RelLib/Repository.py, src/RelLib/Makefile.am,
src/RelLib/.cvsignore: Add to CVS.
* src/configure.in: Create Makefile in src/RelLib.
svn: r5587
2005-12-20 08:08:07 +05:30
|
|
|
self.father_handle = None
|
|
|
|
self.mother_handle = None
|
2006-04-13 09:04:41 +05:30
|
|
|
self.child_ref_list = []
|
2006-04-20 06:14:44 +05:30
|
|
|
self.type = FamilyRelType()
|
* src/RelLib.py: Remove file (replaced by the package dir).
* src/RelLib: Add directory.
* src/RelLib/__init__.py, src/RelLib/_helper.py,
src/RelLib/_secondary.py, src/RelLib/Researcher.py,
src/RelLib/GenderStats.py, src/RelLib/Person.py,
src/RelLib/Family.py, src/RelLib/Event.py, src/RelLib/Place.py,
src/RelLib/Source.py, src/RelLib/MediaObject.py,
src/RelLib/Repository.py, src/RelLib/Makefile.am,
src/RelLib/.cvsignore: Add to CVS.
* src/configure.in: Create Makefile in src/RelLib.
svn: r5587
2005-12-20 08:08:07 +05:30
|
|
|
self.event_ref_list = []
|
|
|
|
self.lds_seal = None
|
|
|
|
self.complete = 0
|
|
|
|
|
|
|
|
def serialize(self):
|
|
|
|
"""
|
|
|
|
Converts the data held in the event to a Python tuple that
|
|
|
|
represents all the data elements. This method is used to convert
|
|
|
|
the object into a form that can easily be saved to a database.
|
|
|
|
|
|
|
|
These elements may be primative Python types (string, integers),
|
|
|
|
complex Python types (lists or tuples, or Python objects. If the
|
|
|
|
target database cannot handle complex types (such as objectes or
|
|
|
|
lists), the database is responsible for converting the data into
|
|
|
|
a form that it can use.
|
|
|
|
|
|
|
|
@returns: Returns a python tuple containing the data that should
|
|
|
|
be considered persistent.
|
|
|
|
@rtype: tuple
|
|
|
|
"""
|
2006-02-04 03:33:53 +05:30
|
|
|
if self.lds_seal == None:
|
|
|
|
lds_seal = None
|
|
|
|
else:
|
|
|
|
lds_seal = self.lds_seal.serialize()
|
|
|
|
return (self.handle, self.gramps_id, self.father_handle,
|
2006-04-13 09:04:41 +05:30
|
|
|
self.mother_handle,
|
2006-04-13 16:51:33 +05:30
|
|
|
[cr.serialize() for cr in self.child_ref_list],
|
2006-04-20 04:29:33 +05:30
|
|
|
self.type.serialize(),
|
2006-02-04 03:33:53 +05:30
|
|
|
[er.serialize() for er in self.event_ref_list],
|
|
|
|
MediaBase.serialize(self),
|
|
|
|
AttributeBase.serialize(self),
|
2006-04-04 23:37:23 +05:30
|
|
|
LdsOrdBase.serialize(self),
|
2006-04-13 08:45:22 +05:30
|
|
|
SourceBase.serialize(self),
|
|
|
|
NoteBase.serialize(self),
|
2006-04-20 06:14:44 +05:30
|
|
|
self.change, self.marker.serialize(), self.private)
|
* src/RelLib.py: Remove file (replaced by the package dir).
* src/RelLib: Add directory.
* src/RelLib/__init__.py, src/RelLib/_helper.py,
src/RelLib/_secondary.py, src/RelLib/Researcher.py,
src/RelLib/GenderStats.py, src/RelLib/Person.py,
src/RelLib/Family.py, src/RelLib/Event.py, src/RelLib/Place.py,
src/RelLib/Source.py, src/RelLib/MediaObject.py,
src/RelLib/Repository.py, src/RelLib/Makefile.am,
src/RelLib/.cvsignore: Add to CVS.
* src/configure.in: Create Makefile in src/RelLib.
svn: r5587
2005-12-20 08:08:07 +05:30
|
|
|
|
|
|
|
def unserialize(self, data):
|
|
|
|
"""
|
|
|
|
Converts the data held in a tuple created by the serialize method
|
|
|
|
back into the data in a Family structure.
|
|
|
|
"""
|
|
|
|
(self.handle, self.gramps_id, self.father_handle, self.mother_handle,
|
2006-04-20 04:29:33 +05:30
|
|
|
child_ref_list, the_type, event_ref_list, media_list,
|
2006-04-13 08:45:22 +05:30
|
|
|
attribute_list, lds_seal_list, source_list, note,
|
2006-04-20 06:14:44 +05:30
|
|
|
self.change, marker, self.private) = data
|
2006-02-04 03:33:53 +05:30
|
|
|
|
2006-04-20 06:14:44 +05:30
|
|
|
self.marker.unserialize(marker)
|
2006-04-20 04:29:33 +05:30
|
|
|
self.type.unserialize(the_type)
|
2006-02-04 03:33:53 +05:30
|
|
|
self.event_ref_list = [EventRef().unserialize(er)
|
|
|
|
for er in event_ref_list]
|
2006-04-13 09:04:41 +05:30
|
|
|
self.child_ref_list = [ChildRef().unserialize(cr)
|
|
|
|
for cr in child_ref_list]
|
2006-02-04 03:33:53 +05:30
|
|
|
MediaBase.unserialize(self,media_list)
|
|
|
|
AttributeBase.unserialize(self,attribute_list)
|
2006-04-13 08:45:22 +05:30
|
|
|
SourceBase.unserialize(self,source_list)
|
|
|
|
NoteBase.unserialize(self,note)
|
2006-04-04 23:37:23 +05:30
|
|
|
LdsOrdBase.unserialize(self,lds_seal_list)
|
* src/RelLib.py: Remove file (replaced by the package dir).
* src/RelLib: Add directory.
* src/RelLib/__init__.py, src/RelLib/_helper.py,
src/RelLib/_secondary.py, src/RelLib/Researcher.py,
src/RelLib/GenderStats.py, src/RelLib/Person.py,
src/RelLib/Family.py, src/RelLib/Event.py, src/RelLib/Place.py,
src/RelLib/Source.py, src/RelLib/MediaObject.py,
src/RelLib/Repository.py, src/RelLib/Makefile.am,
src/RelLib/.cvsignore: Add to CVS.
* src/configure.in: Create Makefile in src/RelLib.
svn: r5587
2005-12-20 08:08:07 +05:30
|
|
|
|
|
|
|
def _has_handle_reference(self,classname,handle):
|
|
|
|
if classname == 'Event':
|
|
|
|
return handle in [ref.ref for ref in self.event_ref_list]
|
|
|
|
elif classname == 'Person':
|
2006-04-13 09:04:41 +05:30
|
|
|
return handle in ([ref.ref for ref in self.child_list]
|
|
|
|
+ [self.father_handle,self.mother_handle])
|
* src/RelLib.py: Remove file (replaced by the package dir).
* src/RelLib: Add directory.
* src/RelLib/__init__.py, src/RelLib/_helper.py,
src/RelLib/_secondary.py, src/RelLib/Researcher.py,
src/RelLib/GenderStats.py, src/RelLib/Person.py,
src/RelLib/Family.py, src/RelLib/Event.py, src/RelLib/Place.py,
src/RelLib/Source.py, src/RelLib/MediaObject.py,
src/RelLib/Repository.py, src/RelLib/Makefile.am,
src/RelLib/.cvsignore: Add to CVS.
* src/configure.in: Create Makefile in src/RelLib.
svn: r5587
2005-12-20 08:08:07 +05:30
|
|
|
elif classname == 'Place':
|
2006-04-04 23:37:23 +05:30
|
|
|
return handle in [ x.place for x in self.lds_ord_list ]
|
* src/RelLib.py: Remove file (replaced by the package dir).
* src/RelLib: Add directory.
* src/RelLib/__init__.py, src/RelLib/_helper.py,
src/RelLib/_secondary.py, src/RelLib/Researcher.py,
src/RelLib/GenderStats.py, src/RelLib/Person.py,
src/RelLib/Family.py, src/RelLib/Event.py, src/RelLib/Place.py,
src/RelLib/Source.py, src/RelLib/MediaObject.py,
src/RelLib/Repository.py, src/RelLib/Makefile.am,
src/RelLib/.cvsignore: Add to CVS.
* src/configure.in: Create Makefile in src/RelLib.
svn: r5587
2005-12-20 08:08:07 +05:30
|
|
|
return False
|
|
|
|
|
|
|
|
def _remove_handle_references(self,classname,handle_list):
|
|
|
|
if classname == 'Event':
|
|
|
|
new_list = [ ref for ref in self.event_ref_list \
|
|
|
|
if ref.ref not in handle_list ]
|
|
|
|
self.event_ref_list = new_list
|
|
|
|
elif classname == 'Person':
|
2006-04-13 09:04:41 +05:30
|
|
|
new_list = [ ref for ref in self.child_ref_list \
|
|
|
|
if ref.ref not in handle_list ]
|
|
|
|
self.child_ref_list = new_list
|
* src/RelLib.py: Remove file (replaced by the package dir).
* src/RelLib: Add directory.
* src/RelLib/__init__.py, src/RelLib/_helper.py,
src/RelLib/_secondary.py, src/RelLib/Researcher.py,
src/RelLib/GenderStats.py, src/RelLib/Person.py,
src/RelLib/Family.py, src/RelLib/Event.py, src/RelLib/Place.py,
src/RelLib/Source.py, src/RelLib/MediaObject.py,
src/RelLib/Repository.py, src/RelLib/Makefile.am,
src/RelLib/.cvsignore: Add to CVS.
* src/configure.in: Create Makefile in src/RelLib.
svn: r5587
2005-12-20 08:08:07 +05:30
|
|
|
if self.father_handle in handle_list:
|
|
|
|
self.father_handle = None
|
|
|
|
if self.mother_handle in handle_list:
|
|
|
|
self.mother_handle = None
|
|
|
|
elif classname == 'Place':
|
2006-04-04 23:37:23 +05:30
|
|
|
for x in self.lds_ord_list:
|
|
|
|
if x.place in handle_list:
|
|
|
|
x.place = None
|
* src/RelLib.py: Remove file (replaced by the package dir).
* src/RelLib: Add directory.
* src/RelLib/__init__.py, src/RelLib/_helper.py,
src/RelLib/_secondary.py, src/RelLib/Researcher.py,
src/RelLib/GenderStats.py, src/RelLib/Person.py,
src/RelLib/Family.py, src/RelLib/Event.py, src/RelLib/Place.py,
src/RelLib/Source.py, src/RelLib/MediaObject.py,
src/RelLib/Repository.py, src/RelLib/Makefile.am,
src/RelLib/.cvsignore: Add to CVS.
* src/configure.in: Create Makefile in src/RelLib.
svn: r5587
2005-12-20 08:08:07 +05:30
|
|
|
|
|
|
|
def _replace_handle_reference(self,classname,old_handle,new_handle):
|
|
|
|
if classname == 'Event':
|
|
|
|
handle_list = [ref.ref for ref in self.event_ref_list]
|
|
|
|
while old_handle in handle_list:
|
2006-04-13 09:04:41 +05:30
|
|
|
ix = handle_list.index(old_handle)
|
* src/RelLib.py: Remove file (replaced by the package dir).
* src/RelLib: Add directory.
* src/RelLib/__init__.py, src/RelLib/_helper.py,
src/RelLib/_secondary.py, src/RelLib/Researcher.py,
src/RelLib/GenderStats.py, src/RelLib/Person.py,
src/RelLib/Family.py, src/RelLib/Event.py, src/RelLib/Place.py,
src/RelLib/Source.py, src/RelLib/MediaObject.py,
src/RelLib/Repository.py, src/RelLib/Makefile.am,
src/RelLib/.cvsignore: Add to CVS.
* src/configure.in: Create Makefile in src/RelLib.
svn: r5587
2005-12-20 08:08:07 +05:30
|
|
|
self.event_ref_list[ix].ref = new_handle
|
|
|
|
handle_list[ix] = ''
|
|
|
|
elif classname == 'Person':
|
2006-04-13 09:04:41 +05:30
|
|
|
handle_list = [ref.ref for ref in self.child_ref_list]
|
|
|
|
while old_handle in handle_list:
|
|
|
|
ix = handle_list.index(old_handle)
|
|
|
|
self.child_ref_list[ix].ref = new_handle
|
|
|
|
handle_list[ix] = ''
|
* src/RelLib.py: Remove file (replaced by the package dir).
* src/RelLib: Add directory.
* src/RelLib/__init__.py, src/RelLib/_helper.py,
src/RelLib/_secondary.py, src/RelLib/Researcher.py,
src/RelLib/GenderStats.py, src/RelLib/Person.py,
src/RelLib/Family.py, src/RelLib/Event.py, src/RelLib/Place.py,
src/RelLib/Source.py, src/RelLib/MediaObject.py,
src/RelLib/Repository.py, src/RelLib/Makefile.am,
src/RelLib/.cvsignore: Add to CVS.
* src/configure.in: Create Makefile in src/RelLib.
svn: r5587
2005-12-20 08:08:07 +05:30
|
|
|
if self.father_handle == old_handle:
|
|
|
|
self.father_handle = new_handle
|
|
|
|
if self.mother_handle == old_handle:
|
|
|
|
self.mother_handle = new_handle
|
|
|
|
elif classname == 'Place':
|
2006-04-04 23:37:23 +05:30
|
|
|
for x in self.lds_ord_list:
|
|
|
|
if x.place == old_handle:
|
|
|
|
x.place = new_handle
|
* src/RelLib.py: Remove file (replaced by the package dir).
* src/RelLib: Add directory.
* src/RelLib/__init__.py, src/RelLib/_helper.py,
src/RelLib/_secondary.py, src/RelLib/Researcher.py,
src/RelLib/GenderStats.py, src/RelLib/Person.py,
src/RelLib/Family.py, src/RelLib/Event.py, src/RelLib/Place.py,
src/RelLib/Source.py, src/RelLib/MediaObject.py,
src/RelLib/Repository.py, src/RelLib/Makefile.am,
src/RelLib/.cvsignore: Add to CVS.
* src/configure.in: Create Makefile in src/RelLib.
svn: r5587
2005-12-20 08:08:07 +05:30
|
|
|
|
|
|
|
def get_text_data_list(self):
|
|
|
|
"""
|
|
|
|
Returns the list of all textual attributes of the object.
|
|
|
|
|
|
|
|
@return: Returns the list of all textual attributes of the object.
|
|
|
|
@rtype: list
|
|
|
|
"""
|
|
|
|
return [self.gramps_id]
|
|
|
|
|
|
|
|
def get_text_data_child_list(self):
|
|
|
|
"""
|
|
|
|
Returns the list of child objects that may carry textual data.
|
|
|
|
|
|
|
|
@return: Returns the list of child objects that may carry textual data.
|
|
|
|
@rtype: list
|
|
|
|
"""
|
2006-04-04 23:37:23 +05:30
|
|
|
check_list = self.lds_ord_list + [self.note]
|
* src/RelLib.py: Remove file (replaced by the package dir).
* src/RelLib: Add directory.
* src/RelLib/__init__.py, src/RelLib/_helper.py,
src/RelLib/_secondary.py, src/RelLib/Researcher.py,
src/RelLib/GenderStats.py, src/RelLib/Person.py,
src/RelLib/Family.py, src/RelLib/Event.py, src/RelLib/Place.py,
src/RelLib/Source.py, src/RelLib/MediaObject.py,
src/RelLib/Repository.py, src/RelLib/Makefile.am,
src/RelLib/.cvsignore: Add to CVS.
* src/configure.in: Create Makefile in src/RelLib.
svn: r5587
2005-12-20 08:08:07 +05:30
|
|
|
add_list = [item for item in check_list if item]
|
|
|
|
return self.media_list + self.attribute_list + \
|
|
|
|
self.source_list + add_list
|
|
|
|
|
|
|
|
def get_sourcref_child_list(self):
|
|
|
|
"""
|
|
|
|
Returns the list of child secondary objects that may refer sources.
|
|
|
|
|
|
|
|
@return: Returns the list of child secondary child objects that may refer sources.
|
|
|
|
@rtype: list
|
|
|
|
"""
|
2006-04-04 23:37:23 +05:30
|
|
|
check_list = self.media_list + self.attribute_list + self.lds_ord_list
|
* src/RelLib.py: Remove file (replaced by the package dir).
* src/RelLib: Add directory.
* src/RelLib/__init__.py, src/RelLib/_helper.py,
src/RelLib/_secondary.py, src/RelLib/Researcher.py,
src/RelLib/GenderStats.py, src/RelLib/Person.py,
src/RelLib/Family.py, src/RelLib/Event.py, src/RelLib/Place.py,
src/RelLib/Source.py, src/RelLib/MediaObject.py,
src/RelLib/Repository.py, src/RelLib/Makefile.am,
src/RelLib/.cvsignore: Add to CVS.
* src/configure.in: Create Makefile in src/RelLib.
svn: r5587
2005-12-20 08:08:07 +05:30
|
|
|
return check_list
|
|
|
|
|
|
|
|
def get_referenced_handles(self):
|
|
|
|
"""
|
|
|
|
Returns the list of (classname,handle) tuples for all directly
|
|
|
|
referenced primary objects.
|
|
|
|
|
|
|
|
@return: Returns the list of (classname,handle) tuples for referenced objects.
|
|
|
|
@rtype: list
|
|
|
|
"""
|
|
|
|
ret = []
|
|
|
|
ret += [('Event',ref.ref) for ref in self.event_ref_list]
|
2006-04-13 09:04:41 +05:30
|
|
|
ret += [('Person',handle) for handle
|
|
|
|
in ([ref.ref for ref in self.child_ref_list] +
|
|
|
|
[self.father_handle,self.mother_handle])
|
|
|
|
if handle]
|
* src/RelLib.py: Remove file (replaced by the package dir).
* src/RelLib: Add directory.
* src/RelLib/__init__.py, src/RelLib/_helper.py,
src/RelLib/_secondary.py, src/RelLib/Researcher.py,
src/RelLib/GenderStats.py, src/RelLib/Person.py,
src/RelLib/Family.py, src/RelLib/Event.py, src/RelLib/Place.py,
src/RelLib/Source.py, src/RelLib/MediaObject.py,
src/RelLib/Repository.py, src/RelLib/Makefile.am,
src/RelLib/.cvsignore: Add to CVS.
* src/configure.in: Create Makefile in src/RelLib.
svn: r5587
2005-12-20 08:08:07 +05:30
|
|
|
return ret
|
|
|
|
|
|
|
|
def get_handle_referents(self):
|
|
|
|
"""
|
|
|
|
Returns the list of child objects which may, directly or through
|
|
|
|
their children, reference primary objects..
|
|
|
|
|
|
|
|
@return: Returns the list of objects refereincing primary objects.
|
|
|
|
@rtype: list
|
|
|
|
"""
|
|
|
|
return self.get_sourcref_child_list() + self.source_list
|
|
|
|
|
|
|
|
def set_complete_flag(self,val):
|
|
|
|
"""
|
|
|
|
Sets or clears the complete flag, which is used to indicate that the
|
|
|
|
Family's data is considered to be complete.
|
|
|
|
|
|
|
|
@param val: True indicates the Family object is considered to be
|
|
|
|
complete
|
|
|
|
@type val: bool
|
|
|
|
"""
|
|
|
|
self.complete = val
|
|
|
|
|
|
|
|
def get_complete_flag(self):
|
|
|
|
"""
|
|
|
|
Returns the complete flag, which is used to indicate that the
|
|
|
|
Family's data is considered to be complete.
|
|
|
|
|
|
|
|
@return: True indicates that the Family's record is considered to
|
|
|
|
be complete.
|
|
|
|
@rtype: bool
|
|
|
|
"""
|
|
|
|
return self.complete
|
|
|
|
|
|
|
|
def set_relationship(self,relationship_type):
|
|
|
|
"""
|
|
|
|
Sets the relationship type between the people identified as the
|
|
|
|
father and mother in the relationship. The type is a tuple whose
|
|
|
|
first item is an integer constant and whose second item is
|
|
|
|
the string. The valid values are:
|
|
|
|
|
2006-04-19 23:57:51 +05:30
|
|
|
- C{FamilyRelType.MARRIED} : indicates a legally recognized married
|
* src/RelLib.py: Remove file (replaced by the package dir).
* src/RelLib: Add directory.
* src/RelLib/__init__.py, src/RelLib/_helper.py,
src/RelLib/_secondary.py, src/RelLib/Researcher.py,
src/RelLib/GenderStats.py, src/RelLib/Person.py,
src/RelLib/Family.py, src/RelLib/Event.py, src/RelLib/Place.py,
src/RelLib/Source.py, src/RelLib/MediaObject.py,
src/RelLib/Repository.py, src/RelLib/Makefile.am,
src/RelLib/.cvsignore: Add to CVS.
* src/configure.in: Create Makefile in src/RelLib.
svn: r5587
2005-12-20 08:08:07 +05:30
|
|
|
relationship between two individuals. This may be either
|
|
|
|
an opposite or a same sex relationship.
|
2006-04-19 23:57:51 +05:30
|
|
|
- C{FamilyRelType.UNMARRIED} : indicates a relationship between two
|
* src/RelLib.py: Remove file (replaced by the package dir).
* src/RelLib: Add directory.
* src/RelLib/__init__.py, src/RelLib/_helper.py,
src/RelLib/_secondary.py, src/RelLib/Researcher.py,
src/RelLib/GenderStats.py, src/RelLib/Person.py,
src/RelLib/Family.py, src/RelLib/Event.py, src/RelLib/Place.py,
src/RelLib/Source.py, src/RelLib/MediaObject.py,
src/RelLib/Repository.py, src/RelLib/Makefile.am,
src/RelLib/.cvsignore: Add to CVS.
* src/configure.in: Create Makefile in src/RelLib.
svn: r5587
2005-12-20 08:08:07 +05:30
|
|
|
individuals that is not a legally recognized relationship.
|
2006-04-19 23:57:51 +05:30
|
|
|
- C{FamilyRelType.CIVIL_UNION} : indicates a legally recongnized,
|
* src/RelLib.py: Remove file (replaced by the package dir).
* src/RelLib: Add directory.
* src/RelLib/__init__.py, src/RelLib/_helper.py,
src/RelLib/_secondary.py, src/RelLib/Researcher.py,
src/RelLib/GenderStats.py, src/RelLib/Person.py,
src/RelLib/Family.py, src/RelLib/Event.py, src/RelLib/Place.py,
src/RelLib/Source.py, src/RelLib/MediaObject.py,
src/RelLib/Repository.py, src/RelLib/Makefile.am,
src/RelLib/.cvsignore: Add to CVS.
* src/configure.in: Create Makefile in src/RelLib.
svn: r5587
2005-12-20 08:08:07 +05:30
|
|
|
non-married relationship between two individuals of the
|
|
|
|
same sex.
|
2006-04-19 23:57:51 +05:30
|
|
|
- C{FamilyRelType.UNKNOWN} : indicates that the type of relationship
|
* src/RelLib.py: Remove file (replaced by the package dir).
* src/RelLib: Add directory.
* src/RelLib/__init__.py, src/RelLib/_helper.py,
src/RelLib/_secondary.py, src/RelLib/Researcher.py,
src/RelLib/GenderStats.py, src/RelLib/Person.py,
src/RelLib/Family.py, src/RelLib/Event.py, src/RelLib/Place.py,
src/RelLib/Source.py, src/RelLib/MediaObject.py,
src/RelLib/Repository.py, src/RelLib/Makefile.am,
src/RelLib/.cvsignore: Add to CVS.
* src/configure.in: Create Makefile in src/RelLib.
svn: r5587
2005-12-20 08:08:07 +05:30
|
|
|
between the two individuals is not know.
|
2006-04-19 23:57:51 +05:30
|
|
|
- C{FamilyRelType.CUSTOM} : indicates that the type of relationship
|
* src/RelLib.py: Remove file (replaced by the package dir).
* src/RelLib: Add directory.
* src/RelLib/__init__.py, src/RelLib/_helper.py,
src/RelLib/_secondary.py, src/RelLib/Researcher.py,
src/RelLib/GenderStats.py, src/RelLib/Person.py,
src/RelLib/Family.py, src/RelLib/Event.py, src/RelLib/Place.py,
src/RelLib/Source.py, src/RelLib/MediaObject.py,
src/RelLib/Repository.py, src/RelLib/Makefile.am,
src/RelLib/.cvsignore: Add to CVS.
* src/configure.in: Create Makefile in src/RelLib.
svn: r5587
2005-12-20 08:08:07 +05:30
|
|
|
between the two individuals does not match any of the
|
|
|
|
other types.
|
|
|
|
|
|
|
|
@param relationship_type: (int,str) tuple of the relationship type
|
|
|
|
between the father and mother of the relationship.
|
|
|
|
@type relationship_type: tuple
|
|
|
|
"""
|
2006-04-20 04:29:33 +05:30
|
|
|
if type(relationship_type) == tuple:
|
|
|
|
self.type = FamilyRelType(relationship_type)
|
|
|
|
else:
|
|
|
|
self.type = relationship_type
|
|
|
|
return
|
* src/RelLib.py: Remove file (replaced by the package dir).
* src/RelLib: Add directory.
* src/RelLib/__init__.py, src/RelLib/_helper.py,
src/RelLib/_secondary.py, src/RelLib/Researcher.py,
src/RelLib/GenderStats.py, src/RelLib/Person.py,
src/RelLib/Family.py, src/RelLib/Event.py, src/RelLib/Place.py,
src/RelLib/Source.py, src/RelLib/MediaObject.py,
src/RelLib/Repository.py, src/RelLib/Makefile.am,
src/RelLib/.cvsignore: Add to CVS.
* src/configure.in: Create Makefile in src/RelLib.
svn: r5587
2005-12-20 08:08:07 +05:30
|
|
|
|
|
|
|
def get_relationship(self):
|
|
|
|
"""
|
|
|
|
Returns the relationship type between the people identified as the
|
|
|
|
father and mother in the relationship.
|
|
|
|
"""
|
|
|
|
return self.type
|
|
|
|
|
|
|
|
def set_father_handle(self,person_handle):
|
|
|
|
"""
|
|
|
|
Sets the database handle for L{Person} that corresponds to
|
|
|
|
male of the relationship. For a same sex relationship, this
|
|
|
|
can represent either of people involved in the relationship.
|
|
|
|
|
|
|
|
@param person_handle: L{Person} database handle
|
|
|
|
@type person_handle: str
|
|
|
|
"""
|
|
|
|
self.father_handle = person_handle
|
|
|
|
|
|
|
|
def get_father_handle(self):
|
|
|
|
"""
|
|
|
|
Returns the database handle of the L{Person} identified as
|
|
|
|
the father of the Family.
|
|
|
|
|
|
|
|
@returns: L{Person} database handle
|
|
|
|
@rtype: str
|
|
|
|
"""
|
|
|
|
return self.father_handle
|
|
|
|
|
|
|
|
def set_mother_handle(self,person_handle):
|
|
|
|
"""
|
|
|
|
Sets the database handle for L{Person} that corresponds to
|
|
|
|
male of the relationship. For a same sex relationship, this
|
|
|
|
can represent either of people involved in the relationship.
|
|
|
|
|
|
|
|
@param person_handle: L{Person} database handle
|
|
|
|
@type person_handle: str
|
|
|
|
"""
|
|
|
|
self.mother_handle = person_handle
|
|
|
|
|
|
|
|
def get_mother_handle(self):
|
|
|
|
"""
|
|
|
|
Returns the database handle of the L{Person} identified as
|
|
|
|
the mother of the Family.
|
|
|
|
|
|
|
|
@returns: L{Person} database handle
|
|
|
|
@rtype: str
|
|
|
|
"""
|
|
|
|
return self.mother_handle
|
|
|
|
|
2006-04-13 09:04:41 +05:30
|
|
|
def add_child_ref(self,child_ref):
|
* src/RelLib.py: Remove file (replaced by the package dir).
* src/RelLib: Add directory.
* src/RelLib/__init__.py, src/RelLib/_helper.py,
src/RelLib/_secondary.py, src/RelLib/Researcher.py,
src/RelLib/GenderStats.py, src/RelLib/Person.py,
src/RelLib/Family.py, src/RelLib/Event.py, src/RelLib/Place.py,
src/RelLib/Source.py, src/RelLib/MediaObject.py,
src/RelLib/Repository.py, src/RelLib/Makefile.am,
src/RelLib/.cvsignore: Add to CVS.
* src/configure.in: Create Makefile in src/RelLib.
svn: r5587
2005-12-20 08:08:07 +05:30
|
|
|
"""
|
|
|
|
Adds the database handle for L{Person} to the Family's list
|
|
|
|
of children.
|
|
|
|
|
|
|
|
@param person_handle: L{Person} database handle
|
|
|
|
@type person_handle: str
|
|
|
|
"""
|
2006-04-13 23:55:52 +05:30
|
|
|
if not isinstance(child_ref,ChildRef):
|
2006-04-13 09:04:41 +05:30
|
|
|
raise ValueError("expecting ChildRef instance")
|
|
|
|
self.child_ref_list.append(child_ref)
|
* src/RelLib.py: Remove file (replaced by the package dir).
* src/RelLib: Add directory.
* src/RelLib/__init__.py, src/RelLib/_helper.py,
src/RelLib/_secondary.py, src/RelLib/Researcher.py,
src/RelLib/GenderStats.py, src/RelLib/Person.py,
src/RelLib/Family.py, src/RelLib/Event.py, src/RelLib/Place.py,
src/RelLib/Source.py, src/RelLib/MediaObject.py,
src/RelLib/Repository.py, src/RelLib/Makefile.am,
src/RelLib/.cvsignore: Add to CVS.
* src/configure.in: Create Makefile in src/RelLib.
svn: r5587
2005-12-20 08:08:07 +05:30
|
|
|
|
2006-04-13 09:04:41 +05:30
|
|
|
def remove_child_ref(self,child_ref):
|
* src/RelLib.py: Remove file (replaced by the package dir).
* src/RelLib: Add directory.
* src/RelLib/__init__.py, src/RelLib/_helper.py,
src/RelLib/_secondary.py, src/RelLib/Researcher.py,
src/RelLib/GenderStats.py, src/RelLib/Person.py,
src/RelLib/Family.py, src/RelLib/Event.py, src/RelLib/Place.py,
src/RelLib/Source.py, src/RelLib/MediaObject.py,
src/RelLib/Repository.py, src/RelLib/Makefile.am,
src/RelLib/.cvsignore: Add to CVS.
* src/configure.in: Create Makefile in src/RelLib.
svn: r5587
2005-12-20 08:08:07 +05:30
|
|
|
"""
|
|
|
|
Removes the database handle for L{Person} to the Family's list
|
|
|
|
of children if the L{Person} is already in the list.
|
|
|
|
|
|
|
|
@param person_handle: L{Person} database handle
|
|
|
|
@type person_handle: str
|
|
|
|
@return: True if the handle was removed, False if it was not
|
|
|
|
in the list.
|
|
|
|
@rtype: bool
|
|
|
|
"""
|
2006-04-13 23:55:52 +05:30
|
|
|
if not isinstance(childref,ChildRef):
|
2006-04-13 09:04:41 +05:30
|
|
|
raise ValueError("expecting ChildRef instance")
|
|
|
|
new_list = [ref for ref in self.child_ref_list
|
|
|
|
if ref.ref != child_ref.ref ]
|
|
|
|
self.child_ref_list = new_list
|
* src/RelLib.py: Remove file (replaced by the package dir).
* src/RelLib: Add directory.
* src/RelLib/__init__.py, src/RelLib/_helper.py,
src/RelLib/_secondary.py, src/RelLib/Researcher.py,
src/RelLib/GenderStats.py, src/RelLib/Person.py,
src/RelLib/Family.py, src/RelLib/Event.py, src/RelLib/Place.py,
src/RelLib/Source.py, src/RelLib/MediaObject.py,
src/RelLib/Repository.py, src/RelLib/Makefile.am,
src/RelLib/.cvsignore: Add to CVS.
* src/configure.in: Create Makefile in src/RelLib.
svn: r5587
2005-12-20 08:08:07 +05:30
|
|
|
|
2006-04-13 09:04:41 +05:30
|
|
|
def get_child_ref_list(self):
|
* src/RelLib.py: Remove file (replaced by the package dir).
* src/RelLib: Add directory.
* src/RelLib/__init__.py, src/RelLib/_helper.py,
src/RelLib/_secondary.py, src/RelLib/Researcher.py,
src/RelLib/GenderStats.py, src/RelLib/Person.py,
src/RelLib/Family.py, src/RelLib/Event.py, src/RelLib/Place.py,
src/RelLib/Source.py, src/RelLib/MediaObject.py,
src/RelLib/Repository.py, src/RelLib/Makefile.am,
src/RelLib/.cvsignore: Add to CVS.
* src/configure.in: Create Makefile in src/RelLib.
svn: r5587
2005-12-20 08:08:07 +05:30
|
|
|
"""
|
|
|
|
Returns the list of L{Person} handles identifying the children
|
|
|
|
of the Family.
|
|
|
|
|
|
|
|
@return: Returns the list of L{Person} handles assocated with
|
|
|
|
the Family.
|
|
|
|
@rtype: list
|
|
|
|
"""
|
2006-04-13 09:04:41 +05:30
|
|
|
return self.child_ref_list
|
* src/RelLib.py: Remove file (replaced by the package dir).
* src/RelLib: Add directory.
* src/RelLib/__init__.py, src/RelLib/_helper.py,
src/RelLib/_secondary.py, src/RelLib/Researcher.py,
src/RelLib/GenderStats.py, src/RelLib/Person.py,
src/RelLib/Family.py, src/RelLib/Event.py, src/RelLib/Place.py,
src/RelLib/Source.py, src/RelLib/MediaObject.py,
src/RelLib/Repository.py, src/RelLib/Makefile.am,
src/RelLib/.cvsignore: Add to CVS.
* src/configure.in: Create Makefile in src/RelLib.
svn: r5587
2005-12-20 08:08:07 +05:30
|
|
|
|
2006-04-13 09:04:41 +05:30
|
|
|
def set_child_ref_list(self, child_ref_list):
|
* src/RelLib.py: Remove file (replaced by the package dir).
* src/RelLib: Add directory.
* src/RelLib/__init__.py, src/RelLib/_helper.py,
src/RelLib/_secondary.py, src/RelLib/Researcher.py,
src/RelLib/GenderStats.py, src/RelLib/Person.py,
src/RelLib/Family.py, src/RelLib/Event.py, src/RelLib/Place.py,
src/RelLib/Source.py, src/RelLib/MediaObject.py,
src/RelLib/Repository.py, src/RelLib/Makefile.am,
src/RelLib/.cvsignore: Add to CVS.
* src/configure.in: Create Makefile in src/RelLib.
svn: r5587
2005-12-20 08:08:07 +05:30
|
|
|
"""
|
|
|
|
Assigns the passed list to the Family's list children.
|
|
|
|
|
|
|
|
@param child_list: List of L{Person} handles to ba associated
|
|
|
|
as the Family's list of children.
|
|
|
|
@type child_list: list of L{Person} handles
|
|
|
|
"""
|
2006-04-13 09:04:41 +05:30
|
|
|
self.child_ref_list = child_ref_list
|
* src/RelLib.py: Remove file (replaced by the package dir).
* src/RelLib: Add directory.
* src/RelLib/__init__.py, src/RelLib/_helper.py,
src/RelLib/_secondary.py, src/RelLib/Researcher.py,
src/RelLib/GenderStats.py, src/RelLib/Person.py,
src/RelLib/Family.py, src/RelLib/Event.py, src/RelLib/Place.py,
src/RelLib/Source.py, src/RelLib/MediaObject.py,
src/RelLib/Repository.py, src/RelLib/Makefile.am,
src/RelLib/.cvsignore: Add to CVS.
* src/configure.in: Create Makefile in src/RelLib.
svn: r5587
2005-12-20 08:08:07 +05:30
|
|
|
|
|
|
|
def add_event_handle(self,event_handle):
|
|
|
|
warn( "Use add_event_ref instead of add_event_handle", DeprecationWarning, 2)
|
|
|
|
# Wrapper for old API
|
|
|
|
# remove when transitition done.
|
|
|
|
event_ref = EventRef()
|
|
|
|
event_ref.set_reference_handle(event_handle)
|
|
|
|
self.add_event_ref(event_ref)
|
|
|
|
|
|
|
|
def add_event_ref(self,event_ref):
|
|
|
|
"""
|
|
|
|
Adds the L{EventRef} to the Family instance's L{EventRef} list.
|
|
|
|
This is accomplished by assigning the L{EventRef} for the valid
|
|
|
|
L{Event}in the current database.
|
|
|
|
|
|
|
|
@param event_ref: the L{EventRef} to be added to the
|
|
|
|
Person's L{EventRef} list.
|
|
|
|
@type event_ref: EventRef
|
|
|
|
"""
|
2006-03-23 04:33:57 +05:30
|
|
|
if event_ref and not isinstance(event_ref,EventRef):
|
* src/RelLib.py: Remove file (replaced by the package dir).
* src/RelLib: Add directory.
* src/RelLib/__init__.py, src/RelLib/_helper.py,
src/RelLib/_secondary.py, src/RelLib/Researcher.py,
src/RelLib/GenderStats.py, src/RelLib/Person.py,
src/RelLib/Family.py, src/RelLib/Event.py, src/RelLib/Place.py,
src/RelLib/Source.py, src/RelLib/MediaObject.py,
src/RelLib/Repository.py, src/RelLib/Makefile.am,
src/RelLib/.cvsignore: Add to CVS.
* src/configure.in: Create Makefile in src/RelLib.
svn: r5587
2005-12-20 08:08:07 +05:30
|
|
|
raise ValueError("Expecting EventRef instance")
|
|
|
|
self.event_ref_list.append(event_ref)
|
|
|
|
|
|
|
|
def get_event_list(self) :
|
|
|
|
warn( "Use get_event_ref_list instead of get_event_list", DeprecationWarning, 2)
|
|
|
|
# Wrapper for old API
|
|
|
|
# remove when transitition done.
|
|
|
|
event_handle_list = []
|
|
|
|
for event_ref in self.get_event_ref_list():
|
|
|
|
event_handle_list.append( event_ref.get_reference_handle())
|
|
|
|
return event_handle_list
|
|
|
|
|
|
|
|
def get_event_ref_list(self) :
|
|
|
|
"""
|
|
|
|
Returns the list of L{EventRef} objects associated with L{Event}
|
|
|
|
instances.
|
|
|
|
|
|
|
|
@returns: Returns the list of L{EventRef} objects associated with
|
|
|
|
the Family instance.
|
|
|
|
@rtype: list
|
|
|
|
"""
|
|
|
|
return self.event_ref_list
|
|
|
|
|
|
|
|
def set_event_list(self,event_list) :
|
|
|
|
warn( "Use set_event_ref_list instead of set_event_list", DeprecationWarning, 2)
|
|
|
|
# Wrapper for old API
|
|
|
|
# remove when transitition done.
|
|
|
|
event_ref_list = []
|
|
|
|
for event_handle in event_list:
|
|
|
|
event_ref = EventRef()
|
|
|
|
event_ref.set_reference_handle(event_handle)
|
|
|
|
event_ref_list.append( event_ref)
|
|
|
|
self.set_event_ref_list(event_ref_list)
|
|
|
|
|
|
|
|
def set_event_ref_list(self,event_ref_list) :
|
|
|
|
"""
|
|
|
|
Sets the Family instance's L{EventRef} list to the passed list.
|
|
|
|
|
|
|
|
@param event_ref_list: List of valid L{EventRef} objects
|
|
|
|
@type event_ref_list: list
|
|
|
|
"""
|
|
|
|
self.event_ref_list = event_ref_list
|