2007-01-07 Don Allingham <don@gramps-project.org>
* src/RelLib/*.py: pylint fixes 2007-01-07 Douglas S. Blank <dblank@cs.brynmawr.edu> * src/Utils.py: probably_alive patch svn: r7878
This commit is contained in:
parent
9c02ff28df
commit
d5ff16800a
@ -1,3 +1,9 @@
|
|||||||
|
2007-01-07 Don Allingham <don@gramps-project.org>
|
||||||
|
* src/RelLib/*.py: pylint fixes
|
||||||
|
|
||||||
|
2007-01-07 Douglas S. Blank <dblank@cs.brynmawr.edu>
|
||||||
|
* src/Utils.py: probably_alive patch
|
||||||
|
|
||||||
2007-01-06 Piotr Czubaszek <pioterus@gmail.com>
|
2007-01-06 Piotr Czubaszek <pioterus@gmail.com>
|
||||||
* src/plugins/rel_pl.py: Update.
|
* src/plugins/rel_pl.py: Update.
|
||||||
|
|
||||||
|
@ -72,3 +72,6 @@ GRAMPS_PY_MODPATH = "../"
|
|||||||
pycheck:
|
pycheck:
|
||||||
(export PYTHONPATH=$(GRAMPS_PY_MODPATH); \
|
(export PYTHONPATH=$(GRAMPS_PY_MODPATH); \
|
||||||
pychecker $(pkgdata_PYTHON));
|
pychecker $(pkgdata_PYTHON));
|
||||||
|
|
||||||
|
pylint:
|
||||||
|
pylint --disable-msg=W0403,C0103 $(pkgdata_PYTHON)
|
@ -24,6 +24,8 @@
|
|||||||
Address class for GRAMPS
|
Address class for GRAMPS
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
__revision__ = "$Revision$"
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# GRAMPS modules
|
# GRAMPS modules
|
||||||
@ -56,6 +58,9 @@ class Address(SecondaryObject,PrivacyBase,SourceBase,NoteBase,DateBase,
|
|||||||
LocationBase.__init__(self, source)
|
LocationBase.__init__(self, source)
|
||||||
|
|
||||||
def serialize(self):
|
def serialize(self):
|
||||||
|
"""
|
||||||
|
Converts the object to a serialized tuple of data
|
||||||
|
"""
|
||||||
return (PrivacyBase.serialize(self),
|
return (PrivacyBase.serialize(self),
|
||||||
SourceBase.serialize(self),
|
SourceBase.serialize(self),
|
||||||
NoteBase.serialize(self),
|
NoteBase.serialize(self),
|
||||||
@ -63,6 +68,9 @@ class Address(SecondaryObject,PrivacyBase,SourceBase,NoteBase,DateBase,
|
|||||||
LocationBase.serialize(self))
|
LocationBase.serialize(self))
|
||||||
|
|
||||||
def unserialize(self, data):
|
def unserialize(self, data):
|
||||||
|
"""
|
||||||
|
Converts a serialized tuple of data to an object
|
||||||
|
"""
|
||||||
(privacy, source_list, note, date, location) = data
|
(privacy, source_list, note, date, location) = data
|
||||||
|
|
||||||
PrivacyBase.unserialize(self, privacy)
|
PrivacyBase.unserialize(self, privacy)
|
||||||
|
@ -24,6 +24,8 @@
|
|||||||
AddressBase class for GRAMPS
|
AddressBase class for GRAMPS
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
__revision__ = "$Revision$"
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# GRAMPS modules
|
# GRAMPS modules
|
||||||
@ -57,9 +59,15 @@ class AddressBase:
|
|||||||
self.address_list = []
|
self.address_list = []
|
||||||
|
|
||||||
def serialize(self):
|
def serialize(self):
|
||||||
|
"""
|
||||||
|
Converts the object to a serialized tuple of data
|
||||||
|
"""
|
||||||
return [addr.serialize() for addr in self.address_list]
|
return [addr.serialize() for addr in self.address_list]
|
||||||
|
|
||||||
def unserialize(self, data):
|
def unserialize(self, data):
|
||||||
|
"""
|
||||||
|
Converts a serialized tuple of data to an object
|
||||||
|
"""
|
||||||
self.address_list = [Address().unserialize(item) for item in data]
|
self.address_list = [Address().unserialize(item) for item in data]
|
||||||
|
|
||||||
def add_address(self, address):
|
def add_address(self, address):
|
||||||
|
@ -24,6 +24,8 @@
|
|||||||
Attribute class for GRAMPS
|
Attribute class for GRAMPS
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
__revision__ = "$Revision$"
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# GRAMPS modules
|
# GRAMPS modules
|
||||||
@ -61,12 +63,18 @@ class Attribute(SecondaryObject,PrivacyBase,SourceBase,NoteBase):
|
|||||||
self.value = ""
|
self.value = ""
|
||||||
|
|
||||||
def serialize(self):
|
def serialize(self):
|
||||||
|
"""
|
||||||
|
Converts the object to a serialized tuple of data
|
||||||
|
"""
|
||||||
return (PrivacyBase.serialize(self),
|
return (PrivacyBase.serialize(self),
|
||||||
SourceBase.serialize(self),
|
SourceBase.serialize(self),
|
||||||
NoteBase.serialize(self),
|
NoteBase.serialize(self),
|
||||||
self.type.serialize(), self.value)
|
self.type.serialize(), self.value)
|
||||||
|
|
||||||
def unserialize(self, data):
|
def unserialize(self, data):
|
||||||
|
"""
|
||||||
|
Converts a serialized tuple of data to an object
|
||||||
|
"""
|
||||||
(privacy, source_list, note, the_type, self.value) = data
|
(privacy, source_list, note, the_type, self.value) = data
|
||||||
PrivacyBase.unserialize(self, privacy)
|
PrivacyBase.unserialize(self, privacy)
|
||||||
SourceBase.unserialize(self, source_list)
|
SourceBase.unserialize(self, source_list)
|
||||||
|
@ -24,6 +24,8 @@
|
|||||||
AttributeBase class for GRAMPS
|
AttributeBase class for GRAMPS
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
__revision__ = "$Revision$"
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# GRAMPS modules
|
# GRAMPS modules
|
||||||
@ -57,9 +59,15 @@ class AttributeBase:
|
|||||||
self.attribute_list = []
|
self.attribute_list = []
|
||||||
|
|
||||||
def serialize(self):
|
def serialize(self):
|
||||||
|
"""
|
||||||
|
Converts the object to a serialized tuple of data
|
||||||
|
"""
|
||||||
return [attr.serialize() for attr in self.attribute_list]
|
return [attr.serialize() for attr in self.attribute_list]
|
||||||
|
|
||||||
def unserialize(self, data):
|
def unserialize(self, data):
|
||||||
|
"""
|
||||||
|
Converts a serialized tuple of data to an object
|
||||||
|
"""
|
||||||
self.attribute_list = [Attribute().unserialize(item) for item in data]
|
self.attribute_list = [Attribute().unserialize(item) for item in data]
|
||||||
|
|
||||||
def add_attribute(self, attribute):
|
def add_attribute(self, attribute):
|
||||||
|
@ -20,9 +20,15 @@
|
|||||||
|
|
||||||
# $Id$
|
# $Id$
|
||||||
|
|
||||||
|
"""
|
||||||
|
Provides the different Attribute Types for GRAMPS
|
||||||
|
"""
|
||||||
|
|
||||||
from _GrampsType import GrampsType, init_map
|
from _GrampsType import GrampsType, init_map
|
||||||
from gettext import gettext as _
|
from gettext import gettext as _
|
||||||
|
|
||||||
|
__revision__ = "$Revision$"
|
||||||
|
|
||||||
class AttributeType(GrampsType):
|
class AttributeType(GrampsType):
|
||||||
|
|
||||||
UNKNOWN = -1
|
UNKNOWN = -1
|
||||||
|
@ -24,6 +24,8 @@
|
|||||||
Base Object class for GRAMPS
|
Base Object class for GRAMPS
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
__revision__ = "$Revision$"
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# standard python modules
|
# standard python modules
|
||||||
@ -50,9 +52,15 @@ class BaseObject:
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
def serialize(self):
|
def serialize(self):
|
||||||
|
"""
|
||||||
|
Converts the object to a serialized tuple of data
|
||||||
|
"""
|
||||||
assert False, "Needs to be overridden in the derived class"
|
assert False, "Needs to be overridden in the derived class"
|
||||||
|
|
||||||
def unserialize(self, data):
|
def unserialize(self, data):
|
||||||
|
"""
|
||||||
|
Converts a serialized tuple of data to an object
|
||||||
|
"""
|
||||||
assert False, "Needs to be overridden in the derived class"
|
assert False, "Needs to be overridden in the derived class"
|
||||||
return self
|
return self
|
||||||
|
|
||||||
|
@ -20,6 +20,8 @@
|
|||||||
|
|
||||||
# $Id$
|
# $Id$
|
||||||
|
|
||||||
|
__revision__ = "$Revision$"
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# Python modules
|
# Python modules
|
||||||
@ -97,43 +99,43 @@ def _tishri1(metonic_year, molad_day, molad_halakim):
|
|||||||
|
|
||||||
return tishri1
|
return tishri1
|
||||||
|
|
||||||
def _tishri_molad(inputDay):
|
def _tishri_molad(input_day):
|
||||||
|
|
||||||
# Estimate the metonic cycle number. Note that this may be an under
|
# Estimate the metonic cycle number. Note that this may be an under
|
||||||
# estimate because there are 6939.6896 days in a metonic cycle not
|
# estimate because there are 6939.6896 days in a metonic cycle not
|
||||||
# 6940, but it will never be an over estimate. The loop below will
|
# 6940, but it will never be an over estimate. The loop below will
|
||||||
# correct for any error in this estimate. */
|
# correct for any error in this estimate. */
|
||||||
|
|
||||||
metonicCycle = (inputDay + 310) / 6940
|
metonic_cycle = (input_day + 310) / 6940
|
||||||
|
|
||||||
# Calculate the time of the starting molad for this metonic cycle. */
|
# Calculate the time of the starting molad for this metonic cycle. */
|
||||||
|
|
||||||
(moladDay, moladHalakim) = _molad_of_metonic_cycle(metonicCycle)
|
(molad_day, molad_halakim) = _molad_of_metonic_cycle(metonic_cycle)
|
||||||
|
|
||||||
# If the above was an under estimate, increment the cycle number until
|
# If the above was an under estimate, increment the cycle number until
|
||||||
# the correct one is found. For modern dates this loop is about 98.6%
|
# the correct one is found. For modern dates this loop is about 98.6%
|
||||||
# likely to not execute, even once, because the above estimate is
|
# likely to not execute, even once, because the above estimate is
|
||||||
# really quite close.
|
# really quite close.
|
||||||
|
|
||||||
while moladDay < (inputDay - 6940 + 310):
|
while molad_day < (input_day - 6940 + 310):
|
||||||
metonicCycle = metonicCycle + 1
|
metonic_cycle = metonic_cycle + 1
|
||||||
moladHalakim = moladHalakim + _HBR_HALAKIM_PER_METONIC_CYCLE
|
molad_halakim = molad_halakim + _HBR_HALAKIM_PER_METONIC_CYCLE
|
||||||
moladDay = moladDay + ( moladHalakim / _HBR_HALAKIM_PER_DAY)
|
molad_day = molad_day + ( molad_halakim / _HBR_HALAKIM_PER_DAY)
|
||||||
moladHalakim = moladHalakim % _HBR_HALAKIM_PER_DAY
|
molad_halakim = molad_halakim % _HBR_HALAKIM_PER_DAY
|
||||||
|
|
||||||
# Find the molad of Tishri closest to this date.
|
# Find the molad of Tishri closest to this date.
|
||||||
|
|
||||||
for metonicYear in range(0,18):
|
for metonic_year in range(0, 18):
|
||||||
if moladDay > inputDay - 74:
|
if molad_day > input_day - 74:
|
||||||
break
|
break
|
||||||
|
|
||||||
moladHalakim = moladHalakim + (_HBR_HALAKIM_PER_LUNAR_CYCLE
|
molad_halakim = molad_halakim + (_HBR_HALAKIM_PER_LUNAR_CYCLE
|
||||||
* _HBR_MONTHS_PER_YEAR[metonicYear])
|
* _HBR_MONTHS_PER_YEAR[metonic_year])
|
||||||
moladDay = moladDay + (moladHalakim / _HBR_HALAKIM_PER_DAY)
|
molad_day = molad_day + (molad_halakim / _HBR_HALAKIM_PER_DAY)
|
||||||
moladHalakim = moladHalakim % _HBR_HALAKIM_PER_DAY
|
molad_halakim = molad_halakim % _HBR_HALAKIM_PER_DAY
|
||||||
else:
|
else:
|
||||||
metonicYear = metonicYear + 1
|
metonic_year = metonic_year + 1
|
||||||
return (metonicCycle, metonicYear, moladDay, moladHalakim)
|
return (metonic_cycle, metonic_year, molad_day, molad_halakim)
|
||||||
|
|
||||||
def _molad_of_metonic_cycle(metonic_cycle):
|
def _molad_of_metonic_cycle(metonic_cycle):
|
||||||
|
|
||||||
@ -254,110 +256,110 @@ def hebrew_sdn(year, month, day):
|
|||||||
def hebrew_ymd(sdn):
|
def hebrew_ymd(sdn):
|
||||||
"""Converts an SDN number to a Julian calendar date"""
|
"""Converts an SDN number to a Julian calendar date"""
|
||||||
|
|
||||||
inputDay = sdn - _HBR_SDN_OFFSET
|
input_day = sdn - _HBR_SDN_OFFSET
|
||||||
|
|
||||||
(metonicCycle, metonicYear, day, halakim) = _tishri_molad(inputDay)
|
(metonic_cycle, metonic_year, day, halakim) = _tishri_molad(input_day)
|
||||||
tishri1 = _tishri1(metonicYear, day, halakim);
|
tishri1 = _tishri1(metonic_year, day, halakim);
|
||||||
|
|
||||||
if inputDay >= tishri1:
|
if input_day >= tishri1:
|
||||||
# It found Tishri 1 at the start of the year
|
# It found Tishri 1 at the start of the year
|
||||||
|
|
||||||
Year = (metonicCycle * 19) + metonicYear + 1
|
year = (metonic_cycle * 19) + metonic_year + 1
|
||||||
if inputDay < tishri1 + 59:
|
if input_day < tishri1 + 59:
|
||||||
if inputDay < tishri1 + 30:
|
if input_day < tishri1 + 30:
|
||||||
Month = 1
|
month = 1
|
||||||
Day = inputDay - tishri1 + 1
|
day = input_day - tishri1 + 1
|
||||||
else:
|
else:
|
||||||
Month = 2
|
month = 2
|
||||||
Day = inputDay - tishri1 - 29
|
day = input_day - tishri1 - 29
|
||||||
return (Year, Month, Day)
|
return (year, month, day)
|
||||||
|
|
||||||
# We need the length of the year to figure this out, so find
|
# We need the length of the year to figure this out, so find
|
||||||
# Tishri 1 of the next year. */
|
# Tishri 1 of the next year. */
|
||||||
|
|
||||||
halakim = halakim + (_HBR_HALAKIM_PER_LUNAR_CYCLE
|
halakim = halakim + (_HBR_HALAKIM_PER_LUNAR_CYCLE
|
||||||
* _HBR_MONTHS_PER_YEAR[metonicYear])
|
* _HBR_MONTHS_PER_YEAR[metonic_year])
|
||||||
day = day + (halakim / _HBR_HALAKIM_PER_DAY)
|
day = day + (halakim / _HBR_HALAKIM_PER_DAY)
|
||||||
halakim = halakim % _HBR_HALAKIM_PER_DAY;
|
halakim = halakim % _HBR_HALAKIM_PER_DAY;
|
||||||
tishri1After = _tishri1((metonicYear + 1) % 19, day, halakim);
|
tishri1_after = _tishri1((metonic_year + 1) % 19, day, halakim);
|
||||||
else:
|
else:
|
||||||
# It found Tishri 1 at the end of the year.
|
# It found Tishri 1 at the end of the year.
|
||||||
|
|
||||||
Year = metonicCycle * 19 + metonicYear
|
year = metonic_cycle * 19 + metonic_year
|
||||||
if inputDay >= tishri1 - 177:
|
if input_day >= tishri1 - 177:
|
||||||
# It is one of the last 6 months of the year.
|
# It is one of the last 6 months of the year.
|
||||||
if inputDay > tishri1 - 30:
|
if input_day > tishri1 - 30:
|
||||||
Month = 13
|
month = 13
|
||||||
Day = inputDay - tishri1 + 30
|
day = input_day - tishri1 + 30
|
||||||
elif inputDay > tishri1 - 60:
|
elif input_day > tishri1 - 60:
|
||||||
Month = 12
|
month = 12
|
||||||
Day = inputDay - tishri1 + 60
|
day = input_day - tishri1 + 60
|
||||||
elif inputDay > tishri1 - 89:
|
elif input_day > tishri1 - 89:
|
||||||
Month = 11
|
month = 11
|
||||||
Day = inputDay - tishri1 + 89
|
day = input_day - tishri1 + 89
|
||||||
elif inputDay > tishri1 - 119:
|
elif input_day > tishri1 - 119:
|
||||||
Month = 10
|
month = 10
|
||||||
Day = inputDay - tishri1 + 119
|
day = input_day - tishri1 + 119
|
||||||
elif inputDay > tishri1 - 148:
|
elif input_day > tishri1 - 148:
|
||||||
Month = 9
|
month = 9
|
||||||
Day = inputDay - tishri1 + 148
|
day = input_day - tishri1 + 148
|
||||||
else:
|
else:
|
||||||
Month = 8
|
month = 8
|
||||||
Day = inputDay - tishri1 + 178
|
day = input_day - tishri1 + 178
|
||||||
return (Year,Month,Day)
|
return (year, month, day)
|
||||||
else:
|
else:
|
||||||
if _HBR_MONTHS_PER_YEAR[(Year - 1) % 19] == 13:
|
if _HBR_MONTHS_PER_YEAR[(year - 1) % 19] == 13:
|
||||||
Month = 7
|
month = 7
|
||||||
Day = inputDay - tishri1 + 207
|
day = input_day - tishri1 + 207
|
||||||
if Day > 0:
|
if day > 0:
|
||||||
return (Year,Month,Day)
|
return (year, month, day)
|
||||||
Month = Month - 1
|
month = month - 1
|
||||||
Day = Day + 30
|
day = day + 30
|
||||||
if Day > 0:
|
if day > 0:
|
||||||
return (Year,Month,Day)
|
return (year, month, day)
|
||||||
Month = Month - 1
|
month = month - 1
|
||||||
Day = Day + 30
|
day = day + 30
|
||||||
else:
|
else:
|
||||||
Month = 6
|
month = 6
|
||||||
Day = inputDay - tishri1 + 207
|
day = input_day - tishri1 + 207
|
||||||
if Day > 0:
|
if day > 0:
|
||||||
return (Year,Month,Day)
|
return (year, month, day)
|
||||||
Month = Month - 1
|
month = month - 1
|
||||||
Day = Day + 30
|
day = day + 30
|
||||||
|
|
||||||
if Day > 0:
|
if day > 0:
|
||||||
return (Year,Month,Day)
|
return (year, month, day)
|
||||||
Month = Month - 1
|
month = month - 1
|
||||||
Day = Day + 29
|
day = day + 29
|
||||||
if Day > 0:
|
if day > 0:
|
||||||
return (Year,Month,Day)
|
return (year, month, day)
|
||||||
|
|
||||||
# We need the length of the year to figure this out, so find
|
# We need the length of the year to figure this out, so find
|
||||||
# Tishri 1 of this year
|
# Tishri 1 of this year
|
||||||
tishri1After = tishri1;
|
tishri1_after = tishri1;
|
||||||
(metonicCycle,metonicYear,day,halakim) = _tishri_molad(day-365)
|
(metonic_cycle, metonic_year, day, halakim) = _tishri_molad(day-365)
|
||||||
tishri1 = _tishri1(metonicYear, day, halakim)
|
tishri1 = _tishri1(metonic_year, day, halakim)
|
||||||
|
|
||||||
yearLength = tishri1After - tishri1;
|
year_length = tishri1_after - tishri1;
|
||||||
cday = inputDay - tishri1 - 29;
|
cday = input_day - tishri1 - 29;
|
||||||
if yearLength == 355 or yearLength == 385 :
|
if year_length == 355 or year_length == 385 :
|
||||||
# Heshvan has 30 days
|
# Heshvan has 30 days
|
||||||
if day <= 30:
|
if day <= 30:
|
||||||
Month = 2
|
month = 2
|
||||||
Day = cday
|
day = cday
|
||||||
return (Year,Month,Day)
|
return (year, month, day)
|
||||||
day = day - 30
|
day = day - 30
|
||||||
else:
|
else:
|
||||||
# Heshvan has 29 days
|
# Heshvan has 29 days
|
||||||
if day <= 29:
|
if day <= 29:
|
||||||
Month = 2
|
month = 2
|
||||||
Day = cday
|
day = cday
|
||||||
return (Year,Month,Day)
|
return (year, month, day)
|
||||||
|
|
||||||
cday = cday - 29
|
cday = cday - 29
|
||||||
|
|
||||||
# It has to be Kislev
|
# It has to be Kislev
|
||||||
return (Year,3,cday)
|
return (year, 3, cday)
|
||||||
|
|
||||||
def julian_sdn(year, month, day):
|
def julian_sdn(year, month, day):
|
||||||
"""Converts a Julian calendar date to an SDN number"""
|
"""Converts a Julian calendar date to an SDN number"""
|
||||||
|
@ -24,6 +24,8 @@
|
|||||||
Child Reference class for GRAMPS.
|
Child Reference class for GRAMPS.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
__revision__ = "$Revision$"
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# GRAMPS modules
|
# GRAMPS modules
|
||||||
@ -64,6 +66,9 @@ class ChildRef(SecondaryObject,PrivacyBase,SourceBase,NoteBase,RefBase):
|
|||||||
self.mrel = ChildRefType()
|
self.mrel = ChildRefType()
|
||||||
|
|
||||||
def serialize(self):
|
def serialize(self):
|
||||||
|
"""
|
||||||
|
Converts the object to a serialized tuple of data
|
||||||
|
"""
|
||||||
return (PrivacyBase.serialize(self),
|
return (PrivacyBase.serialize(self),
|
||||||
SourceBase.serialize(self),
|
SourceBase.serialize(self),
|
||||||
NoteBase.serialize(self),
|
NoteBase.serialize(self),
|
||||||
@ -72,6 +77,9 @@ class ChildRef(SecondaryObject,PrivacyBase,SourceBase,NoteBase,RefBase):
|
|||||||
self.mrel.serialize())
|
self.mrel.serialize())
|
||||||
|
|
||||||
def unserialize(self, data):
|
def unserialize(self, data):
|
||||||
|
"""
|
||||||
|
Converts a serialized tuple of data to an object
|
||||||
|
"""
|
||||||
(privacy, source_list, note, ref, frel, mrel) = data
|
(privacy, source_list, note, ref, frel, mrel) = data
|
||||||
PrivacyBase.unserialize(self, privacy)
|
PrivacyBase.unserialize(self, privacy)
|
||||||
SourceBase.unserialize(self, source_list)
|
SourceBase.unserialize(self, source_list)
|
||||||
|
@ -20,9 +20,15 @@
|
|||||||
|
|
||||||
# $Id$
|
# $Id$
|
||||||
|
|
||||||
|
"""
|
||||||
|
Provides the different child reference types
|
||||||
|
"""
|
||||||
|
|
||||||
from _GrampsType import GrampsType, init_map
|
from _GrampsType import GrampsType, init_map
|
||||||
from gettext import gettext as _
|
from gettext import gettext as _
|
||||||
|
|
||||||
|
__revision__ = "$Revision$"
|
||||||
|
|
||||||
class ChildRefType(GrampsType):
|
class ChildRefType(GrampsType):
|
||||||
|
|
||||||
NONE = 0
|
NONE = 0
|
||||||
|
@ -24,6 +24,8 @@
|
|||||||
DateBase class for GRAMPS
|
DateBase class for GRAMPS
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
__revision__ = "$Revision$"
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# GRAMPS modules
|
# GRAMPS modules
|
||||||
@ -54,6 +56,9 @@ class DateBase:
|
|||||||
self.date = Date()
|
self.date = Date()
|
||||||
|
|
||||||
def serialize(self, no_text_date=False):
|
def serialize(self, no_text_date=False):
|
||||||
|
"""
|
||||||
|
Converts the object to a serialized tuple of data
|
||||||
|
"""
|
||||||
if self.date == None or (self.date.is_empty() and not self.date.text):
|
if self.date == None or (self.date.is_empty() and not self.date.text):
|
||||||
date = None
|
date = None
|
||||||
else:
|
else:
|
||||||
@ -61,6 +66,9 @@ class DateBase:
|
|||||||
return date
|
return date
|
||||||
|
|
||||||
def unserialize(self, data):
|
def unserialize(self, data):
|
||||||
|
"""
|
||||||
|
Converts a serialized tuple of data to an object
|
||||||
|
"""
|
||||||
if data == None:
|
if data == None:
|
||||||
self.date = Date()
|
self.date = Date()
|
||||||
else:
|
else:
|
||||||
|
@ -24,6 +24,8 @@
|
|||||||
Event object for GRAMPS
|
Event object for GRAMPS
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
__revision__ = "$Revision$"
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# GRAMPS modules
|
# GRAMPS modules
|
||||||
|
@ -24,6 +24,8 @@
|
|||||||
Event Reference class for GRAMPS
|
Event Reference class for GRAMPS
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
__revision__ = "$Revision$"
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# GRAMPS modules
|
# GRAMPS modules
|
||||||
@ -64,6 +66,9 @@ class EventRef(SecondaryObject,PrivacyBase,NoteBase,AttributeBase,RefBase):
|
|||||||
self.role = EventRoleType()
|
self.role = EventRoleType()
|
||||||
|
|
||||||
def serialize(self):
|
def serialize(self):
|
||||||
|
"""
|
||||||
|
Converts the object to a serialized tuple of data
|
||||||
|
"""
|
||||||
return (
|
return (
|
||||||
PrivacyBase.serialize(self),
|
PrivacyBase.serialize(self),
|
||||||
NoteBase.serialize(self),
|
NoteBase.serialize(self),
|
||||||
@ -73,6 +78,9 @@ class EventRef(SecondaryObject,PrivacyBase,NoteBase,AttributeBase,RefBase):
|
|||||||
)
|
)
|
||||||
|
|
||||||
def unserialize(self, data):
|
def unserialize(self, data):
|
||||||
|
"""
|
||||||
|
Converts a serialized tuple of data to an object
|
||||||
|
"""
|
||||||
(privacy, note, attribute_list, ref, role) = data
|
(privacy, note, attribute_list, ref, role) = data
|
||||||
PrivacyBase.unserialize(self, privacy)
|
PrivacyBase.unserialize(self, privacy)
|
||||||
NoteBase.unserialize(self, note)
|
NoteBase.unserialize(self, note)
|
||||||
|
@ -19,6 +19,12 @@
|
|||||||
#
|
#
|
||||||
# $Id$
|
# $Id$
|
||||||
|
|
||||||
|
"""
|
||||||
|
Provides the different event roles
|
||||||
|
"""
|
||||||
|
|
||||||
|
__revision__ = "$Revision$"
|
||||||
|
|
||||||
from _GrampsType import GrampsType, init_map
|
from _GrampsType import GrampsType, init_map
|
||||||
from gettext import gettext as _
|
from gettext import gettext as _
|
||||||
|
|
||||||
|
@ -20,6 +20,12 @@
|
|||||||
|
|
||||||
# $Id$
|
# $Id$
|
||||||
|
|
||||||
|
"""
|
||||||
|
Provides the different event types
|
||||||
|
"""
|
||||||
|
|
||||||
|
__revision__ = "$Revision$"
|
||||||
|
|
||||||
from _GrampsType import GrampsType, init_map
|
from _GrampsType import GrampsType, init_map
|
||||||
from gettext import gettext as _
|
from gettext import gettext as _
|
||||||
|
|
||||||
|
@ -24,6 +24,8 @@
|
|||||||
Family object for GRAMPS
|
Family object for GRAMPS
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
__revision__ = "$Revision$"
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# standard python modules
|
# standard python modules
|
||||||
@ -221,8 +223,8 @@ class Family(PrimaryObject,SourceBase,NoteBase,MediaBase,AttributeBase,
|
|||||||
@return: Returns the list of child secondary child objects that may refer sources.
|
@return: Returns the list of child secondary child objects that may refer sources.
|
||||||
@rtype: list
|
@rtype: list
|
||||||
"""
|
"""
|
||||||
check_list = self.media_list + self.attribute_list + self.lds_ord_list + \
|
check_list = self.media_list + self.attribute_list + \
|
||||||
self.child_ref_list
|
self.lds_ord_list + self.child_ref_list
|
||||||
return check_list
|
return check_list
|
||||||
|
|
||||||
def get_referenced_handles(self):
|
def get_referenced_handles(self):
|
||||||
@ -392,14 +394,6 @@ class Family(PrimaryObject,SourceBase,NoteBase,MediaBase,AttributeBase,
|
|||||||
"""
|
"""
|
||||||
self.child_ref_list = child_ref_list
|
self.child_ref_list = child_ref_list
|
||||||
|
|
||||||
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):
|
def add_event_ref(self, event_ref):
|
||||||
"""
|
"""
|
||||||
Adds the L{EventRef} to the Family instance's L{EventRef} list.
|
Adds the L{EventRef} to the Family instance's L{EventRef} list.
|
||||||
@ -415,7 +409,8 @@ class Family(PrimaryObject,SourceBase,NoteBase,MediaBase,AttributeBase,
|
|||||||
self.event_ref_list.append(event_ref)
|
self.event_ref_list.append(event_ref)
|
||||||
|
|
||||||
def get_event_list(self) :
|
def get_event_list(self) :
|
||||||
warn( "Use get_event_ref_list instead of get_event_list", DeprecationWarning, 2)
|
warn( "Use get_event_ref_list instead of get_event_list",
|
||||||
|
DeprecationWarning, 2)
|
||||||
# Wrapper for old API
|
# Wrapper for old API
|
||||||
# remove when transitition done.
|
# remove when transitition done.
|
||||||
event_handle_list = []
|
event_handle_list = []
|
||||||
@ -434,17 +429,6 @@ class Family(PrimaryObject,SourceBase,NoteBase,MediaBase,AttributeBase,
|
|||||||
"""
|
"""
|
||||||
return self.event_ref_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) :
|
def set_event_ref_list(self, event_ref_list) :
|
||||||
"""
|
"""
|
||||||
Sets the Family instance's L{EventRef} list to the passed list.
|
Sets the Family instance's L{EventRef} list to the passed list.
|
||||||
|
@ -19,6 +19,12 @@
|
|||||||
#
|
#
|
||||||
# $Id$
|
# $Id$
|
||||||
|
|
||||||
|
"""
|
||||||
|
Provides the different family reference types
|
||||||
|
"""
|
||||||
|
|
||||||
|
__revision__ = "$Revision$"
|
||||||
|
|
||||||
from _GrampsType import GrampsType, init_map
|
from _GrampsType import GrampsType, init_map
|
||||||
from gettext import gettext as _
|
from gettext import gettext as _
|
||||||
|
|
||||||
|
@ -24,6 +24,8 @@
|
|||||||
Gender statistics kept in GRAMPS database.
|
Gender statistics kept in GRAMPS database.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
__revision__ = "$Revision$"
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# GRAMPS modules
|
# GRAMPS modules
|
||||||
|
@ -20,6 +20,12 @@
|
|||||||
|
|
||||||
# $Id$
|
# $Id$
|
||||||
|
|
||||||
|
"""
|
||||||
|
Base type for all gramps types
|
||||||
|
"""
|
||||||
|
|
||||||
|
__revision__ = "$Revision$"
|
||||||
|
|
||||||
from gettext import gettext as _
|
from gettext import gettext as _
|
||||||
|
|
||||||
def init_map(data, key_col, data_col):
|
def init_map(data, key_col, data_col):
|
||||||
@ -41,6 +47,8 @@ class GrampsType:
|
|||||||
_E2IMAP = init_map(_DATAMAP, 2, 0)
|
_E2IMAP = init_map(_DATAMAP, 2, 0)
|
||||||
|
|
||||||
def __init__(self, value=None):
|
def __init__(self, value=None):
|
||||||
|
self.value = None
|
||||||
|
self.string = None
|
||||||
self.set(value)
|
self.set(value)
|
||||||
|
|
||||||
def set(self, value):
|
def set(self, value):
|
||||||
@ -86,9 +94,15 @@ class GrampsType:
|
|||||||
return self._I2EMAP[self.val]
|
return self._I2EMAP[self.val]
|
||||||
|
|
||||||
def serialize(self):
|
def serialize(self):
|
||||||
|
"""
|
||||||
|
Converts the object to a serialized tuple of data
|
||||||
|
"""
|
||||||
return (self.val, self.string)
|
return (self.val, self.string)
|
||||||
|
|
||||||
def unserialize(self, data):
|
def unserialize(self, data):
|
||||||
|
"""
|
||||||
|
Converts a serialized tuple of data to an object
|
||||||
|
"""
|
||||||
self.val, self.string = data
|
self.val, self.string = data
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
"""
|
"""
|
||||||
LDS Ordinance class for GRAMPS
|
LDS Ordinance class for GRAMPS
|
||||||
"""
|
"""
|
||||||
|
__revision__ = "$Revision$"
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@ -132,6 +133,9 @@ class LdsOrd(SecondaryObject,SourceBase,NoteBase,
|
|||||||
self.status = LdsOrd.DEFAULT_STATUS
|
self.status = LdsOrd.DEFAULT_STATUS
|
||||||
|
|
||||||
def serialize(self):
|
def serialize(self):
|
||||||
|
"""
|
||||||
|
Converts the object to a serialized tuple of data
|
||||||
|
"""
|
||||||
return (SourceBase.serialize(self),
|
return (SourceBase.serialize(self),
|
||||||
NoteBase.serialize(self),
|
NoteBase.serialize(self),
|
||||||
DateBase.serialize(self),
|
DateBase.serialize(self),
|
||||||
@ -139,6 +143,9 @@ class LdsOrd(SecondaryObject,SourceBase,NoteBase,
|
|||||||
self.famc, self.temple, self.status)
|
self.famc, self.temple, self.status)
|
||||||
|
|
||||||
def unserialize(self, data):
|
def unserialize(self, data):
|
||||||
|
"""
|
||||||
|
Converts a serialized tuple of data to an object
|
||||||
|
"""
|
||||||
(source_list, note, date, self.type, self.place,
|
(source_list, note, date, self.type, self.place,
|
||||||
self.famc, self.temple, self.status) = data
|
self.famc, self.temple, self.status) = data
|
||||||
SourceBase.unserialize(self, source_list)
|
SourceBase.unserialize(self, source_list)
|
||||||
|
@ -24,6 +24,8 @@
|
|||||||
LdsOrdBase class for GRAMPS
|
LdsOrdBase class for GRAMPS
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
__revision__ = "$Revision$"
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# GRAMPS modules
|
# GRAMPS modules
|
||||||
@ -57,9 +59,15 @@ class LdsOrdBase:
|
|||||||
self.lds_ord_list = []
|
self.lds_ord_list = []
|
||||||
|
|
||||||
def serialize(self):
|
def serialize(self):
|
||||||
|
"""
|
||||||
|
Converts the object to a serialized tuple of data
|
||||||
|
"""
|
||||||
return [lds_ord.serialize() for lds_ord in self.lds_ord_list]
|
return [lds_ord.serialize() for lds_ord in self.lds_ord_list]
|
||||||
|
|
||||||
def unserialize(self, data):
|
def unserialize(self, data):
|
||||||
|
"""
|
||||||
|
Converts a serialized tuple of data to an object
|
||||||
|
"""
|
||||||
self.lds_ord_list = [LdsOrd().unserialize(item) for item in data]
|
self.lds_ord_list = [LdsOrd().unserialize(item) for item in data]
|
||||||
|
|
||||||
def add_lds_ord(self, lds_ord):
|
def add_lds_ord(self, lds_ord):
|
||||||
|
@ -24,6 +24,8 @@
|
|||||||
Location class for GRAMPS
|
Location class for GRAMPS
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
__revision__ = "$Revision$"
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# GRAMPS modules
|
# GRAMPS modules
|
||||||
@ -59,11 +61,17 @@ class Location(SecondaryObject,LocationBase):
|
|||||||
self.parish = ""
|
self.parish = ""
|
||||||
|
|
||||||
def serialize(self):
|
def serialize(self):
|
||||||
|
"""
|
||||||
|
Converts the object to a serialized tuple of data
|
||||||
|
"""
|
||||||
return (LocationBase.serialize(self), self.parish)
|
return (LocationBase.serialize(self), self.parish)
|
||||||
|
|
||||||
def unserialize(self, data):
|
def unserialize(self, data):
|
||||||
(lb, self.parish) = data
|
"""
|
||||||
LocationBase.unserialize(self, lb)
|
Converts a serialized tuple of data to an object
|
||||||
|
"""
|
||||||
|
(lbase, self.parish) = data
|
||||||
|
LocationBase.unserialize(self, lbase)
|
||||||
return self
|
return self
|
||||||
|
|
||||||
def get_text_data_list(self):
|
def get_text_data_list(self):
|
||||||
|
@ -24,6 +24,8 @@
|
|||||||
LocationBase class for GRAMPS
|
LocationBase class for GRAMPS
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
__revision__ = "$Revision$"
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# LocationBase class
|
# LocationBase class
|
||||||
@ -57,10 +59,16 @@ class LocationBase:
|
|||||||
self.phone = ""
|
self.phone = ""
|
||||||
|
|
||||||
def serialize(self):
|
def serialize(self):
|
||||||
|
"""
|
||||||
|
Converts the object to a serialized tuple of data
|
||||||
|
"""
|
||||||
return (self.street, self.city, self.county, self.state,
|
return (self.street, self.city, self.county, self.state,
|
||||||
self.country, self.postal, self.phone)
|
self.country, self.postal, self.phone)
|
||||||
|
|
||||||
def unserialize(self, data):
|
def unserialize(self, data):
|
||||||
|
"""
|
||||||
|
Converts a serialized tuple of data to an object
|
||||||
|
"""
|
||||||
(self.street, self.city, self.county, self.state, self.country,
|
(self.street, self.city, self.county, self.state, self.country,
|
||||||
self.postal, self.phone) = data
|
self.postal, self.phone) = data
|
||||||
return self
|
return self
|
||||||
|
@ -19,15 +19,24 @@
|
|||||||
#
|
#
|
||||||
# $Id$
|
# $Id$
|
||||||
|
|
||||||
|
"""
|
||||||
|
Marker types
|
||||||
|
"""
|
||||||
|
|
||||||
|
__revision__ = "$Revision$"
|
||||||
|
|
||||||
from _GrampsType import GrampsType, init_map
|
from _GrampsType import GrampsType, init_map
|
||||||
from gettext import gettext as _
|
from gettext import gettext as _
|
||||||
|
|
||||||
class MarkerType(GrampsType):
|
class MarkerType(GrampsType):
|
||||||
|
"""
|
||||||
|
Class for handling data markers.
|
||||||
|
"""
|
||||||
|
|
||||||
NONE = -1
|
NONE = -1
|
||||||
CUSTOM = 0
|
CUSTOM = 0
|
||||||
COMPLETE = 1
|
COMPLETE = 1
|
||||||
TODO = 2
|
TODO_TYPE = 2
|
||||||
|
|
||||||
_CUSTOM = CUSTOM
|
_CUSTOM = CUSTOM
|
||||||
_DEFAULT = NONE
|
_DEFAULT = NONE
|
||||||
@ -36,7 +45,7 @@ class MarkerType(GrampsType):
|
|||||||
(NONE, "", ""),
|
(NONE, "", ""),
|
||||||
(CUSTOM, _("Custom"), "Custom"),
|
(CUSTOM, _("Custom"), "Custom"),
|
||||||
(COMPLETE, _("Complete"), "Complete"),
|
(COMPLETE, _("Complete"), "Complete"),
|
||||||
(TODO, _("ToDo"), "ToDo"),
|
(TODO_TYPE, _("ToDo"), "ToDo"),
|
||||||
]
|
]
|
||||||
|
|
||||||
_I2SMAP = init_map(_DATAMAP, 0, 1)
|
_I2SMAP = init_map(_DATAMAP, 0, 1)
|
||||||
@ -48,6 +57,9 @@ class MarkerType(GrampsType):
|
|||||||
GrampsType.__init__(self, value)
|
GrampsType.__init__(self, value)
|
||||||
|
|
||||||
def set(self, value):
|
def set(self, value):
|
||||||
|
"""
|
||||||
|
sets the marker value
|
||||||
|
"""
|
||||||
if isinstance(value, self.__class__):
|
if isinstance(value, self.__class__):
|
||||||
if value.val == self.CUSTOM and value.string == '':
|
if value.val == self.CUSTOM and value.string == '':
|
||||||
self.val = self.NONE
|
self.val = self.NONE
|
||||||
|
@ -24,6 +24,8 @@
|
|||||||
MediaBase class for GRAMPS
|
MediaBase class for GRAMPS
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
__revision__ = "$Revision$"
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# GRAMPS modules
|
# GRAMPS modules
|
||||||
@ -55,9 +57,15 @@ class MediaBase:
|
|||||||
self.media_list = []
|
self.media_list = []
|
||||||
|
|
||||||
def serialize(self):
|
def serialize(self):
|
||||||
|
"""
|
||||||
|
Converts the object to a serialized tuple of data
|
||||||
|
"""
|
||||||
return [mref.serialize() for mref in self.media_list]
|
return [mref.serialize() for mref in self.media_list]
|
||||||
|
|
||||||
def unserialize(self, data):
|
def unserialize(self, data):
|
||||||
|
"""
|
||||||
|
Converts a serialized tuple of data to an object
|
||||||
|
"""
|
||||||
self.media_list = [MediaRef().unserialize(item) for item in data]
|
self.media_list = [MediaRef().unserialize(item) for item in data]
|
||||||
|
|
||||||
def add_media_reference(self, media_ref):
|
def add_media_reference(self, media_ref):
|
||||||
|
@ -24,6 +24,8 @@
|
|||||||
Media object for GRAMPS
|
Media object for GRAMPS
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
__revision__ = "$Revision$"
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# standard python modules
|
# standard python modules
|
||||||
@ -71,13 +73,11 @@ class MediaObject(PrimaryObject,SourceBase,NoteBase,DateBase,AttributeBase):
|
|||||||
self.path = source.path
|
self.path = source.path
|
||||||
self.mime = source.mime
|
self.mime = source.mime
|
||||||
self.desc = source.desc
|
self.desc = source.desc
|
||||||
# FIXME: thumb is not currently being serialized!
|
|
||||||
self.thumb = source.thumb
|
self.thumb = source.thumb
|
||||||
else:
|
else:
|
||||||
self.path = ""
|
self.path = ""
|
||||||
self.mime = ""
|
self.mime = ""
|
||||||
self.desc = ""
|
self.desc = ""
|
||||||
# FIXME: thumb is not currently being serialized!
|
|
||||||
self.thumb = None
|
self.thumb = None
|
||||||
|
|
||||||
def serialize(self):
|
def serialize(self):
|
||||||
@ -131,7 +131,6 @@ class MediaObject(PrimaryObject,SourceBase,NoteBase,DateBase,AttributeBase):
|
|||||||
@rtype: list
|
@rtype: list
|
||||||
"""
|
"""
|
||||||
return [self.path, self.mime, self.desc, self.gramps_id]
|
return [self.path, self.mime, self.desc, self.gramps_id]
|
||||||
#return [self.path,self.mime,self.desc,self.get_date(),self.gramps_id]
|
|
||||||
|
|
||||||
def get_text_data_child_list(self):
|
def get_text_data_child_list(self):
|
||||||
"""
|
"""
|
||||||
@ -164,14 +163,14 @@ class MediaObject(PrimaryObject,SourceBase,NoteBase,DateBase,AttributeBase):
|
|||||||
"""
|
"""
|
||||||
return self.attribute_list + self.source_list
|
return self.attribute_list + self.source_list
|
||||||
|
|
||||||
def set_mime_type(self,type):
|
def set_mime_type(self, mime_type):
|
||||||
"""
|
"""
|
||||||
Sets the MIME type associated with the MediaObject
|
Sets the MIME type associated with the MediaObject
|
||||||
|
|
||||||
@param type: MIME type to be assigned to the object
|
@param type: MIME type to be assigned to the object
|
||||||
@type type: str
|
@type type: str
|
||||||
"""
|
"""
|
||||||
self.mime = type
|
self.mime = mime_type
|
||||||
|
|
||||||
def get_mime_type(self):
|
def get_mime_type(self):
|
||||||
"""
|
"""
|
||||||
|
@ -24,6 +24,8 @@
|
|||||||
Media Reference class for GRAMPS
|
Media Reference class for GRAMPS
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
__revision__ = "$Revision$"
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# GRAMPS modules
|
# GRAMPS modules
|
||||||
@ -59,6 +61,9 @@ class MediaRef(SecondaryObject,PrivacyBase,SourceBase,NoteBase,RefBase,
|
|||||||
self.rect = None
|
self.rect = None
|
||||||
|
|
||||||
def serialize(self):
|
def serialize(self):
|
||||||
|
"""
|
||||||
|
Converts the object to a serialized tuple of data
|
||||||
|
"""
|
||||||
return (PrivacyBase.serialize(self),
|
return (PrivacyBase.serialize(self),
|
||||||
SourceBase.serialize(self),
|
SourceBase.serialize(self),
|
||||||
NoteBase.serialize(self),
|
NoteBase.serialize(self),
|
||||||
@ -67,6 +72,9 @@ class MediaRef(SecondaryObject,PrivacyBase,SourceBase,NoteBase,RefBase,
|
|||||||
self.rect)
|
self.rect)
|
||||||
|
|
||||||
def unserialize(self, data):
|
def unserialize(self, data):
|
||||||
|
"""
|
||||||
|
Converts a serialized tuple of data to an object
|
||||||
|
"""
|
||||||
(privacy, source_list, note, attribute_list, ref, self.rect) = data
|
(privacy, source_list, note, attribute_list, ref, self.rect) = data
|
||||||
PrivacyBase.unserialize(self, privacy)
|
PrivacyBase.unserialize(self, privacy)
|
||||||
SourceBase.unserialize(self, source_list)
|
SourceBase.unserialize(self, source_list)
|
||||||
|
@ -24,6 +24,8 @@
|
|||||||
Name class for GRAMPS
|
Name class for GRAMPS
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
__revision__ = "$Revision$"
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# GRAMPS modules
|
# GRAMPS modules
|
||||||
@ -57,6 +59,10 @@ class Name(SecondaryObject,PrivacyBase,SourceBase,NoteBase,DateBase):
|
|||||||
def __init__(self, source=None, data=None):
|
def __init__(self, source=None, data=None):
|
||||||
"""creates a new Name instance, copying from the source if provided"""
|
"""creates a new Name instance, copying from the source if provided"""
|
||||||
SecondaryObject.__init__(self)
|
SecondaryObject.__init__(self)
|
||||||
|
PrivacyBase.__init__(self, source)
|
||||||
|
SourceBase.__init__(self, source)
|
||||||
|
NoteBase.__init__(self, source)
|
||||||
|
DateBase.__init__(self, source)
|
||||||
if data:
|
if data:
|
||||||
(privacy, source_list, note, date,
|
(privacy, source_list, note, date,
|
||||||
self.first_name, self.surname, self.suffix, self.title,
|
self.first_name, self.surname, self.suffix, self.title,
|
||||||
@ -68,10 +74,6 @@ class Name(SecondaryObject,PrivacyBase,SourceBase,NoteBase,DateBase):
|
|||||||
NoteBase.unserialize(self, note)
|
NoteBase.unserialize(self, note)
|
||||||
DateBase.unserialize(self, date)
|
DateBase.unserialize(self, date)
|
||||||
elif source:
|
elif source:
|
||||||
PrivacyBase.__init__(self,source)
|
|
||||||
SourceBase.__init__(self,source)
|
|
||||||
NoteBase.__init__(self,source)
|
|
||||||
DateBase.__init__(self,source)
|
|
||||||
self.first_name = source.first_name
|
self.first_name = source.first_name
|
||||||
self.surname = source.surname
|
self.surname = source.surname
|
||||||
self.suffix = source.suffix
|
self.suffix = source.suffix
|
||||||
@ -84,10 +86,6 @@ class Name(SecondaryObject,PrivacyBase,SourceBase,NoteBase,DateBase):
|
|||||||
self.display_as = source.display_as
|
self.display_as = source.display_as
|
||||||
self.call = source.call
|
self.call = source.call
|
||||||
else:
|
else:
|
||||||
PrivacyBase.__init__(self,source)
|
|
||||||
SourceBase.__init__(self,source)
|
|
||||||
NoteBase.__init__(self,source)
|
|
||||||
DateBase.__init__(self,source)
|
|
||||||
self.first_name = ""
|
self.first_name = ""
|
||||||
self.surname = ""
|
self.surname = ""
|
||||||
self.suffix = ""
|
self.suffix = ""
|
||||||
@ -101,6 +99,9 @@ class Name(SecondaryObject,PrivacyBase,SourceBase,NoteBase,DateBase):
|
|||||||
self.call = ''
|
self.call = ''
|
||||||
|
|
||||||
def serialize(self):
|
def serialize(self):
|
||||||
|
"""
|
||||||
|
Converts the object to a serialized tuple of data
|
||||||
|
"""
|
||||||
return (PrivacyBase.serialize(self),
|
return (PrivacyBase.serialize(self),
|
||||||
SourceBase.serialize(self),
|
SourceBase.serialize(self),
|
||||||
NoteBase.serialize(self),
|
NoteBase.serialize(self),
|
||||||
@ -110,11 +111,17 @@ class Name(SecondaryObject,PrivacyBase,SourceBase,NoteBase,DateBase):
|
|||||||
self.group_as, self.sort_as, self.display_as, self.call)
|
self.group_as, self.sort_as, self.display_as, self.call)
|
||||||
|
|
||||||
def is_empty(self):
|
def is_empty(self):
|
||||||
|
"""
|
||||||
|
Indicates if the name is empty
|
||||||
|
"""
|
||||||
return (self.first_name == u"" and self.surname == u"" and
|
return (self.first_name == u"" and self.surname == u"" and
|
||||||
self.suffix == u"" and self.title == u"" and
|
self.suffix == u"" and self.title == u"" and
|
||||||
self.prefix == u"" and self.patronymic == u"")
|
self.prefix == u"" and self.patronymic == u"")
|
||||||
|
|
||||||
def unserialize(self, data):
|
def unserialize(self, data):
|
||||||
|
"""
|
||||||
|
Converts a serialized tuple of data to an object
|
||||||
|
"""
|
||||||
(privacy, source_list, note, date,
|
(privacy, source_list, note, date,
|
||||||
self.first_name, self.surname, self.suffix, self.title,
|
self.first_name, self.surname, self.suffix, self.title,
|
||||||
name_type, self.prefix, self.patronymic,
|
name_type, self.prefix, self.patronymic,
|
||||||
@ -304,7 +311,8 @@ class Name(SecondaryObject,PrivacyBase,SourceBase,NoteBase,DateBase):
|
|||||||
first = self.first_name
|
first = self.first_name
|
||||||
if self.suffix:
|
if self.suffix:
|
||||||
if self.prefix:
|
if self.prefix:
|
||||||
return "%s %s, %s %s" % (self.prefix, self.surname, first, self.suffix)
|
return "%s %s, %s %s" % (self.prefix, self.surname,
|
||||||
|
first, self.suffix)
|
||||||
else:
|
else:
|
||||||
return "%s, %s %s" % (self.surname, first, self.suffix)
|
return "%s, %s %s" % (self.surname, first, self.suffix)
|
||||||
else:
|
else:
|
||||||
@ -323,12 +331,16 @@ class Name(SecondaryObject,PrivacyBase,SourceBase,NoteBase,DateBase):
|
|||||||
first = self.first_name
|
first = self.first_name
|
||||||
if self.suffix:
|
if self.suffix:
|
||||||
if self.prefix:
|
if self.prefix:
|
||||||
return "%s %s, %s %s" % (self.prefix.upper(), self.surname.upper(), first, self.suffix)
|
return "%s %s, %s %s" % (self.prefix.upper(),
|
||||||
|
self.surname.upper(), first,
|
||||||
|
self.suffix)
|
||||||
else:
|
else:
|
||||||
return "%s, %s %s" % (self.surname.upper(), first, self.suffix)
|
return "%s, %s %s" % (self.surname.upper(), first, self.suffix)
|
||||||
else:
|
else:
|
||||||
if self.prefix:
|
if self.prefix:
|
||||||
return "%s %s, %s" % (self.prefix.upper(), self.surname.upper(), first)
|
return "%s %s, %s" % (self.prefix.upper(),
|
||||||
|
self.surname.upper(),
|
||||||
|
first)
|
||||||
else:
|
else:
|
||||||
return "%s, %s" % (self.surname.upper(), first)
|
return "%s, %s" % (self.surname.upper(), first)
|
||||||
|
|
||||||
@ -346,6 +358,7 @@ class Name(SecondaryObject,PrivacyBase,SourceBase,NoteBase,DateBase):
|
|||||||
return "%s %s" % (first, self.surname)
|
return "%s %s" % (first, self.surname)
|
||||||
else:
|
else:
|
||||||
if self.prefix:
|
if self.prefix:
|
||||||
return "%s %s %s, %s" % (first, self.prefix, self.surname, self.suffix)
|
return "%s %s %s, %s" % (first, self.prefix, self.surname,
|
||||||
|
self.suffix)
|
||||||
else:
|
else:
|
||||||
return "%s %s, %s" % (first, self.surname, self.suffix)
|
return "%s %s, %s" % (first, self.surname, self.suffix)
|
||||||
|
@ -20,6 +20,12 @@
|
|||||||
|
|
||||||
# $Id$
|
# $Id$
|
||||||
|
|
||||||
|
"""
|
||||||
|
Name types
|
||||||
|
"""
|
||||||
|
|
||||||
|
__revision__ = "$Revision$"
|
||||||
|
|
||||||
from _GrampsType import GrampsType, init_map
|
from _GrampsType import GrampsType, init_map
|
||||||
from gettext import gettext as _
|
from gettext import gettext as _
|
||||||
|
|
||||||
|
@ -24,6 +24,8 @@
|
|||||||
Note class for GRAMPS
|
Note class for GRAMPS
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
__revision__ = "$Revision$"
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# GRAMPS modules
|
# GRAMPS modules
|
||||||
@ -54,9 +56,15 @@ class Note(SecondaryObject):
|
|||||||
self.format = 0
|
self.format = 0
|
||||||
|
|
||||||
def serialize(self):
|
def serialize(self):
|
||||||
|
"""
|
||||||
|
Converts the object to a serialized tuple of data
|
||||||
|
"""
|
||||||
return (self.text, self.format)
|
return (self.text, self.format)
|
||||||
|
|
||||||
def unserialize(self, data):
|
def unserialize(self, data):
|
||||||
|
"""
|
||||||
|
Converts a serialized tuple of data to an object
|
||||||
|
"""
|
||||||
if data:
|
if data:
|
||||||
(self.text, self.format) = data
|
(self.text, self.format) = data
|
||||||
return self
|
return self
|
||||||
|
@ -24,6 +24,8 @@
|
|||||||
NoteBase class for GRAMPS
|
NoteBase class for GRAMPS
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
__revision__ = "$Revision$"
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# GRAMPS modules
|
# GRAMPS modules
|
||||||
@ -55,11 +57,17 @@ class NoteBase:
|
|||||||
self.note = Note(text)
|
self.note = Note(text)
|
||||||
|
|
||||||
def serialize(self):
|
def serialize(self):
|
||||||
|
"""
|
||||||
|
Converts the object to a serialized tuple of data
|
||||||
|
"""
|
||||||
if self.note == None:
|
if self.note == None:
|
||||||
self.note = Note()
|
self.note = Note()
|
||||||
return self.note.serialize()
|
return self.note.serialize()
|
||||||
|
|
||||||
def unserialize(self, data):
|
def unserialize(self, data):
|
||||||
|
"""
|
||||||
|
Converts a serialized tuple of data to an object
|
||||||
|
"""
|
||||||
if data is not None:
|
if data is not None:
|
||||||
self.note = Note().unserialize(data)
|
self.note = Note().unserialize(data)
|
||||||
|
|
||||||
|
@ -24,6 +24,8 @@
|
|||||||
Person object for GRAMPS
|
Person object for GRAMPS
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
__revision__ = "$Revision$"
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# GRAMPS modules
|
# GRAMPS modules
|
||||||
@ -157,8 +159,7 @@ class Person(PrimaryObject,SourceBase,NoteBase,MediaBase,
|
|||||||
Person object
|
Person object
|
||||||
@type data: tuple
|
@type data: tuple
|
||||||
"""
|
"""
|
||||||
(
|
(self.handle, # 0
|
||||||
self.handle, # 0
|
|
||||||
self.gramps_id, # 1
|
self.gramps_id, # 1
|
||||||
self.gender, # 2
|
self.gender, # 2
|
||||||
primary_name, # 3
|
primary_name, # 3
|
||||||
|
@ -24,6 +24,8 @@
|
|||||||
Person Reference class for GRAMPS.
|
Person Reference class for GRAMPS.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
__revision__ = "$Revision$"
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# GRAMPS modules
|
# GRAMPS modules
|
||||||
@ -61,6 +63,9 @@ class PersonRef(SecondaryObject,PrivacyBase,SourceBase,NoteBase,RefBase):
|
|||||||
self.rel = ''
|
self.rel = ''
|
||||||
|
|
||||||
def serialize(self):
|
def serialize(self):
|
||||||
|
"""
|
||||||
|
Converts the object to a serialized tuple of data
|
||||||
|
"""
|
||||||
return (PrivacyBase.serialize(self),
|
return (PrivacyBase.serialize(self),
|
||||||
SourceBase.serialize(self),
|
SourceBase.serialize(self),
|
||||||
NoteBase.serialize(self),
|
NoteBase.serialize(self),
|
||||||
@ -68,6 +73,9 @@ class PersonRef(SecondaryObject,PrivacyBase,SourceBase,NoteBase,RefBase):
|
|||||||
self.rel)
|
self.rel)
|
||||||
|
|
||||||
def unserialize(self, data):
|
def unserialize(self, data):
|
||||||
|
"""
|
||||||
|
Converts a serialized tuple of data to an object
|
||||||
|
"""
|
||||||
(privacy, source_list, note, ref, self.rel) = data
|
(privacy, source_list, note, ref, self.rel) = data
|
||||||
PrivacyBase.unserialize(self, privacy)
|
PrivacyBase.unserialize(self, privacy)
|
||||||
SourceBase.unserialize(self, source_list)
|
SourceBase.unserialize(self, source_list)
|
||||||
|
@ -24,6 +24,8 @@
|
|||||||
Place object for GRAMPS
|
Place object for GRAMPS
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
__revision__ = "$Revision$"
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# GRAMPS modules
|
# GRAMPS modules
|
||||||
|
@ -24,6 +24,8 @@
|
|||||||
PlaceBase class for GRAMPS
|
PlaceBase class for GRAMPS
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
__revision__ = "$Revision$"
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# PlaceBase class
|
# PlaceBase class
|
||||||
|
@ -24,6 +24,8 @@
|
|||||||
Primary Object class for GRAMPS
|
Primary Object class for GRAMPS
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
__revision__ = "$Revision$"
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# standard python modules
|
# standard python modules
|
||||||
@ -66,7 +68,7 @@ class PrimaryObject(BaseObject,PrivacyBase):
|
|||||||
|
|
||||||
def __init__(self, source=None):
|
def __init__(self, source=None):
|
||||||
"""
|
"""
|
||||||
Initialize a PrimaryObject. If source is None, both the ID and handle
|
o Initialize a PrimaryObject. If source is None, both the ID and handle
|
||||||
are assigned as empty strings. If source is not None, then object
|
are assigned as empty strings. If source is not None, then object
|
||||||
is initialized from values of the source object.
|
is initialized from values of the source object.
|
||||||
|
|
||||||
@ -201,12 +203,21 @@ class PrimaryObject(BaseObject,PrivacyBase):
|
|||||||
self._replace_handle_reference(classname, old_handle, new_handle)
|
self._replace_handle_reference(classname, old_handle, new_handle)
|
||||||
|
|
||||||
def _has_handle_reference(self, classname, handle):
|
def _has_handle_reference(self, classname, handle):
|
||||||
|
"""
|
||||||
|
returns True if the handle is referenced by the object
|
||||||
|
"""
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def _remove_handle_references(self, classname, handle_list):
|
def _remove_handle_references(self, classname, handle_list):
|
||||||
|
"""
|
||||||
|
removes the handle references from the object
|
||||||
|
"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def _replace_handle_reference(self, classname, old_handle, new_handle):
|
def _replace_handle_reference(self, classname, old_handle, new_handle):
|
||||||
|
"""
|
||||||
|
replaces the handle reference with the new reference
|
||||||
|
"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def set_marker(self, marker):
|
def set_marker(self, marker):
|
||||||
|
@ -24,6 +24,8 @@
|
|||||||
PrivacyBase Object class for GRAMPS
|
PrivacyBase Object class for GRAMPS
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
__revision__ = "$Revision$"
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# PrivacyBase Object
|
# PrivacyBase Object
|
||||||
@ -49,9 +51,15 @@ class PrivacyBase:
|
|||||||
self.private = False
|
self.private = False
|
||||||
|
|
||||||
def serialize(self):
|
def serialize(self):
|
||||||
|
"""
|
||||||
|
Converts the object to a serialized tuple of data
|
||||||
|
"""
|
||||||
return self.private
|
return self.private
|
||||||
|
|
||||||
def unserialize(self, data):
|
def unserialize(self, data):
|
||||||
|
"""
|
||||||
|
Converts a serialized tuple of data to an object
|
||||||
|
"""
|
||||||
self.private = data
|
self.private = data
|
||||||
return self
|
return self
|
||||||
|
|
||||||
|
@ -24,6 +24,8 @@
|
|||||||
PrivateSourceNote class for GRAMPS
|
PrivateSourceNote class for GRAMPS
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
__revision__ = "$Revision$"
|
||||||
|
|
||||||
from _SourceNote import SourceNote
|
from _SourceNote import SourceNote
|
||||||
from _PrivacyBase import PrivacyBase
|
from _PrivacyBase import PrivacyBase
|
||||||
|
|
||||||
@ -33,7 +35,7 @@ from _PrivacyBase import PrivacyBase
|
|||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
class PrivateSourceNote(SourceNote, PrivacyBase):
|
class PrivateSourceNote(SourceNote, PrivacyBase):
|
||||||
# FIXME: this class is only present to enable db upgrade
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
SourceNote.__init__(self)
|
SourceNote.__init__(self)
|
||||||
PrivacyBase.__init__(self)
|
PrivacyBase.__init__(self)
|
||||||
|
@ -24,6 +24,8 @@
|
|||||||
Base Reference class for GRAMPS.
|
Base Reference class for GRAMPS.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
__revision__ = "$Revision$"
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# RefBase class
|
# RefBase class
|
||||||
@ -43,9 +45,15 @@ class RefBase:
|
|||||||
self.ref = None
|
self.ref = None
|
||||||
|
|
||||||
def serialize(self):
|
def serialize(self):
|
||||||
|
"""
|
||||||
|
Converts the object to a serialized tuple of data
|
||||||
|
"""
|
||||||
return self.ref
|
return self.ref
|
||||||
|
|
||||||
def unserialize(self, data):
|
def unserialize(self, data):
|
||||||
|
"""
|
||||||
|
Converts a serialized tuple of data to an object
|
||||||
|
"""
|
||||||
self.ref = str(data)
|
self.ref = str(data)
|
||||||
return self
|
return self
|
||||||
|
|
||||||
|
@ -24,6 +24,8 @@
|
|||||||
Repository Reference class for GRAMPS
|
Repository Reference class for GRAMPS
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
__revision__ = "$Revision$"
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# GRAMPS modules
|
# GRAMPS modules
|
||||||
@ -56,12 +58,18 @@ class RepoRef(SecondaryObject,NoteBase,RefBase):
|
|||||||
self.media_type = SourceMediaType()
|
self.media_type = SourceMediaType()
|
||||||
|
|
||||||
def serialize(self):
|
def serialize(self):
|
||||||
|
"""
|
||||||
|
Converts the object to a serialized tuple of data
|
||||||
|
"""
|
||||||
return (
|
return (
|
||||||
NoteBase.serialize(self),
|
NoteBase.serialize(self),
|
||||||
RefBase.serialize(self),
|
RefBase.serialize(self),
|
||||||
self.call_number, self.media_type.serialize())
|
self.call_number, self.media_type.serialize())
|
||||||
|
|
||||||
def unserialize(self, data):
|
def unserialize(self, data):
|
||||||
|
"""
|
||||||
|
Converts a serialized tuple of data to an object
|
||||||
|
"""
|
||||||
(note, ref, self.call_number, media_type) = data
|
(note, ref, self.call_number, media_type) = data
|
||||||
self.media_type.unserialize(media_type)
|
self.media_type.unserialize(media_type)
|
||||||
NoteBase.unserialize(self, note)
|
NoteBase.unserialize(self, note)
|
||||||
|
@ -24,6 +24,8 @@
|
|||||||
Repository object for GRAMPS
|
Repository object for GRAMPS
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
__revision__ = "$Revision$"
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# GRAMPS modules
|
# GRAMPS modules
|
||||||
@ -53,6 +55,9 @@ class Repository(PrimaryObject,NoteBase,AddressBase,UrlBase):
|
|||||||
self.name = ""
|
self.name = ""
|
||||||
|
|
||||||
def serialize(self):
|
def serialize(self):
|
||||||
|
"""
|
||||||
|
Converts the object to a serialized tuple of data
|
||||||
|
"""
|
||||||
return (self.handle, self.gramps_id, self.type.serialize(),
|
return (self.handle, self.gramps_id, self.type.serialize(),
|
||||||
unicode(self.name),
|
unicode(self.name),
|
||||||
NoteBase.serialize(self),
|
NoteBase.serialize(self),
|
||||||
|
@ -20,6 +20,12 @@
|
|||||||
|
|
||||||
# $Id$
|
# $Id$
|
||||||
|
|
||||||
|
"""
|
||||||
|
Respository types
|
||||||
|
"""
|
||||||
|
|
||||||
|
__revision__ = "$Revision$"
|
||||||
|
|
||||||
from _GrampsType import GrampsType, init_map
|
from _GrampsType import GrampsType, init_map
|
||||||
from gettext import gettext as _
|
from gettext import gettext as _
|
||||||
|
|
||||||
|
@ -24,6 +24,8 @@
|
|||||||
Researcher informaiton for GRAMPS.
|
Researcher informaiton for GRAMPS.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
__revision__ = "$Revision$"
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# GRAMPS modules
|
# GRAMPS modules
|
||||||
|
@ -24,6 +24,8 @@
|
|||||||
Secondary Object class for GRAMPS
|
Secondary Object class for GRAMPS
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
__revision__ = "$Revision: $"
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# GRAMPS modules
|
# GRAMPS modules
|
||||||
|
@ -24,6 +24,8 @@
|
|||||||
Source object for GRAMPS
|
Source object for GRAMPS
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
__revision__ = "$Revision$"
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# GRAMPS modules
|
# GRAMPS modules
|
||||||
@ -57,6 +59,9 @@ class Source(PrimaryObject,MediaBase,NoteBase):
|
|||||||
self.reporef_list = []
|
self.reporef_list = []
|
||||||
|
|
||||||
def serialize(self):
|
def serialize(self):
|
||||||
|
"""
|
||||||
|
Converts the object to a serialized tuple of data
|
||||||
|
"""
|
||||||
return (self.handle, self.gramps_id, unicode(self.title),
|
return (self.handle, self.gramps_id, unicode(self.title),
|
||||||
unicode(self.author), unicode(self.pubinfo),
|
unicode(self.author), unicode(self.pubinfo),
|
||||||
NoteBase.serialize(self),
|
NoteBase.serialize(self),
|
||||||
|
@ -24,6 +24,8 @@
|
|||||||
SourceBase class for GRAMPS
|
SourceBase class for GRAMPS
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
__revision__ = "$Revision$"
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# GRAMPS modules
|
# GRAMPS modules
|
||||||
@ -54,9 +56,15 @@ class SourceBase:
|
|||||||
self.source_list = []
|
self.source_list = []
|
||||||
|
|
||||||
def serialize(self):
|
def serialize(self):
|
||||||
|
"""
|
||||||
|
Converts the object to a serialized tuple of data
|
||||||
|
"""
|
||||||
return [sref.serialize() for sref in self.source_list]
|
return [sref.serialize() for sref in self.source_list]
|
||||||
|
|
||||||
def unserialize(self, data):
|
def unserialize(self, data):
|
||||||
|
"""
|
||||||
|
Converts a serialized tuple of data to an object
|
||||||
|
"""
|
||||||
self.source_list = [SourceRef().unserialize(item) for item in data]
|
self.source_list = [SourceRef().unserialize(item) for item in data]
|
||||||
|
|
||||||
def add_source_reference(self, src_ref) :
|
def add_source_reference(self, src_ref) :
|
||||||
|
@ -19,6 +19,12 @@
|
|||||||
#
|
#
|
||||||
# $Id$
|
# $Id$
|
||||||
|
|
||||||
|
"""
|
||||||
|
SourceMedia types
|
||||||
|
"""
|
||||||
|
|
||||||
|
__revision__ = "$Revision$"
|
||||||
|
|
||||||
from _GrampsType import GrampsType, init_map
|
from _GrampsType import GrampsType, init_map
|
||||||
from gettext import gettext as _
|
from gettext import gettext as _
|
||||||
|
|
||||||
|
@ -24,12 +24,15 @@
|
|||||||
SourceNote class for GRAMPS
|
SourceNote class for GRAMPS
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
__revision__ = "$Revision$"
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# SourceNote classes
|
# SourceNote classes
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
class SourceNote:
|
class SourceNote:
|
||||||
# FIXME: this class is only present to enable db upgrade
|
"""this class is only present to enable db upgrade"""
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
pass
|
pass
|
||||||
|
@ -24,6 +24,8 @@
|
|||||||
Source Reference class for GRAMPS
|
Source Reference class for GRAMPS
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
__revision__ = "$Revision$"
|
||||||
|
|
||||||
from warnings import warn
|
from warnings import warn
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
@ -69,6 +71,9 @@ class SourceRef(SecondaryObject,DateBase,PrivacyBase,NoteBase,RefBase):
|
|||||||
self.text = ""
|
self.text = ""
|
||||||
|
|
||||||
def serialize(self):
|
def serialize(self):
|
||||||
|
"""
|
||||||
|
Converts the object to a serialized tuple of data
|
||||||
|
"""
|
||||||
return (DateBase.serialize(self),
|
return (DateBase.serialize(self),
|
||||||
PrivacyBase.serialize(self),
|
PrivacyBase.serialize(self),
|
||||||
NoteBase.serialize(self),
|
NoteBase.serialize(self),
|
||||||
@ -77,6 +82,9 @@ class SourceRef(SecondaryObject,DateBase,PrivacyBase,NoteBase,RefBase):
|
|||||||
self.page, self.text)
|
self.page, self.text)
|
||||||
|
|
||||||
def unserialize(self, data):
|
def unserialize(self, data):
|
||||||
|
"""
|
||||||
|
Converts a serialized tuple of data to an object
|
||||||
|
"""
|
||||||
(date, privacy, note,
|
(date, privacy, note,
|
||||||
self.confidence, ref, self.page, self.text) = data
|
self.confidence, ref, self.page, self.text) = data
|
||||||
DateBase.unserialize(self, date)
|
DateBase.unserialize(self, date)
|
||||||
@ -93,7 +101,6 @@ class SourceRef(SecondaryObject,DateBase,PrivacyBase,NoteBase,RefBase):
|
|||||||
@rtype: list
|
@rtype: list
|
||||||
"""
|
"""
|
||||||
return [self.page, self.text]
|
return [self.page, self.text]
|
||||||
#return [self.page,self.text,self.get_date()]
|
|
||||||
|
|
||||||
def get_text_data_child_list(self):
|
def get_text_data_child_list(self):
|
||||||
"""
|
"""
|
||||||
@ -142,5 +149,6 @@ class SourceRef(SecondaryObject,DateBase,PrivacyBase,NoteBase,RefBase):
|
|||||||
return self.text
|
return self.text
|
||||||
|
|
||||||
def are_equal(self, other):
|
def are_equal(self, other):
|
||||||
|
"""deprecated function - use are_equal instead"""
|
||||||
warn( "Use is_equal instead of are_equal", DeprecationWarning, 2)
|
warn( "Use is_equal instead of are_equal", DeprecationWarning, 2)
|
||||||
return self.is_equal(other)
|
return self.is_equal(other)
|
||||||
|
@ -24,6 +24,8 @@
|
|||||||
Url class for GRAMPS
|
Url class for GRAMPS
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
__revision__ = "$Revision$"
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# standard python modules
|
# standard python modules
|
||||||
@ -110,5 +112,7 @@ class Url(SecondaryObject,PrivacyBase):
|
|||||||
return self.type
|
return self.type
|
||||||
|
|
||||||
def are_equal(self, other):
|
def are_equal(self, other):
|
||||||
|
"""Deprecated - use is_equal instead"""
|
||||||
|
|
||||||
warn( "Use is_equal instead of are_equal", DeprecationWarning, 2)
|
warn( "Use is_equal instead of are_equal", DeprecationWarning, 2)
|
||||||
return self.is_equal(other)
|
return self.is_equal(other)
|
||||||
|
@ -24,6 +24,8 @@
|
|||||||
UrlBase class for GRAMPS
|
UrlBase class for GRAMPS
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
__revision__ = "$Revision$"
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# GRAMPS modules
|
# GRAMPS modules
|
||||||
@ -56,9 +58,15 @@ class UrlBase:
|
|||||||
self.urls = []
|
self.urls = []
|
||||||
|
|
||||||
def serialize(self):
|
def serialize(self):
|
||||||
|
"""
|
||||||
|
Converts the object to a serialized tuple of data
|
||||||
|
"""
|
||||||
return [url.serialize() for url in self.urls]
|
return [url.serialize() for url in self.urls]
|
||||||
|
|
||||||
def unserialize(self, data):
|
def unserialize(self, data):
|
||||||
|
"""
|
||||||
|
Converts a serialized tuple of data to an object
|
||||||
|
"""
|
||||||
self.urls = [Url().unserialize(item) for item in data]
|
self.urls = [Url().unserialize(item) for item in data]
|
||||||
|
|
||||||
def get_url_list(self):
|
def get_url_list(self):
|
||||||
@ -89,7 +97,6 @@ class UrlBase:
|
|||||||
"""
|
"""
|
||||||
self.urls.append(url)
|
self.urls.append(url)
|
||||||
|
|
||||||
|
|
||||||
def remove_url(self, url):
|
def remove_url(self, url):
|
||||||
"""
|
"""
|
||||||
Removes the specified L{Url} instance from the url list
|
Removes the specified L{Url} instance from the url list
|
||||||
|
@ -20,6 +20,12 @@
|
|||||||
|
|
||||||
# $Id$
|
# $Id$
|
||||||
|
|
||||||
|
"""
|
||||||
|
URL types
|
||||||
|
"""
|
||||||
|
|
||||||
|
__revision__ = "$Revision$"
|
||||||
|
|
||||||
from _GrampsType import GrampsType, init_map
|
from _GrampsType import GrampsType, init_map
|
||||||
from gettext import gettext as _
|
from gettext import gettext as _
|
||||||
|
|
||||||
|
@ -24,12 +24,14 @@
|
|||||||
Witness class for GRAMPS
|
Witness class for GRAMPS
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
__revision__ = "$Revision$"
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# Witness class
|
# Witness class
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
class Witness:
|
class Witness:
|
||||||
# FIXME: this class is only present to enable db upgrade
|
"""this class is only present to enable db upgrade"""
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
pass
|
pass
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
|
|
||||||
__author__ = "Donald N. Allingham"
|
__author__ = "Donald N. Allingham"
|
||||||
__version__ = "$Revision$"
|
__version__ = "$Revision$"
|
||||||
|
__revision__ = "$Revision$"
|
||||||
|
|
||||||
# Dates
|
# Dates
|
||||||
from _Date import Date, DateError
|
from _Date import Date, DateError
|
||||||
|
35
src/Utils.py
35
src/Utils.py
@ -610,7 +610,40 @@ def probably_alive(person,db,current_year=None,limit=0):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
# Neither birth nor death events are available. Try looking
|
# Neither birth nor death events are available. Try looking
|
||||||
# for descendants that were born more than a lifespan ago.
|
# at siblings. If a sibling was born more than 120 years past,
|
||||||
|
# or more than 20 future, then problem then this person is
|
||||||
|
# probably not alive. If the sibling died more than 120 years
|
||||||
|
# past, or more than 120 years future, then probably not alive.
|
||||||
|
|
||||||
|
family_list = person.get_parent_family_handle_list()
|
||||||
|
for family_handle in family_list:
|
||||||
|
family = db.get_family_from_handle(family_handle)
|
||||||
|
for child_ref in family.get_child_ref_list():
|
||||||
|
child_handle = child_ref.ref
|
||||||
|
child = db.get_person_from_handle(child_handle)
|
||||||
|
child_birth_ref = child.get_birth_ref()
|
||||||
|
if child_birth_ref:
|
||||||
|
child_birth = db.get_event_from_handle(child_birth_ref.ref)
|
||||||
|
dobj = child_birth.get_date_object()
|
||||||
|
if dobj.get_start_date() != RelLib.Date.EMPTY:
|
||||||
|
# if sibling birth date too far away, then not alive:
|
||||||
|
year = dobj.get_year()
|
||||||
|
if year != 0:
|
||||||
|
if not (current_year - 120 < year < current_year + 20):
|
||||||
|
return False
|
||||||
|
child_death_ref = child.get_death_ref()
|
||||||
|
if child_death_ref:
|
||||||
|
child_death = db.get_event_from_handle(child_death_ref.ref)
|
||||||
|
dobj = child_death.get_date_object()
|
||||||
|
if dobj.get_start_date() != RelLib.Date.EMPTY:
|
||||||
|
# if sibling death date too far away, then not alive:
|
||||||
|
year = dobj.get_year()
|
||||||
|
if year != 0:
|
||||||
|
if not (current_year - 120 < year < current_year + 120):
|
||||||
|
return False
|
||||||
|
|
||||||
|
# Try looking for descendants that were born more than a lifespan
|
||||||
|
# ago.
|
||||||
|
|
||||||
min_generation = 13
|
min_generation = 13
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user