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: reporef.py 10103 2008-02-24 13:55:55Z acraphae $ 22 23 """ 24 Repository Reference class for GRAMPS 25 """ 26 27 #------------------------------------------------------------------------- 28 # 29 # Python modules 30 # 31 #------------------------------------------------------------------------- 32 from types import InstanceType 33 34 #------------------------------------------------------------------------- 35 # 36 # GRAMPS modules 37 # 38 #------------------------------------------------------------------------- 39 from gen.lib.secondaryobj import SecondaryObject 40 from gen.lib.privacybase import PrivacyBase 41 from gen.lib.notebase import NoteBase 42 from gen.lib.refbase import RefBase 43 from gen.lib.srcmediatype import SourceMediaType 44 45 #------------------------------------------------------------------------- 46 # 47 # Repository Reference for Sources 48 # 49 #-------------------------------------------------------------------------51 """ 52 Repository reference class. 53 """ 5412256 PrivacyBase.__init__(self, source) 57 NoteBase.__init__(self, source) 58 RefBase.__init__(self, source) 59 if source: 60 self.call_number = source.call_number 61 self.media_type = source.media_type 62 else: 63 self.call_number = "" 64 self.media_type = SourceMediaType()6567 """ 68 Convert the object to a serialized tuple of data. 69 """ 70 return ( 71 NoteBase.serialize(self), 72 RefBase.serialize(self), 73 self.call_number, self.media_type.serialize(), 74 PrivacyBase.serialize(self), 75 )7678 """ 79 Convert a serialized tuple of data to an object. 80 """ 81 (note_list, ref, self.call_number, media_type, privacy) = data 82 self.media_type = InstanceType(SourceMediaType) 83 self.media_type.unserialize(media_type) 84 PrivacyBase.unserialize(self, privacy) 85 NoteBase.unserialize(self, note_list) 86 RefBase.unserialize(self, ref) 87 return self8890 """ 91 Return the list of all textual attributes of the object. 92 93 @return: Returns the list of all textual attributes of the object. 94 @rtype: list 95 """ 96 return [self.call_number, str(self.media_type)]9799 """ 100 Return the list of (classname, handle) tuples for all directly 101 referenced primary objects. 102 103 @return: List of (classname, handle) tuples for referenced objects. 104 @rtype: list 105 """ 106 ret = self.get_referenced_note_handles() 107 if self.ref: 108 ret += [('Repository', self.ref)] 109 return ret110 113 116 119121 self.media_type.set(media_type)
Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Sun Mar 9 21:53:22 2008 | http://epydoc.sourceforge.net |