示例#1
0
    def unserialize(self, data):
        """
        Convert the data held in a tuple created by the serialize method
        back into the data in a Family structure.
        """
        (self.handle, self.gramps_id, self.father_handle, self.mother_handle,
         child_ref_list, the_type, event_ref_list, media_list, attribute_list,
         lds_seal_list, citation_list, note_list, self.change, tag_list,
         self.private) = data

        self.type = FamilyRelType()
        self.type.unserialize(the_type)
        self.event_ref_list = [
            EventRef().unserialize(er) for er in event_ref_list
        ]
        self.child_ref_list = [
            ChildRef().unserialize(cr) for cr in child_ref_list
        ]
        MediaBase.unserialize(self, media_list)
        AttributeBase.unserialize(self, attribute_list)
        CitationBase.unserialize(self, citation_list)
        NoteBase.unserialize(self, note_list)
        LdsOrdBase.unserialize(self, lds_seal_list)
        TagBase.unserialize(self, tag_list)
        return self
示例#2
0
    def __init__(self, source=None):
        """
        Initialize a MediaObject. 
        
        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: MediaObject
        """
        PrimaryObject.__init__(self, source)
        CitationBase.__init__(self, source)
        NoteBase.__init__(self, source)
        DateBase.__init__(self, source)
        AttributeBase.__init__(self, source)
        TagBase.__init__(self)

        if source:
            self.path = source.path
            self.mime = source.mime
            self.desc = source.desc
            self.thumb = source.thumb
        else:
            self.path = ""
            self.mime = ""
            self.desc = ""
            self.thumb = None
示例#3
0
 def __init__(self, source=None):
     PrivacyBase.__init__(self, source)
     CitationBase.__init__(self, source)
     NoteBase.__init__(self, source)
     RefBase.__init__(self, source)
     if source:
         self.rel = source.rel
     else:
         self.rel = ''
示例#4
0
 def __init__(self, source=None):
     """
     Create a new Address instance, copying from the source if provided.
     """
     PrivacyBase.__init__(self, source)
     CitationBase.__init__(self, source)
     NoteBase.__init__(self, source)
     DateBase.__init__(self, source)
     LocationBase.__init__(self, source)
示例#5
0
 def unserialize(self, data):
     """
     Convert a serialized tuple of data to an object.
     """
     (privacy, citation_list, note_list, the_type, self.value) = data
     PrivacyBase.unserialize(self, privacy)
     CitationBase.unserialize(self, citation_list)
     NoteBase.unserialize(self, note_list)
     self.type.unserialize(the_type)
     return self
示例#6
0
 def unserialize(self, data):
     """
     Convert a serialized tuple of data to an object.
     """
     (citation_list, note_list, date, self.type, self.place,
      self.famc, self.temple, self.status, self.private) = data
     CitationBase.unserialize(self, citation_list)
     NoteBase.unserialize(self, note_list)
     DateBase.unserialize(self, date)
     return self
示例#7
0
 def unserialize(self, data):
     """
     Convert a serialized tuple of data to an object.
     """
     (privacy, citation_list, note_list, ref, self.rel) = data
     PrivacyBase.unserialize(self, privacy)
     CitationBase.unserialize(self, citation_list)
     NoteBase.unserialize(self, note_list)
     RefBase.unserialize(self, ref)
     return self
示例#8
0
 def __init__(self, source=None):
     PrivacyBase.__init__(self, source)
     CitationBase.__init__(self, source)
     NoteBase.__init__(self, source)
     RefBase.__init__(self, source)
     if source:
         self.frel = ChildRefType(source.frel)
         self.mrel = ChildRefType(source.mrel)
     else:
         self.frel = ChildRefType()
         self.mrel = ChildRefType()
示例#9
0
    def __init__(self, source=None):
        PrivacyBase.__init__(self, source)
        CitationBase.__init__(self, source)
        NoteBase.__init__(self, source)
        RefBase.__init__(self, source)
        AttributeBase.__init__(self, source)

        if source:
            self.rect = source.rect
        else:
            self.rect = None
示例#10
0
    def unserialize(self, data):
        """
        Convert a serialized tuple of data to an object.
        """
        (privacy, citation_list, note_list, date, location) = data

        PrivacyBase.unserialize(self, privacy)
        CitationBase.unserialize(self, citation_list)
        NoteBase.unserialize(self, note_list)
        DateBase.unserialize(self, date)
        LocationBase.unserialize(self, location)
        return self
示例#11
0
 def __init__(self, source=None):
     """
     Create a new Attribute object, copying from the source if provided.
     """
     PrivacyBase.__init__(self, source)
     CitationBase.__init__(self, source)
     NoteBase.__init__(self, source)
     
     if source:
         self.type = AttributeType(source.type)
         self.value = source.value
     else:
         self.type = AttributeType()
         self.value = ""
示例#12
0
 def unserialize(self, data):
     """
     Convert a serialized tuple of data to an object.
     """
     (privacy, citation_list, note_list, ref, frel, mrel) = data
     PrivacyBase.unserialize(self, privacy)
     CitationBase.unserialize(self, citation_list)
     NoteBase.unserialize(self, note_list)
     RefBase.unserialize(self, ref)
     self.frel = ChildRefType()
     self.frel.unserialize(frel)
     self.mrel = ChildRefType()
     self.mrel.unserialize(mrel)
     return self
示例#13
0
 def unserialize(self, data):
     """
     Convert a serialized tuple of data to an object.
     """
     (privacy, citation_list, note_list, date, self.first_name,
      surname_list, self.suffix, self.title, name_type, self.group_as,
      self.sort_as, self.display_as, self.call, self.nick,
      self.famnick) = data
     self.type = NameType(name_type)
     PrivacyBase.unserialize(self, privacy)
     SurnameBase.unserialize(self, surname_list)
     CitationBase.unserialize(self, citation_list)
     NoteBase.unserialize(self, note_list)
     DateBase.unserialize(self, date)
     return self
示例#14
0
 def serialize(self):
     """
     Convert the object to a serialized tuple of data.
     """
     return (PrivacyBase.serialize(self), CitationBase.serialize(self),
             NoteBase.serialize(self), DateBase.serialize(self),
             LocationBase.serialize(self))
示例#15
0
 def serialize(self):
     """
     Convert the object to a serialized tuple of data.
     """
     return (PrivacyBase.serialize(self), CitationBase.serialize(self),
             NoteBase.serialize(self), RefBase.serialize(self),
             self.frel.serialize(), self.mrel.serialize())
示例#16
0
    def serialize(self):
        """
        Convert the data held in the event to a Python tuple that
        represents all the data elements. 
        
        This method is used to convert the object into a form that can easily 
        be saved to a database.

        These elements may be primitive Python types (string, integers),
        complex Python types (lists or tuples, or Python objects. If the
        target database cannot handle complex types (such as objects or
        lists), the database is responsible for converting the data into
        a form that it can use.

        :returns: Returns a python tuple containing the data that should
            be considered persistent.
        :rtype: tuple
        """
        return (self.handle, self.gramps_id, self.father_handle,
                self.mother_handle,
                [cr.serialize()
                 for cr in self.child_ref_list], self.type.serialize(),
                [er.serialize()
                 for er in self.event_ref_list], MediaBase.serialize(self),
                AttributeBase.serialize(self), LdsOrdBase.serialize(self),
                CitationBase.serialize(self), NoteBase.serialize(self),
                self.change, TagBase.serialize(self), self.private)
示例#17
0
    def serialize(self):
        """
        Convert the data held in the Place to a Python tuple that
        represents all the data elements. 
        
        This method is used to convert the object into a form that can easily 
        be saved to a database.

        These elements may be primitive Python types (string, integers),
        complex Python types (lists or tuples, or Python objects. If the
        target database cannot handle complex types (such as objects or
        lists), the database is responsible for converting the data into
        a form that it can use.

        :returns: Returns a python tuple containing the data that should
            be considered persistent.
        :rtype: tuple
        """

        if self.main_loc is None or self.main_loc.serialize() == _EMPTY_LOC:
            main_loc = None
        else:
            main_loc = self.main_loc.serialize()

        return (self.handle, self.gramps_id, self.title, self.long, self.lat,
                main_loc, [al.serialize()
                           for al in self.alt_loc], UrlBase.serialize(self),
                MediaBase.serialize(self), CitationBase.serialize(self),
                NoteBase.serialize(self), self.change, self.private)
示例#18
0
    def unserialize(self, data):
        """
        Convert the data held in a tuple created by the serialize method
        back into the data in an Event structure.

        :param data: tuple containing the persistent data associated the object
        :type data: tuple
        """
        (self.handle, self.gramps_id, self.path, self.mime, self.desc,
         attribute_list, citation_list, note_list, self.change, date, tag_list,
         self.private) = data

        AttributeBase.unserialize(self, attribute_list)
        CitationBase.unserialize(self, citation_list)
        NoteBase.unserialize(self, note_list)
        DateBase.unserialize(self, date)
        TagBase.unserialize(self, tag_list)
示例#19
0
 def serialize(self):
     """
     Convert the object to a serialized tuple of data.
     """
     return (PrivacyBase.serialize(self),
             CitationBase.serialize(self),
             NoteBase.serialize(self),
             self.type.serialize(), self.value)
示例#20
0
 def __init__(self, source=None, data=None):
     """Create a new Name instance, copying from the source if provided.
     We should connect here to 'person-groupname-rebuild' and do something
     correct when first parameter is the name, and second parameter is
     different from the group here. However, that would be complicated and
     no real errors that cannot be ammended can be done if group is 
     saved differently.
     """
     PrivacyBase.__init__(self, source)
     SurnameBase.__init__(self, source)
     CitationBase.__init__(self, source)
     NoteBase.__init__(self, source)
     DateBase.__init__(self, source)
     if data:
         (privacy, citation_list, note, date, self.first_name, surname_list,
          self.suffix, self.title, name_type, self.group_as, self.sort_as,
          self.display_as, self.call, self.nick, self.famnick) = data
         self.type = NameType(name_type)
         SurnameBase.unserialize(self, surname_list)
         PrivacyBase.unserialize(self, privacy)
         CitationBase.unserialize(self, citation_list)
         NoteBase.unserialize(self, note)
         DateBase.unserialize(self, date)
     elif source:
         self.first_name = source.first_name
         self.suffix = source.suffix
         self.title = source.title
         self.type = NameType(source.type)
         self.group_as = source.group_as
         self.sort_as = source.sort_as
         self.display_as = source.display_as
         self.call = source.call
         self.nick = source.nick
         self.famnick = source.famnick
     else:
         self.first_name = ""
         self.suffix = ""
         self.title = ""
         self.type = NameType()
         self.group_as = ""
         self.sort_as = self.DEF
         self.display_as = self.DEF
         self.call = u''
         self.nick = u''
         self.famnick = u''
示例#21
0
 def serialize(self):
     """
     Convert the object to a serialized tuple of data.
     """
     return (PrivacyBase.serialize(self), CitationBase.serialize(self),
             NoteBase.serialize(self), DateBase.serialize(self),
             self.first_name, SurnameBase.serialize(self), self.suffix,
             self.title, self.type.serialize(), self.group_as, self.sort_as,
             self.display_as, self.call, self.nick, self.famnick)
示例#22
0
 def serialize(self):
     """
     Convert the object to a serialized tuple of data.
     """
     return (CitationBase.serialize(self),
             NoteBase.serialize(self),
             DateBase.serialize(self),
             self.type, self.place,
             self.famc, self.temple, self.status, self.private)
示例#23
0
 def __init__(self, source=None):
     """Create a LDS Ordinance instance."""
     CitationBase.__init__(self, source)
     NoteBase.__init__(self, source)
     DateBase.__init__(self, source)
     PlaceBase.__init__(self, source)
     PrivacyBase.__init__(self, source)
     
     if source:
         self.type = source.type
         self.famc = source.famc
         self.temple = source.temple
         self.status = source.status
     else:
         self.type = LdsOrd.DEFAULT_TYPE
         self.famc = None
         self.temple = ""
         self.status = LdsOrd.DEFAULT_STATUS
示例#24
0
 def __init__(self):
     """
     Create a new Family instance. 
     
     After initialization, most data items have empty or null values, 
     including the database handle.
     """
     PrimaryObject.__init__(self)
     CitationBase.__init__(self)
     NoteBase.__init__(self)
     MediaBase.__init__(self)
     AttributeBase.__init__(self)
     LdsOrdBase.__init__(self)
     TagBase.__init__(self)
     self.father_handle = None
     self.mother_handle = None
     self.child_ref_list = []
     self.type = FamilyRelType()
     self.event_ref_list = []
     self.complete = 0
示例#25
0
    def unserialize(self, data):
        """
        Convert the data held in a tuple created by the serialize method
        back into the data in an Event structure.

        :param data: tuple containing the persistent data associated the
            Person object
        :type data: tuple
        """
        (self.handle, self.gramps_id, the_type, date, self.__description,
         self.place, citation_list, note_list, media_list, attribute_list,
         self.change, self.private) = data

        self.__type = EventType()
        self.__type.unserialize(the_type)
        DateBase.unserialize(self, date)
        MediaBase.unserialize(self, media_list)
        AttributeBase.unserialize(self, attribute_list)
        CitationBase.unserialize(self, citation_list)
        NoteBase.unserialize(self, note_list)
        return self
示例#26
0
    def __init__(self, source=None):
        """
        Create a new Event instance, copying from the source if present.

        :param source: An event used to initialize the new event
        :type source: Event
        """

        PrimaryObject.__init__(self, source)
        CitationBase.__init__(self, source)
        NoteBase.__init__(self, source)
        MediaBase.__init__(self, source)
        AttributeBase.__init__(self)
        DateBase.__init__(self, source)
        PlaceBase.__init__(self, source)

        if source:
            self.__description = source.__description
            self.__type = EventType(source.__type)
        else:
            self.__description = ""
            self.__type = EventType()
示例#27
0
    def unserialize(self, data):
        """
        Convert the data held in a tuple created by the serialize method
        back into the data in a Place object.

        :param data: tuple containing the persistent data associated the
            Person object
        :type data: tuple
        """
        (self.handle, self.gramps_id, self.title, self.long, self.lat,
         main_loc, alt_loc, urls, media_list, citation_list, note_list,
         self.change, self.private) = data

        if main_loc is None:
            self.main_loc = None
        else:
            self.main_loc = Location().unserialize(main_loc)
        self.alt_loc = [Location().unserialize(al) for al in alt_loc]
        UrlBase.unserialize(self, urls)
        MediaBase.unserialize(self, media_list)
        CitationBase.unserialize(self, citation_list)
        NoteBase.unserialize(self, note_list)
        return self
示例#28
0
    def __init__(self, source=None):
        """
        Create a new Place object, copying from the source if present.

        :param source: A Place object used to initialize the new Place
        :type source: Place
        """
        PrimaryObject.__init__(self, source)
        CitationBase.__init__(self, source)
        NoteBase.__init__(self, source)
        MediaBase.__init__(self, source)
        UrlBase.__init__(self, source)
        if source:
            self.long = source.long
            self.lat = source.lat
            self.title = source.title
            self.main_loc = Location(source.main_loc)
            self.alt_loc = map(Location, source.alt_loc)
        else:
            self.long = ""
            self.lat = ""
            self.title = ""
            self.main_loc = None
            self.alt_loc = []
示例#29
0
    def serialize(self, no_text_date=False):
        """
        Convert the data held in the event to a Python tuple that
        represents all the data elements. 
        
        This method is used to convert the object into a form that can easily 
        be saved to a database.

        These elements may be primitive Python types (string, integers),
        complex Python types (lists or tuples, or Python objects. If the
        target database cannot handle complex types (such as objects or
        lists), the database is responsible for converting the data into
        a form that it can use.

        :returns: Returns a python tuple containing the data that should
            be considered persistent.
        :rtype: tuple
        """
        return (self.handle, self.gramps_id, self.__type.serialize(),
                DateBase.serialize(self, no_text_date), self.__description,
                self.place, CitationBase.serialize(self),
                NoteBase.serialize(self), MediaBase.serialize(self),
                AttributeBase.serialize(self), self.change, self.private)