svn: r8881

This commit is contained in:
Don Allingham 2007-08-28 03:57:56 +00:00
parent cca35a985d
commit 63c3d10963
23 changed files with 58 additions and 82 deletions

View File

@ -298,8 +298,12 @@ class GedcomWriter(UpdateCallback):
self.private = self.option_box.private self.private = self.option_box.private
if self.private: if self.private:
import _PrivateProxyDb from _PrivateProxyDb import PrivateProxyDb
self.db = _PrivateProxyDb.PrivateProxyDb(self.db) self.db = PrivateProxyDb(self.db)
if self.restrict:
from _LivingProxyDb import LivingProxyDb
self.db = LivingProxyDb(self.db, LivingProxyDb.MODE_RESTRICT)
if self.option_box.cfilter == None: if self.option_box.cfilter == None:
self.plist = set(self.db.get_person_handles(sort_handles=False)) self.plist = set(self.db.get_person_handles(sort_handles=False))
@ -457,11 +461,7 @@ class GedcomWriter(UpdateCallback):
sorted.sort() sorted.sort()
for data in sorted: for data in sorted:
person = self.db.get_person_from_handle(data[1]) self.__write_person(self.db.get_person_from_handle(data[1]))
if self.restrict:
if Utils.probably_alive(person, self.db):
person = ExportOptions.restrict_living(person)
self.__write_person(person)
self.update() self.update()
def __write_person(self, person): def __write_person(self, person):
@ -729,7 +729,6 @@ class GedcomWriter(UpdateCallback):
person = self.db.get_person_from_handle(person_handle) person = self.db.get_person_from_handle(person_handle)
gramps_id = person.get_gramps_id() gramps_id = person.get_gramps_id()
self.__writeln(1, token, '@%s@' % gramps_id) self.__writeln(1, token, '@%s@' % gramps_id)
return Utils.probably_alive(person, self.db)
def __write_family(self, family): def __write_family(self, family):
@ -1185,8 +1184,6 @@ def exportData(database, filename, person, option_box, callback=None):
try: try:
gw = GedcomWriter(database, person, 0, filename, option_box, callback) gw = GedcomWriter(database, person, 0, filename, option_box, callback)
ret = gw.export_data(filename) ret = gw.export_data(filename)
# except AttributeError, msg:
# RunDatabaseRepair(msg)
except Errors.DatabaseError, msg: except Errors.DatabaseError, msg:
ErrorDialog(_("Export failed"), str(msg)) ErrorDialog(_("Export failed"), str(msg))
return ret return ret

View File

@ -50,7 +50,6 @@ class Address(SecondaryObject, PrivacyBase, SourceBase, NoteBase, DateBase,
def __init__(self, source=None): def __init__(self, source=None):
"""Creates a new Address instance, copying from the source """Creates a new Address instance, copying from the source
if provided""" if provided"""
SecondaryObject.__init__(self)
PrivacyBase.__init__(self, source) PrivacyBase.__init__(self, source)
SourceBase.__init__(self, source) SourceBase.__init__(self, source)
NoteBase.__init__(self, source) NoteBase.__init__(self, source)

View File

@ -51,7 +51,6 @@ class AddressBase:
@param source: Object used to initialize the new object @param source: Object used to initialize the new object
@type source: AddressBase @type source: AddressBase
""" """
if source: if source:
self.address_list = [ Address(address) \ self.address_list = [ Address(address) \
for address in source.address_list ] for address in source.address_list ]

View File

@ -50,7 +50,6 @@ class Attribute(SecondaryObject, PrivacyBase, SourceBase, NoteBase):
""" """
Creates a new Attribute object, copying from the source if provided. Creates a new Attribute object, copying from the source if provided.
""" """
SecondaryObject.__init__(self)
PrivacyBase.__init__(self, source) PrivacyBase.__init__(self, source)
SourceBase.__init__(self, source) SourceBase.__init__(self, source)
NoteBase.__init__(self, source) NoteBase.__init__(self, source)

View File

@ -51,7 +51,6 @@ class AttributeBase:
@param source: Object used to initialize the new object @param source: Object used to initialize the new object
@type source: AttributeBase @type source: AttributeBase
""" """
if source: if source:
self.attribute_list = [ Attribute(attribute) \ self.attribute_list = [ Attribute(attribute) \
for attribute in source.attribute_list ] for attribute in source.attribute_list ]

View File

@ -45,12 +45,6 @@ class BaseObject:
to all objects, such as searching through all available information. to all objects, such as searching through all available information.
""" """
def __init__(self):
"""
Initialize a BaseObject.
"""
pass
def serialize(self): def serialize(self):
""" """
Converts the object to a serialized tuple of data Converts the object to a serialized tuple of data

View File

@ -76,7 +76,6 @@ class BasicPrimaryObject(BaseObject, PrivacyBase):
@param source: Object used to initialize the new object @param source: Object used to initialize the new object
@type source: PrimaryObject @type source: PrimaryObject
""" """
BaseObject.__init__(self)
PrivacyBase.__init__(self, source) PrivacyBase.__init__(self, source)
if source: if source:
self.gramps_id = source.gramps_id self.gramps_id = source.gramps_id

View File

@ -53,7 +53,6 @@ class ChildRef(SecondaryObject, PrivacyBase, SourceBase, NoteBase, RefBase):
""" """
def __init__(self, source=None): def __init__(self, source=None):
SecondaryObject.__init__(self)
PrivacyBase.__init__(self, source) PrivacyBase.__init__(self, source)
SourceBase.__init__(self, source) SourceBase.__init__(self, source)
NoteBase.__init__(self, source) NoteBase.__init__(self, source)

View File

@ -55,7 +55,6 @@ class EventRef(SecondaryObject, PrivacyBase, NoteBase, AttributeBase, RefBase):
""" """
Creates a new EventRef instance, copying from the source if present. Creates a new EventRef instance, copying from the source if present.
""" """
SecondaryObject.__init__(self)
PrivacyBase.__init__(self, source) PrivacyBase.__init__(self, source)
NoteBase.__init__(self, source) NoteBase.__init__(self, source)
AttributeBase.__init__(self, source) AttributeBase.__init__(self, source)

View File

@ -53,26 +53,40 @@ class GrampsType:
""" """
Creates a new type, initialize the value from one of several possible states. Creates a new type, initialize the value from one of several possible states.
""" """
self.value = None if value:
self.string = None
self.set(value) self.set(value)
else:
self.val = self._DEFAULT
self.string = u''
def set(self, value): def __set_tuple(self, value):
if isinstance(value, self.__class__):
self.val = value.val
self.string = value.string
elif type(value) == tuple:
self.val = value[0] self.val = value[0]
self.string = value[1] self.string = value[1]
elif type(value) == int:
def __set_int(self, value):
self.val = value self.val = value
self.string = u'' self.string = u''
elif type(value) in (str,unicode):
def __set_instance(self, value):
self.val = value.val
self.string = value.string
def __set_str(self, value):
self.val = self._S2IMAP.get(value, self._CUSTOM) self.val = self._S2IMAP.get(value, self._CUSTOM)
if self.val == self._CUSTOM: if self.val == self._CUSTOM:
self.string = value self.string = value
else: else:
self.string = u'' self.string = u''
def set(self, value):
if type(value) == tuple:
self.__set_tuple(value)
elif type(value) == int:
self.__set_int(value)
elif isinstance(value, self.__class__):
self.__set_instance(value)
elif type(value) in (str,unicode):
self.__set_str(value)
else: else:
self.val = self._DEFAULT self.val = self._DEFAULT
self.string = u'' self.string = u''

View File

@ -114,7 +114,6 @@ class LdsOrd(SecondaryObject, SourceBase, NoteBase,
def __init__(self, source=None): def __init__(self, source=None):
"""Creates a LDS Ordinance instance""" """Creates a LDS Ordinance instance"""
SecondaryObject.__init__(self)
SourceBase.__init__(self, source) SourceBase.__init__(self, source)
NoteBase.__init__(self, source) NoteBase.__init__(self, source)
DateBase.__init__(self, source) DateBase.__init__(self, source)

View File

@ -52,8 +52,6 @@ class Location(SecondaryObject, LocationBase):
""" """
Creates a Location object, copying from the source object if it exists. Creates a Location object, copying from the source object if it exists.
""" """
SecondaryObject.__init__(self)
LocationBase.__init__(self, source) LocationBase.__init__(self, source)
if source: if source:
self.parish = source.parish self.parish = source.parish

View File

@ -47,8 +47,6 @@ class MediaRef(SecondaryObject, PrivacyBase, SourceBase, NoteBase, RefBase,
AttributeBase): AttributeBase):
"""Media reference class""" """Media reference class"""
def __init__(self, source=None): def __init__(self, source=None):
SecondaryObject.__init__(self)
PrivacyBase.__init__(self, source) PrivacyBase.__init__(self, source)
SourceBase.__init__(self, source) SourceBase.__init__(self, source)
NoteBase.__init__(self, source) NoteBase.__init__(self, source)

View File

@ -58,7 +58,6 @@ 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)
PrivacyBase.__init__(self, source) PrivacyBase.__init__(self, source)
SourceBase.__init__(self, source) SourceBase.__init__(self, source)
NoteBase.__init__(self, source) NoteBase.__init__(self, source)

View File

@ -112,7 +112,6 @@ class NoteType(GrampsType):
def __init__(self, value=None): def __init__(self, value=None):
GrampsType.__init__(self, value) GrampsType.__init__(self, value)
def get_ignore_list(self, exception): def get_ignore_list(self, exception):
""" """
Return a list of the types to ignore and not include in default lists Return a list of the types to ignore and not include in default lists

View File

@ -84,6 +84,9 @@ class Person(SourceBase, NoteBase, AttributeBase, MediaBase,
data items have empty or null values, including the database data items have empty or null values, including the database
handle. handle.
""" """
if data:
self.unserialize(data)
else:
PrimaryObject.__init__(self) PrimaryObject.__init__(self)
SourceBase.__init__(self) SourceBase.__init__(self)
NoteBase.__init__(self) NoteBase.__init__(self)
@ -102,9 +105,6 @@ class Person(SourceBase, NoteBase, AttributeBase, MediaBase,
self.death_ref_index = -1 self.death_ref_index = -1
self.birth_ref_index = -1 self.birth_ref_index = -1
if data:
self.unserialize(data)
# We hold a reference to the GrampsDB so that we can maintain # We hold a reference to the GrampsDB so that we can maintain
# its genderStats. It doesn't get set here, but from # its genderStats. It doesn't get set here, but from
# GenderStats.count_person. # GenderStats.count_person.

View File

@ -52,7 +52,6 @@ class PersonRef(SecondaryObject, PrivacyBase, SourceBase, NoteBase, RefBase):
""" """
def __init__(self, source=None): def __init__(self, source=None):
SecondaryObject.__init__(self)
PrivacyBase.__init__(self, source) PrivacyBase.__init__(self, source)
SourceBase.__init__(self, source) SourceBase.__init__(self, source)
NoteBase.__init__(self, source) NoteBase.__init__(self, source)

View File

@ -48,7 +48,6 @@ class RepoRef(SecondaryObject, PrivacyBase, NoteBase, RefBase):
""" """
def __init__(self, source=None): def __init__(self, source=None):
SecondaryObject.__init__(self)
PrivacyBase.__init__(self, source) PrivacyBase.__init__(self, source)
NoteBase.__init__(self, source) NoteBase.__init__(self, source)
RefBase.__init__(self, source) RefBase.__init__(self, source)

View File

@ -47,16 +47,5 @@ class SecondaryObject(BaseObject):
ID is the user visible version. ID is the user visible version.
""" """
def __init__(self, source=None):
"""
Initialize a SecondaryObject. If source is None, both the ID and handle
are assigned as empty strings. If source is not None, then object
is initialized from values of the source object.
@param source: Object used to initialize the new object
@type source: SecondaryObject
"""
BaseObject.__init__(self)
def is_equal(self, source): def is_equal(self, source):
return cmp(self.serialize(), source.serialize()) == 0 return cmp(self.serialize(), source.serialize()) == 0

View File

@ -56,7 +56,6 @@ class SourceRef(SecondaryObject, DateBase, PrivacyBase, NoteBase, RefBase):
def __init__(self, source=None): def __init__(self, source=None):
"""creates a new SourceRef, copying from the source if present""" """creates a new SourceRef, copying from the source if present"""
SecondaryObject.__init__(self)
DateBase.__init__(self, source) DateBase.__init__(self, source)
PrivacyBase.__init__(self, source) PrivacyBase.__init__(self, source)
NoteBase.__init__(self, source) NoteBase.__init__(self, source)

View File

@ -53,7 +53,6 @@ class Url(SecondaryObject, PrivacyBase):
def __init__(self, source=None): def __init__(self, source=None):
"""creates a new URL instance, copying from the source if present""" """creates a new URL instance, copying from the source if present"""
SecondaryObject.__init__(self)
PrivacyBase.__init__(self, source) PrivacyBase.__init__(self, source)
if source: if source:
self.path = source.path self.path = source.path