コード例 #1
0
ファイル: _Person.py プロジェクト: daleathan/geddiff
    def __init__(self, data=None):
        """
        Creates a new Person instance. After initialization, most
        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)
コード例 #2
0
ファイル: _Family.py プロジェクト: daleathan/geddiff
    def serialize(self):
        """
        Converts 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 primative Python types (string, integers),
        complex Python types (lists or tuples, or Python objects. If the
        target database cannot handle complex types (such as objectes 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),
                SourceBase.serialize(self),
                NoteBase.serialize(self),
                self.change, self.marker.serialize(), self.private)
コード例 #3
0
    def serialize(self):
        """
        Converts 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 primative Python types (string, integers),
        complex Python types (lists or tuples, or Python objects. If the
        target database cannot handle complex types (such as objectes 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),
                SourceBase.serialize(self), NoteBase.serialize(self),
                self.change, self.marker.serialize(), self.private)
コード例 #4
0
ファイル: _Person.py プロジェクト: daleathan/geddiff
    def unserialize(self, data):
        """
        Converts the data held in a tuple created by the serialize method
        back into the data in a Person object.

        @param data: tuple containing the persistent data associated the
            Person object
        @type data: tuple
        """
        (self.handle,             #  0
         self.gramps_id,          #  1
         self.gender,             #  2
         primary_name,            #  3
         alternate_names,         #  4
         self.death_ref_index,    #  5
         self.birth_ref_index,    #  6
         event_ref_list,          #  7
         self.family_list,        #  8
         self.parent_family_list, #  9
         media_list,              # 10
         address_list,            # 11
         attribute_list,          # 12
         urls,                    # 13
         lds_ord_list,            # 14
         source_list,             # 15
         note,                    # 16
         self.change,             # 17
         marker,                  # 18
         self.private,            # 19
         person_ref_list,         # 20
         ) = data

        self.marker.unserialize(marker)
        self.primary_name.unserialize(primary_name)
        self.alternate_names = [Name().unserialize(name)
                                for name in alternate_names]
        self.event_ref_list = [EventRef().unserialize(er)
                               for er in event_ref_list]
        self.person_ref_list = [PersonRef().unserialize(pr)
                                for pr in person_ref_list]
        MediaBase.unserialize(self, media_list)
        LdsOrdBase.unserialize(self, lds_ord_list)
        AddressBase.unserialize(self, address_list)
        AttributeBase.unserialize(self, attribute_list)
        UrlBase.unserialize(self, urls)
        SourceBase.unserialize(self, source_list)
        NoteBase.unserialize(self, note)
コード例 #5
0
ファイル: _Family.py プロジェクト: daleathan/geddiff
 def __init__(self):
     """
     Creates a new Family instance. After initialization, most
     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)
     LdsOrdBase.__init__(self)
     self.father_handle = None
     self.mother_handle = None
     self.child_ref_list = []
     self.type = FamilyRelType()
     self.event_ref_list = []
     self.complete = 0
コード例 #6
0
 def __init__(self):
     """
     Creates a new Family instance. After initialization, most
     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)
     LdsOrdBase.__init__(self)
     self.father_handle = None
     self.mother_handle = None
     self.child_ref_list = []
     self.type = FamilyRelType()
     self.event_ref_list = []
     self.complete = 0
コード例 #7
0
ファイル: _Family.py プロジェクト: daleathan/geddiff
    def unserialize(self, data):
        """
        Converts 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, source_list, note,
         self.change, marker, self.private) = data

        self.marker.unserialize(marker)
        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)
        SourceBase.unserialize(self, source_list)
        NoteBase.unserialize(self, note)
        LdsOrdBase.unserialize(self, lds_seal_list)
コード例 #8
0
    def unserialize(self, data):
        """
        Converts 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, source_list, note, self.change, marker,
         self.private) = data

        self.marker.unserialize(marker)
        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)
        SourceBase.unserialize(self, source_list)
        NoteBase.unserialize(self, note)
        LdsOrdBase.unserialize(self, lds_seal_list)
コード例 #9
0
ファイル: _Person.py プロジェクト: daleathan/geddiff
    def serialize(self):
        """
        Converts the data held in the Person 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 primative Python types (string, integers), 
        complex Python types (lists or tuples, or Python objects. If the
        target database cannot handle complex types (such as objectes 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,                                         #  0
            self.gramps_id,                                      #  1
            self.gender,                                         #  2
            self.primary_name.serialize(),                       #  3
            [name.serialize() for name in self.alternate_names], #  4
            self.death_ref_index,                                #  5
            self.birth_ref_index,                                #  6
            [er.serialize() for er in self.event_ref_list],      #  7
            self.family_list,                                    #  8
            self.parent_family_list,                             #  9
            MediaBase.serialize(self),                           # 10
            AddressBase.serialize(self),                         # 11
            AttributeBase.serialize(self),                       # 12
            UrlBase.serialize(self),                             # 13
            LdsOrdBase.serialize(self),                          # 14
            SourceBase.serialize(self),                          # 15
            NoteBase.serialize(self),                            # 16
            self.change,                                         # 17
            self.marker.serialize(),                             # 18
            self.private,                                        # 19
            [pr.serialize() for pr in self.person_ref_list]      # 20
            )