Beispiel #1
0
 def __init__(self, text=""):
     """Create a new Note object, initializing from the passed string."""
     BasicPrimaryObject.__init__(self)
     TagBase.__init__(self)
     self.text = StyledText(text)
     self.format = Note.FLOWED
     self.type = NoteType()
Beispiel #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
Beispiel #3
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
Beispiel #4
0
    def unserialize(self, data):
        """Convert a serialized tuple of data to an object.
        
        :param data: The serialized format of a Note.
        :type: data: tuple
        
        """
        (self.handle, self.gramps_id, the_text, self.format, the_type,
         self.change, tag_list, self.private) = data

        self.text = StyledText()
        self.text.unserialize(the_text)
        self.type = NoteType()
        self.type.unserialize(the_type)
        TagBase.unserialize(self, tag_list)
        return self
Beispiel #5
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)
Beispiel #6
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)
Beispiel #7
0
 def serialize(self):
     """Convert the object to a serialized tuple of data.
     
     :returns: The serialized format of the instance.
     :rtype: tuple
     
     """
     return (self.handle, self.gramps_id, self.text.serialize(),
             self.format, self.type.serialize(), self.change,
             TagBase.serialize(self), self.private)
Beispiel #8
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
Beispiel #9
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.path, self.mime, self.desc,
                AttributeBase.serialize(self), CitationBase.serialize(self),
                NoteBase.serialize(self), self.change,
                DateBase.serialize(self, no_text_date),
                TagBase.serialize(self), self.private)