Package gen :: Package lib :: Module address
[frames] | no frames]

Source Code for Module gen.lib.address

  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: address.py 10103 2008-02-24 13:55:55Z acraphae $ 
 22   
 23  """ 
 24  Address 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.datebase import DateBase 
 37  from gen.lib.locationbase import LocationBase 
 38   
 39  #------------------------------------------------------------------------- 
 40  # 
 41  # Address for Person/Repository 
 42  # 
 43  #------------------------------------------------------------------------- 
44 -class Address(SecondaryObject, PrivacyBase, SourceBase, NoteBase, DateBase, 45 LocationBase):
46 """Provide address information.""" 47
48 - def __init__(self, source=None):
49 """ 50 Create a new Address instance, copying from the source if provided. 51 """ 52 PrivacyBase.__init__(self, source) 53 SourceBase.__init__(self, source) 54 NoteBase.__init__(self, source) 55 DateBase.__init__(self, source) 56 LocationBase.__init__(self, source)
57
58 - def serialize(self):
59 """ 60 Convert the object to a serialized tuple of data. 61 """ 62 return (PrivacyBase.serialize(self), 63 SourceBase.serialize(self), 64 NoteBase.serialize(self), 65 DateBase.serialize(self), 66 LocationBase.serialize(self))
67
68 - def unserialize(self, data):
69 """ 70 Convert a serialized tuple of data to an object. 71 """ 72 (privacy, source_list, note_list, date, location) = data 73 74 PrivacyBase.unserialize(self, privacy) 75 SourceBase.unserialize(self, source_list) 76 NoteBase.unserialize(self, note_list) 77 DateBase.unserialize(self, date) 78 LocationBase.unserialize(self, location) 79 return self
80
81 - def get_text_data_list(self):
82 """ 83 Return the list of all textual attributes of the object. 84 85 @return: Returns the list of all textual attributes of the object. 86 @rtype: list 87 """ 88 return LocationBase.get_text_data_list(self)
89
90 - def get_text_data_child_list(self):
91 """ 92 Return the list of child objects that may carry textual data. 93 94 @return: Returns the list of child objects that may carry textual data. 95 @rtype: list 96 """ 97 return self.source_list
98
99 - def get_note_child_list(self):
100 """ 101 Return the list of child secondary objects that may refer notes. 102 103 @return: Returns the list of child secondary child objects that may refer notes. 104 @rtype: list 105 """ 106 return self.source_list
107
108 - def get_handle_referents(self):
109 """ 110 Return the list of child objects which may, directly or through 111 their children, reference primary objects. 112 113 @return: Returns the list of objects referencing primary objects. 114 @rtype: list 115 """ 116 return self.source_list
117
118 - def get_referenced_handles(self):
119 """ 120 Return the list of (classname, handle) tuples for all directly 121 referenced primary objects. 122 123 @return: List of (classname, handle) tuples for referenced objects. 124 @rtype: list 125 """ 126 return self.get_referenced_note_handles()
127