* 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$
|
|
|
|
|
|
|
|
"""
|
|
|
|
Event object for GRAMPS
|
|
|
|
"""
|
2005-12-21 02:18:18 +05:30
|
|
|
|
2007-01-08 07:19:33 +05:30
|
|
|
__revision__ = "$Revision$"
|
|
|
|
|
* 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 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
|
2006-08-15 10:54:38 +05:30
|
|
|
from _AttributeBase import AttributeBase
|
2005-12-21 02:18:18 +05:30
|
|
|
from _DateBase import DateBase
|
|
|
|
from _PlaceBase import PlaceBase
|
2006-04-20 04:29:33 +05:30
|
|
|
from _EventType import EventType
|
* 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
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# Event class
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
2007-01-25 10:56:22 +05:30
|
|
|
class Event(SourceBase, NoteBase, MediaBase, AttributeBase,
|
|
|
|
DateBase, PlaceBase, PrimaryObject):
|
* 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 Event record is used to store information about some type of
|
|
|
|
action that occurred at a particular place at a particular time,
|
|
|
|
such as a birth, death, or marriage.
|
|
|
|
"""
|
|
|
|
|
2007-01-08 07:19:33 +05:30
|
|
|
def __init__(self, source=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
|
|
|
"""
|
|
|
|
Creates a new Event instance, copying from the source if present
|
|
|
|
|
|
|
|
@param source: An event used to initialize the new event
|
|
|
|
@type source: Event
|
|
|
|
"""
|
|
|
|
|
2007-01-08 07:19:33 +05:30
|
|
|
PrimaryObject.__init__(self, source)
|
|
|
|
SourceBase.__init__(self, source)
|
|
|
|
NoteBase.__init__(self, source)
|
|
|
|
MediaBase.__init__(self, source)
|
2006-08-15 10:54:38 +05:30
|
|
|
AttributeBase.__init__(self)
|
2007-01-08 07:19:33 +05:30
|
|
|
DateBase.__init__(self, source)
|
|
|
|
PlaceBase.__init__(self, source)
|
* 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 source:
|
|
|
|
self.description = source.description
|
|
|
|
self.type = source.type
|
|
|
|
else:
|
|
|
|
self.description = ""
|
2006-04-20 04:29:33 +05:30
|
|
|
self.type = EventType()
|
* 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-09-09 22:40:13 +05:30
|
|
|
def serialize(self, no_text_date = False):
|
* 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
|
|
|
"""
|
|
|
|
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-04-20 04:29:33 +05:30
|
|
|
return (self.handle, self.gramps_id, self.type.serialize(),
|
2006-09-09 22:40:13 +05:30
|
|
|
DateBase.serialize(self, no_text_date),
|
2006-08-15 10:54:38 +05:30
|
|
|
self.description, self.place,
|
2006-04-13 08:45:22 +05:30
|
|
|
SourceBase.serialize(self),
|
|
|
|
NoteBase.serialize(self),
|
2006-02-04 03:33:53 +05:30
|
|
|
MediaBase.serialize(self),
|
2006-08-15 10:54:38 +05:30
|
|
|
AttributeBase.serialize(self),
|
2006-05-02 04:38:09 +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
|
|
|
|
2007-01-08 07:19:33 +05:30
|
|
|
def unserialize(self, data):
|
* 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
|
|
|
"""
|
|
|
|
Converts the data held in a tuple created by the serialize method
|
|
|
|
back into the data in an Event structure.
|
|
|
|
|
|
|
|
@param data: tuple containing the persistent data associated the
|
|
|
|
Person object
|
|
|
|
@type data: tuple
|
|
|
|
"""
|
2006-04-20 04:29:33 +05:30
|
|
|
(self.handle, self.gramps_id, the_type, date,
|
2006-08-15 10:54:38 +05:30
|
|
|
self.description, self.place,
|
|
|
|
source_list, note, media_list, attribute_list,
|
2006-05-02 04:38:09 +05:30
|
|
|
self.change, marker, self.private) = data
|
2006-02-04 03:33:53 +05:30
|
|
|
|
2006-05-02 04:38:09 +05:30
|
|
|
self.marker.unserialize(marker)
|
2006-04-20 04:29:33 +05:30
|
|
|
self.type.unserialize(the_type)
|
2007-01-08 07:19:33 +05:30
|
|
|
DateBase.unserialize(self, date)
|
|
|
|
MediaBase.unserialize(self, media_list)
|
|
|
|
AttributeBase.unserialize(self, attribute_list)
|
|
|
|
SourceBase.unserialize(self, source_list)
|
|
|
|
NoteBase.unserialize(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
|
|
|
|
2007-01-08 07:19:33 +05:30
|
|
|
def _has_handle_reference(self, classname, handle):
|
2007-01-09 10:02:07 +05:30
|
|
|
"""
|
|
|
|
Returns True if the object has reference to a given handle
|
|
|
|
of given primary object type.
|
|
|
|
|
|
|
|
@param classname: The name of the primary object class.
|
|
|
|
@type classname: str
|
|
|
|
@param handle: The handle to be checked.
|
|
|
|
@type handle: str
|
|
|
|
@return: Returns whether the object has reference to this handle of this object type.
|
|
|
|
@rtype: bool
|
|
|
|
"""
|
* 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 classname == 'Place':
|
|
|
|
return self.place == handle
|
|
|
|
return False
|
|
|
|
|
2007-01-08 07:19:33 +05:30
|
|
|
def _remove_handle_references(self, classname, handle_list):
|
2007-01-09 10:02:07 +05:30
|
|
|
"""
|
|
|
|
Removes all references in this object to object handles in the list.
|
|
|
|
|
|
|
|
@param classname: The name of the primary object class.
|
|
|
|
@type classname: str
|
|
|
|
@param handle_list: The list of handles to be removed.
|
|
|
|
@type handle_list: str
|
|
|
|
"""
|
* 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 classname == 'Place' and self.place in handle_list:
|
|
|
|
self.place = ""
|
|
|
|
|
2007-01-08 07:19:33 +05:30
|
|
|
def _replace_handle_reference(self, classname, old_handle, new_handle):
|
2007-01-09 10:02:07 +05:30
|
|
|
"""
|
|
|
|
Replaces all references to old handle with those to the new handle.
|
|
|
|
|
|
|
|
@param classname: The name of the primary object class.
|
|
|
|
@type classname: str
|
|
|
|
@param old_handle: The handle to be replaced.
|
|
|
|
@type old_handle: str
|
|
|
|
@param new_handle: The handle to replace the old one with.
|
|
|
|
@type new_handle: str
|
|
|
|
"""
|
* 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 classname == 'Place' and self.place == old_handle:
|
|
|
|
self.place = new_handle
|
|
|
|
|
|
|
|
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
|
|
|
|
"""
|
2007-01-08 07:19:33 +05:30
|
|
|
return [self.description, str(self.type), self.gramps_id]
|
* 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_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-08-15 10:54:38 +05:30
|
|
|
check_list = self.media_list + self.source_list + self.attribute_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.note:
|
|
|
|
check_list.append(self.note)
|
|
|
|
return check_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-08-15 10:54:38 +05:30
|
|
|
return self.media_list + self.attribute_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 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 = []
|
|
|
|
if self.place:
|
2007-01-08 07:19:33 +05:30
|
|
|
ret.append(('Place', self.place))
|
* 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.media_list + self.source_list
|
|
|
|
|
|
|
|
def is_empty(self):
|
|
|
|
"""
|
|
|
|
Returns True if the Event is an empty object (no values set).
|
|
|
|
|
|
|
|
@returns: True if the Event is empty
|
|
|
|
@rtype: bool
|
|
|
|
"""
|
|
|
|
date = self.get_date_object()
|
|
|
|
place = self.get_place_handle()
|
|
|
|
description = self.description
|
|
|
|
the_type = self.type
|
2006-04-20 08:40:23 +05:30
|
|
|
return (the_type == EventType.CUSTOM and date.is_empty()
|
2006-08-15 10:54:38 +05:30
|
|
|
and not place and not description)
|
* 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
|
|
|
|
2007-01-08 07:19:33 +05:30
|
|
|
def are_equal(self, other):
|
* 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 True if the passed Event is equivalent to the current Event.
|
|
|
|
|
|
|
|
@param other: Event to compare against
|
|
|
|
@type other: Event
|
|
|
|
@returns: True if the Events are equal
|
|
|
|
@rtype: bool
|
|
|
|
"""
|
|
|
|
if other == None:
|
|
|
|
other = Event (None)
|
|
|
|
|
2006-04-20 04:29:33 +05:30
|
|
|
if self.type != other.type or \
|
* 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.place or other.place) and (self.place != other.place)) or \
|
2006-08-15 10:54:38 +05:30
|
|
|
self.description != other.description \
|
* 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
|
|
|
or self.private != other.private or \
|
|
|
|
(not self.get_date_object().is_equal(other.get_date_object())) or \
|
|
|
|
len(self.get_source_references()) != len(other.get_source_references()):
|
|
|
|
return False
|
|
|
|
|
|
|
|
index = 0
|
|
|
|
olist = other.get_source_references()
|
|
|
|
for a in self.get_source_references():
|
2006-05-19 20:31:12 +05:30
|
|
|
if not a.is_equal(olist[index]):
|
* 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
|
|
|
|
index += 1
|
|
|
|
|
|
|
|
return True
|
|
|
|
|
2007-01-08 07:19:33 +05:30
|
|
|
def set_type(self, the_type):
|
* 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
|
|
|
"""
|
|
|
|
Sets the type of the Event to the passed (int,str) tuple.
|
|
|
|
|
|
|
|
@param the_type: Type to assign to the Event
|
|
|
|
@type the_type: tuple
|
|
|
|
"""
|
2006-04-21 05:33:27 +05:30
|
|
|
self.type.set(the_type)
|
* 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_type(self):
|
|
|
|
"""
|
|
|
|
Returns the type of the Event.
|
|
|
|
|
|
|
|
@return: Type of the Event
|
|
|
|
@rtype: tuple
|
|
|
|
"""
|
|
|
|
return self.type
|
|
|
|
|
2007-01-08 07:19:33 +05:30
|
|
|
def set_description(self, description):
|
* 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
|
|
|
"""
|
|
|
|
Sets the description of the Event to the passed string. The string
|
|
|
|
may contain any information.
|
|
|
|
|
|
|
|
@param description: Description to assign to the Event
|
|
|
|
@type description: str
|
|
|
|
"""
|
|
|
|
self.description = description
|
|
|
|
|
|
|
|
def get_description(self) :
|
|
|
|
"""
|
|
|
|
Returns the description of the Event.
|
|
|
|
|
|
|
|
@return: Returns the description of the Event
|
|
|
|
@rtype: str
|
|
|
|
"""
|
|
|
|
return self.description
|