svn: r8881
This commit is contained in:
parent
cca35a985d
commit
63c3d10963
@ -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
|
||||||
|
@ -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)
|
||||||
|
@ -51,10 +51,9 @@ 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 ]
|
||||||
else:
|
else:
|
||||||
self.address_list = []
|
self.address_list = []
|
||||||
|
|
||||||
|
@ -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)
|
||||||
|
@ -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 ]
|
||||||
|
@ -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
|
||||||
|
@ -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
|
||||||
|
@ -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)
|
||||||
|
@ -70,7 +70,7 @@ class Event(SourceBase, NoteBase, MediaBase, AttributeBase,
|
|||||||
AttributeBase.__init__(self)
|
AttributeBase.__init__(self)
|
||||||
DateBase.__init__(self, source)
|
DateBase.__init__(self, source)
|
||||||
PlaceBase.__init__(self, source)
|
PlaceBase.__init__(self, source)
|
||||||
|
|
||||||
if source:
|
if source:
|
||||||
self.description = source.description
|
self.description = source.description
|
||||||
self.type = source.type
|
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.
|
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)
|
||||||
|
@ -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_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):
|
def set(self, value):
|
||||||
if isinstance(value, self.__class__):
|
if type(value) == tuple:
|
||||||
self.val = value.val
|
self.__set_tuple(value)
|
||||||
self.string = value.string
|
|
||||||
elif type(value) == tuple:
|
|
||||||
self.val = value[0]
|
|
||||||
self.string = value[1]
|
|
||||||
elif type(value) == int:
|
elif type(value) == int:
|
||||||
self.val = value
|
self.__set_int(value)
|
||||||
self.string = u''
|
elif isinstance(value, self.__class__):
|
||||||
|
self.__set_instance(value)
|
||||||
elif type(value) in (str,unicode):
|
elif type(value) in (str,unicode):
|
||||||
self.val = self._S2IMAP.get(value, self._CUSTOM)
|
self.__set_str(value)
|
||||||
if self.val == self._CUSTOM:
|
|
||||||
self.string = value
|
|
||||||
else:
|
|
||||||
self.string = u''
|
|
||||||
else:
|
else:
|
||||||
self.val = self._DEFAULT
|
self.val = self._DEFAULT
|
||||||
self.string = u''
|
self.string = u''
|
||||||
|
@ -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)
|
||||||
|
@ -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
|
||||||
|
@ -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)
|
||||||
|
@ -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)
|
||||||
|
@ -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
|
||||||
|
@ -84,26 +84,26 @@ 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.
|
||||||
"""
|
"""
|
||||||
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:
|
if data:
|
||||||
self.unserialize(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
|
# 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
|
||||||
|
@ -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)
|
||||||
|
@ -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)
|
||||||
|
@ -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
|
||||||
|
@ -55,7 +55,7 @@ class Source(MediaBase, NoteBase, PrimaryObject):
|
|||||||
self.datamap = {}
|
self.datamap = {}
|
||||||
self.abbrev = ""
|
self.abbrev = ""
|
||||||
self.reporef_list = []
|
self.reporef_list = []
|
||||||
|
|
||||||
def serialize(self):
|
def serialize(self):
|
||||||
"""
|
"""
|
||||||
Converts the object to a serialized tuple of data
|
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):
|
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)
|
||||||
|
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user