svn: r8881
This commit is contained in:
parent
cca35a985d
commit
63c3d10963
@ -298,8 +298,12 @@ class GedcomWriter(UpdateCallback):
|
||||
self.private = self.option_box.private
|
||||
|
||||
if self.private:
|
||||
import _PrivateProxyDb
|
||||
self.db = _PrivateProxyDb.PrivateProxyDb(self.db)
|
||||
from _PrivateProxyDb import PrivateProxyDb
|
||||
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:
|
||||
self.plist = set(self.db.get_person_handles(sort_handles=False))
|
||||
@ -457,11 +461,7 @@ class GedcomWriter(UpdateCallback):
|
||||
sorted.sort()
|
||||
|
||||
for data in sorted:
|
||||
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.__write_person(self.db.get_person_from_handle(data[1]))
|
||||
self.update()
|
||||
|
||||
def __write_person(self, person):
|
||||
@ -729,7 +729,6 @@ class GedcomWriter(UpdateCallback):
|
||||
person = self.db.get_person_from_handle(person_handle)
|
||||
gramps_id = person.get_gramps_id()
|
||||
self.__writeln(1, token, '@%s@' % gramps_id)
|
||||
return Utils.probably_alive(person, self.db)
|
||||
|
||||
def __write_family(self, family):
|
||||
|
||||
@ -1185,8 +1184,6 @@ def exportData(database, filename, person, option_box, callback=None):
|
||||
try:
|
||||
gw = GedcomWriter(database, person, 0, filename, option_box, callback)
|
||||
ret = gw.export_data(filename)
|
||||
# except AttributeError, msg:
|
||||
# RunDatabaseRepair(msg)
|
||||
except Errors.DatabaseError, msg:
|
||||
ErrorDialog(_("Export failed"), str(msg))
|
||||
return ret
|
||||
|
@ -50,7 +50,6 @@ class Address(SecondaryObject, PrivacyBase, SourceBase, NoteBase, DateBase,
|
||||
def __init__(self, source=None):
|
||||
"""Creates a new Address instance, copying from the source
|
||||
if provided"""
|
||||
SecondaryObject.__init__(self)
|
||||
PrivacyBase.__init__(self, source)
|
||||
SourceBase.__init__(self, source)
|
||||
NoteBase.__init__(self, source)
|
||||
|
@ -51,10 +51,9 @@ class AddressBase:
|
||||
@param source: Object used to initialize the new object
|
||||
@type source: AddressBase
|
||||
"""
|
||||
|
||||
if source:
|
||||
self.address_list = [ Address(address) \
|
||||
for address in source.address_list ]
|
||||
for address in source.address_list ]
|
||||
else:
|
||||
self.address_list = []
|
||||
|
||||
|
@ -50,7 +50,6 @@ class Attribute(SecondaryObject, PrivacyBase, SourceBase, NoteBase):
|
||||
"""
|
||||
Creates a new Attribute object, copying from the source if provided.
|
||||
"""
|
||||
SecondaryObject.__init__(self)
|
||||
PrivacyBase.__init__(self, source)
|
||||
SourceBase.__init__(self, source)
|
||||
NoteBase.__init__(self, source)
|
||||
|
@ -51,7 +51,6 @@ class AttributeBase:
|
||||
@param source: Object used to initialize the new object
|
||||
@type source: AttributeBase
|
||||
"""
|
||||
|
||||
if source:
|
||||
self.attribute_list = [ Attribute(attribute) \
|
||||
for attribute in source.attribute_list ]
|
||||
|
@ -45,12 +45,6 @@ class BaseObject:
|
||||
to all objects, such as searching through all available information.
|
||||
"""
|
||||
|
||||
def __init__(self):
|
||||
"""
|
||||
Initialize a BaseObject.
|
||||
"""
|
||||
pass
|
||||
|
||||
def serialize(self):
|
||||
"""
|
||||
Converts the object to a serialized tuple of data
|
||||
|
@ -76,7 +76,6 @@ class BasicPrimaryObject(BaseObject, PrivacyBase):
|
||||
@param source: Object used to initialize the new object
|
||||
@type source: PrimaryObject
|
||||
"""
|
||||
BaseObject.__init__(self)
|
||||
PrivacyBase.__init__(self, source)
|
||||
if source:
|
||||
self.gramps_id = source.gramps_id
|
||||
|
@ -53,7 +53,6 @@ class ChildRef(SecondaryObject, PrivacyBase, SourceBase, NoteBase, RefBase):
|
||||
"""
|
||||
|
||||
def __init__(self, source=None):
|
||||
SecondaryObject.__init__(self)
|
||||
PrivacyBase.__init__(self, source)
|
||||
SourceBase.__init__(self, source)
|
||||
NoteBase.__init__(self, source)
|
||||
|
@ -70,7 +70,7 @@ class Event(SourceBase, NoteBase, MediaBase, AttributeBase,
|
||||
AttributeBase.__init__(self)
|
||||
DateBase.__init__(self, source)
|
||||
PlaceBase.__init__(self, source)
|
||||
|
||||
|
||||
if source:
|
||||
self.description = source.description
|
||||
self.type = source.type
|
||||
|
@ -55,7 +55,6 @@ class EventRef(SecondaryObject, PrivacyBase, NoteBase, AttributeBase, RefBase):
|
||||
"""
|
||||
Creates a new EventRef instance, copying from the source if present.
|
||||
"""
|
||||
SecondaryObject.__init__(self)
|
||||
PrivacyBase.__init__(self, source)
|
||||
NoteBase.__init__(self, source)
|
||||
AttributeBase.__init__(self, source)
|
||||
|
@ -53,26 +53,40 @@ class GrampsType:
|
||||
"""
|
||||
Creates a new type, initialize the value from one of several possible states.
|
||||
"""
|
||||
self.value = None
|
||||
self.string = None
|
||||
self.set(value)
|
||||
if value:
|
||||
self.set(value)
|
||||
else:
|
||||
self.val = self._DEFAULT
|
||||
self.string = u''
|
||||
|
||||
def __set_tuple(self, value):
|
||||
self.val = value[0]
|
||||
self.string = value[1]
|
||||
|
||||
def __set_int(self, value):
|
||||
self.val = value
|
||||
self.string = u''
|
||||
|
||||
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)
|
||||
if self.val == self._CUSTOM:
|
||||
self.string = value
|
||||
else:
|
||||
self.string = u''
|
||||
|
||||
def set(self, value):
|
||||
if isinstance(value, self.__class__):
|
||||
self.val = value.val
|
||||
self.string = value.string
|
||||
elif type(value) == tuple:
|
||||
self.val = value[0]
|
||||
self.string = value[1]
|
||||
if type(value) == tuple:
|
||||
self.__set_tuple(value)
|
||||
elif type(value) == int:
|
||||
self.val = value
|
||||
self.string = u''
|
||||
self.__set_int(value)
|
||||
elif isinstance(value, self.__class__):
|
||||
self.__set_instance(value)
|
||||
elif type(value) in (str,unicode):
|
||||
self.val = self._S2IMAP.get(value, self._CUSTOM)
|
||||
if self.val == self._CUSTOM:
|
||||
self.string = value
|
||||
else:
|
||||
self.string = u''
|
||||
self.__set_str(value)
|
||||
else:
|
||||
self.val = self._DEFAULT
|
||||
self.string = u''
|
||||
|
@ -114,7 +114,6 @@ class LdsOrd(SecondaryObject, SourceBase, NoteBase,
|
||||
|
||||
def __init__(self, source=None):
|
||||
"""Creates a LDS Ordinance instance"""
|
||||
SecondaryObject.__init__(self)
|
||||
SourceBase.__init__(self, source)
|
||||
NoteBase.__init__(self, source)
|
||||
DateBase.__init__(self, source)
|
||||
|
@ -52,8 +52,6 @@ class Location(SecondaryObject, LocationBase):
|
||||
"""
|
||||
Creates a Location object, copying from the source object if it exists.
|
||||
"""
|
||||
|
||||
SecondaryObject.__init__(self)
|
||||
LocationBase.__init__(self, source)
|
||||
if source:
|
||||
self.parish = source.parish
|
||||
|
@ -47,8 +47,6 @@ class MediaRef(SecondaryObject, PrivacyBase, SourceBase, NoteBase, RefBase,
|
||||
AttributeBase):
|
||||
"""Media reference class"""
|
||||
def __init__(self, source=None):
|
||||
|
||||
SecondaryObject.__init__(self)
|
||||
PrivacyBase.__init__(self, source)
|
||||
SourceBase.__init__(self, source)
|
||||
NoteBase.__init__(self, source)
|
||||
|
@ -58,7 +58,6 @@ class Name(SecondaryObject, PrivacyBase, SourceBase, NoteBase, DateBase):
|
||||
|
||||
def __init__(self, source=None, data=None):
|
||||
"""creates a new Name instance, copying from the source if provided"""
|
||||
SecondaryObject.__init__(self)
|
||||
PrivacyBase.__init__(self, source)
|
||||
SourceBase.__init__(self, source)
|
||||
NoteBase.__init__(self, source)
|
||||
|
@ -112,7 +112,6 @@ class NoteType(GrampsType):
|
||||
def __init__(self, value=None):
|
||||
GrampsType.__init__(self, value)
|
||||
|
||||
|
||||
def get_ignore_list(self, exception):
|
||||
"""
|
||||
Return a list of the types to ignore and not include in default lists
|
||||
|
@ -84,26 +84,26 @@ class Person(SourceBase, NoteBase, AttributeBase, MediaBase,
|
||||
data items have empty or null values, including the database
|
||||
handle.
|
||||
"""
|
||||
PrimaryObject.__init__(self)
|
||||
SourceBase.__init__(self)
|
||||
NoteBase.__init__(self)
|
||||
MediaBase.__init__(self)
|
||||
AttributeBase.__init__(self)
|
||||
AddressBase.__init__(self)
|
||||
UrlBase.__init__(self)
|
||||
LdsOrdBase.__init__(self)
|
||||
self.primary_name = Name()
|
||||
self.event_ref_list = []
|
||||
self.family_list = []
|
||||
self.parent_family_list = []
|
||||
self.alternate_names = []
|
||||
self.person_ref_list = []
|
||||
self.gender = Person.UNKNOWN
|
||||
self.death_ref_index = -1
|
||||
self.birth_ref_index = -1
|
||||
|
||||
if data:
|
||||
self.unserialize(data)
|
||||
else:
|
||||
PrimaryObject.__init__(self)
|
||||
SourceBase.__init__(self)
|
||||
NoteBase.__init__(self)
|
||||
MediaBase.__init__(self)
|
||||
AttributeBase.__init__(self)
|
||||
AddressBase.__init__(self)
|
||||
UrlBase.__init__(self)
|
||||
LdsOrdBase.__init__(self)
|
||||
self.primary_name = Name()
|
||||
self.event_ref_list = []
|
||||
self.family_list = []
|
||||
self.parent_family_list = []
|
||||
self.alternate_names = []
|
||||
self.person_ref_list = []
|
||||
self.gender = Person.UNKNOWN
|
||||
self.death_ref_index = -1
|
||||
self.birth_ref_index = -1
|
||||
|
||||
# We hold a reference to the GrampsDB so that we can maintain
|
||||
# its genderStats. It doesn't get set here, but from
|
||||
|
@ -52,7 +52,6 @@ class PersonRef(SecondaryObject, PrivacyBase, SourceBase, NoteBase, RefBase):
|
||||
"""
|
||||
|
||||
def __init__(self, source=None):
|
||||
SecondaryObject.__init__(self)
|
||||
PrivacyBase.__init__(self, source)
|
||||
SourceBase.__init__(self, source)
|
||||
NoteBase.__init__(self, source)
|
||||
|
@ -48,7 +48,6 @@ class RepoRef(SecondaryObject, PrivacyBase, NoteBase, RefBase):
|
||||
"""
|
||||
|
||||
def __init__(self, source=None):
|
||||
SecondaryObject.__init__(self)
|
||||
PrivacyBase.__init__(self, source)
|
||||
NoteBase.__init__(self, source)
|
||||
RefBase.__init__(self, source)
|
||||
|
@ -47,16 +47,5 @@ class SecondaryObject(BaseObject):
|
||||
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):
|
||||
return cmp(self.serialize(), source.serialize()) == 0
|
||||
|
@ -55,7 +55,7 @@ class Source(MediaBase, NoteBase, PrimaryObject):
|
||||
self.datamap = {}
|
||||
self.abbrev = ""
|
||||
self.reporef_list = []
|
||||
|
||||
|
||||
def serialize(self):
|
||||
"""
|
||||
Converts the object to a serialized tuple of data
|
||||
|
@ -56,7 +56,6 @@ class SourceRef(SecondaryObject, DateBase, PrivacyBase, NoteBase, RefBase):
|
||||
|
||||
def __init__(self, source=None):
|
||||
"""creates a new SourceRef, copying from the source if present"""
|
||||
SecondaryObject.__init__(self)
|
||||
DateBase.__init__(self, source)
|
||||
PrivacyBase.__init__(self, source)
|
||||
NoteBase.__init__(self, source)
|
||||
|
@ -53,7 +53,6 @@ class Url(SecondaryObject, PrivacyBase):
|
||||
|
||||
def __init__(self, source=None):
|
||||
"""creates a new URL instance, copying from the source if present"""
|
||||
SecondaryObject.__init__(self)
|
||||
PrivacyBase.__init__(self, source)
|
||||
if source:
|
||||
self.path = source.path
|
||||
|
Loading…
Reference in New Issue
Block a user