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: srcref.py 10103 2008-02-24 13:55:55Z acraphae $ 22 23 """ 24 Source Reference class for GRAMPS. 25 """ 26 27 #------------------------------------------------------------------------- 28 # 29 # Python modules 30 # 31 #------------------------------------------------------------------------- 32 from warnings import warn 33 34 #------------------------------------------------------------------------- 35 # 36 # GRAMPS modules 37 # 38 #------------------------------------------------------------------------- 39 from gen.lib.secondaryobj import SecondaryObject 40 from gen.lib.datebase import DateBase 41 from gen.lib.privacybase import PrivacyBase 42 from gen.lib.notebase import NoteBase 43 from gen.lib.refbase import RefBase 44 45 #------------------------------------------------------------------------- 46 # 47 # Source References for all primary objects 48 # 49 #-------------------------------------------------------------------------51 """ 52 Source reference, containing detailed information about how a referenced 53 source relates to it. 54 """ 55 56 CONF_VERY_HIGH = 4 57 CONF_HIGH = 3 58 CONF_NORMAL = 2 59 CONF_LOW = 1 60 CONF_VERY_LOW = 0 6114063 """Create a new SourceRef, copying from the source if present.""" 64 DateBase.__init__(self, source) 65 PrivacyBase.__init__(self, source) 66 NoteBase.__init__(self, source) 67 RefBase.__init__(self, source) 68 if source: 69 self.confidence = source.confidence 70 self.page = source.page 71 else: 72 self.confidence = SourceRef.CONF_NORMAL 73 self.page = ""7476 """ 77 Convert the object to a serialized tuple of data. 78 """ 79 return (DateBase.serialize(self), 80 PrivacyBase.serialize(self), 81 NoteBase.serialize(self), 82 self.confidence, 83 RefBase.serialize(self), 84 self.page)8587 """ 88 Convert a serialized tuple of data to an object. 89 """ 90 (date, privacy, note_list, 91 self.confidence, ref, self.page) = data 92 DateBase.unserialize(self, date) 93 PrivacyBase.unserialize(self, privacy) 94 NoteBase.unserialize(self, note_list) 95 RefBase.unserialize(self, ref) 96 return self9799 """ 100 Return the list of all textual attributes of the object. 101 102 @return: Returns the list of all textual attributes of the object. 103 @rtype: list 104 """ 105 return [self.page]106108 """ 109 Return the list of (classname, handle) tuples for all directly 110 referenced primary objects. 111 112 @return: List of (classname, handle) tuples for referenced objects. 113 @rtype: list 114 """ 115 ret = self.get_referenced_note_handles() 116 if self.ref: 117 ret += [('Source', self.ref)] 118 return ret119 123 127 131 135137 """Deprecated function - use are_equal instead.""" 138 warn( "Use is_equal instead of are_equal", DeprecationWarning, 2) 139 return self.is_equal(other)
Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Sun Mar 9 21:53:28 2008 | http://epydoc.sourceforge.net |