Trees | Indices | Help |
|
---|
|
1 # 2 # Gramps - a GTK+/GNOME based genealogy program 3 # 4 # Copyright (C) 2000-2007 Donald N. Allingham 5 # 6 # This program is free software; you can redistribute it and/or modify 7 # it under the terms of the GNU General Public License as published by 8 # the Free Software Foundation; either version 2 of the License, or 9 # (at your option) any later version. 10 # 11 # This program is distributed in the hope that it will be useful, 12 # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 # GNU General Public License for more details. 15 # 16 # You should have received a copy of the GNU General Public License 17 # along with this program; if not, write to the Free Software 18 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 # 20 21 # $Id: attribute.py 10103 2008-02-24 13:55:55Z acraphae $ 22 23 """ 24 Attribute class for GRAMPS. 25 """ 26 27 #------------------------------------------------------------------------- 28 # 29 # GRAMPS modules 30 # 31 #------------------------------------------------------------------------- 32 from gen.lib.secondaryobj import SecondaryObject 33 from gen.lib.privacybase import PrivacyBase 34 from gen.lib.srcbase import SourceBase 35 from gen.lib.notebase import NoteBase 36 from gen.lib.attrtype import AttributeType 37 38 #------------------------------------------------------------------------- 39 # 40 # Attribute for Person/Family/MediaObject/MediaRef 41 # 42 #-------------------------------------------------------------------------44 """ 45 Provide a simple key/value pair for describing properties. 46 47 Used by the Person and Family objects to store descriptive information. 48 """ 4913851 """ 52 Create a new Attribute object, copying from the source if provided. 53 """ 54 PrivacyBase.__init__(self, source) 55 SourceBase.__init__(self, source) 56 NoteBase.__init__(self, source) 57 58 if source: 59 self.type = source.type 60 self.value = source.value 61 else: 62 self.type = AttributeType() 63 self.value = ""6466 """ 67 Convert the object to a serialized tuple of data. 68 """ 69 return (PrivacyBase.serialize(self), 70 SourceBase.serialize(self), 71 NoteBase.serialize(self), 72 self.type.serialize(), self.value)7375 """ 76 Convert a serialized tuple of data to an object. 77 """ 78 (privacy, source_list, note_list, the_type, self.value) = data 79 PrivacyBase.unserialize(self, privacy) 80 SourceBase.unserialize(self, source_list) 81 NoteBase.unserialize(self, note_list) 82 self.type.unserialize(the_type) 83 return self8486 """ 87 Return the list of all textual attributes of the object. 88 89 @return: Returns the list of all textual attributes of the object. 90 @rtype: list 91 """ 92 return [self.value]9395 """ 96 Return the list of child objects that may carry textual data. 97 98 @return: Returns the list of child objects that may carry textual data. 99 @rtype: list 100 """ 101 return self.source_list102104 """ 105 Return the list of child objects which may, directly or through 106 their children, reference primary objects. 107 108 @return: Returns the list of objects refereincing primary objects. 109 @rtype: list 110 """ 111 return self.source_list112114 """ 115 Return the list of (classname, handle) tuples for all directly 116 referenced primary objects. 117 118 @return: List of (classname, handle) tuples for referenced objects. 119 @rtype: list 120 """ 121 return self.get_referenced_note_handles()122 126 130 134
Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Sun Mar 9 21:53:14 2008 | http://epydoc.sourceforge.net |