Esempio n. 1
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
Esempio n. 2
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
Esempio n. 3
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)
Esempio n. 4
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 = ''
Esempio n. 5
0
 def __init__(self, source=None):
     PrivacyBase.__init__(self, source)
     NoteBase.__init__(self, source)
     RefBase.__init__(self, source)
     if source:
         self.call_number = source.call_number
         self.media_type = SourceMediaType(source.media_type)
     else:
         self.call_number = ""
         self.media_type = SourceMediaType()
Esempio n. 6
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
Esempio n. 7
0
 def __init__(self):
     """
     Create a new Repository instance.
     """
     PrimaryObject.__init__(self)
     NoteBase.__init__(self)
     AddressBase.__init__(self)
     UrlBase.__init__(self)
     self.type = RepositoryType()
     self.name = ""
Esempio n. 8
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
Esempio n. 9
0
 def __init__(self):
     """Create a new Citation instance."""
     PrimaryObject.__init__(self)
     MediaBase.__init__(self)  #  7
     NoteBase.__init__(self)  #  6
     DateBase.__init__(self)  #  2
     self.source_handle = None  #  5
     self.page = ""  #  3
     self.confidence = Citation.CONF_NORMAL  #  4
     self.datamap = {}  #  8
Esempio n. 10
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
Esempio n. 11
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()
Esempio n. 12
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
Esempio n. 13
0
 def __init__(self):
     """Create a new Source instance."""
     PrimaryObject.__init__(self)
     MediaBase.__init__(self)
     NoteBase.__init__(self)
     self.title = ""
     self.author = ""
     self.pubinfo = ""
     self.datamap = {}
     self.abbrev = ""
     self.reporef_list = []
Esempio n. 14
0
 def unserialize(self, data):
     """
     Convert a serialized tuple of data to an object.
     """
     (note_list, ref, self.call_number, media_type, privacy) = data
     self.media_type = SourceMediaType()
     self.media_type.unserialize(media_type)
     PrivacyBase.unserialize(self, privacy)
     NoteBase.unserialize(self, note_list)
     RefBase.unserialize(self, ref)
     return self
Esempio n. 15
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
Esempio n. 16
0
 def __init__(self, source=None):
     """
     Create a new EventRef instance, copying from the source if present.
     """
     PrivacyBase.__init__(self, source)
     NoteBase.__init__(self, source)
     AttributeBase.__init__(self, source)
     RefBase.__init__(self, source)
     if source:
         self.__role = EventRoleType(source.__role)
     else:
         self.__role = EventRoleType()
Esempio n. 17
0
 def unserialize(self, data):
     """
     Convert a serialized tuple of data to an object.
     """
     (privacy, note_list, attribute_list, ref, role) = data
     PrivacyBase.unserialize(self, privacy)
     NoteBase.unserialize(self, note_list)
     AttributeBase.unserialize(self, attribute_list)
     RefBase.unserialize(self, ref)
     self.__role = EventRoleType()
     self.__role.unserialize(role)
     return self
Esempio n. 18
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
Esempio n. 19
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 = ""
Esempio n. 20
0
    def unserialize(self, data):
        """
        Convert the data held in a tuple created by the serialize method
        back into the data in a Repository structure.
        """
        (self.handle, self.gramps_id, the_type, self.name, note_list,
         address_list, urls, self.change, self.private) = data

        self.type = RepositoryType()
        self.type.unserialize(the_type)
        NoteBase.unserialize(self, note_list)
        AddressBase.unserialize(self, address_list)
        UrlBase.unserialize(self, urls)
        return self
Esempio n. 21
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.
        """
        (self.handle, self.gramps_id, self.title, self.author, self.pubinfo,
         note_list, media_list, self.abbrev, self.change, self.datamap,
         reporef_list, self.private) = data

        NoteBase.unserialize(self, note_list)
        MediaBase.unserialize(self, media_list)
        self.reporef_list = [
            RepoRef().unserialize(item) for item in reporef_list
        ]
        return self
Esempio n. 22
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
Esempio n. 23
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)
Esempio n. 24
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))
Esempio n. 25
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)
Esempio n. 26
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())
Esempio n. 27
0
 def serialize(self):
     """
     Convert the object to a serialized tuple of data.
     """
     return (PrivacyBase.serialize(self), NoteBase.serialize(self),
             AttributeBase.serialize(self), RefBase.serialize(self),
             self.__role.serialize())
Esempio n. 28
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)
Esempio n. 29
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)
Esempio n. 30
0
 def serialize(self):
     """
     Convert the object to a serialized tuple of data.
     """
     return (self.handle, self.gramps_id, self.type.serialize(),
             unicode(self.name), NoteBase.serialize(self),
             AddressBase.serialize(self), UrlBase.serialize(self),
             self.change, self.private)