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

Source Code for Module gen.lib.locationbase

  1  # 
  2  # Gramps - a GTK+/GNOME based genealogy program 
  3  # 
  4  # Copyright (C) 2000-2006  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: locationbase.py 10103 2008-02-24 13:55:55Z acraphae $ 
 22   
 23  """ 
 24  LocationBase class for GRAMPS. 
 25  """ 
 26   
 27  #------------------------------------------------------------------------- 
 28  # 
 29  # LocationBase class 
 30  # 
 31  #------------------------------------------------------------------------- 
32 -class LocationBase:
33 """ 34 Base class for all things Address. 35 """ 36
37 - def __init__(self, source=None):
38 """ 39 Create a LocationBase object, copying from the source object if it 40 exists. 41 """ 42 if source: 43 self.street = source.street 44 self.city = source.city 45 self.county = source.county 46 self.state = source.state 47 self.country = source.country 48 self.postal = source.postal 49 self.phone = source.phone 50 else: 51 self.street = "" 52 self.city = "" 53 self.county = "" 54 self.state = "" 55 self.country = "" 56 self.postal = "" 57 self.phone = ""
58
59 - def serialize(self):
60 """ 61 Convert the object to a serialized tuple of data. 62 """ 63 return (self.street, self.city, self.county, self.state, 64 self.country, self.postal, self.phone)
65
66 - def unserialize(self, data):
67 """ 68 Convert a serialized tuple of data to an object. 69 """ 70 (self.street, self.city, self.county, self.state, self.country, 71 self.postal, self.phone) = data 72 return self
73
74 - def get_text_data_list(self):
75 """ 76 Return the list of all textual attributes of the object. 77 78 @return: Returns the list of all textual attributes of the object. 79 @rtype: list 80 """ 81 return [self.city, self.state, self.country, self.postal, self.phone]
82
83 - def set_street(self, val):
84 """Set the street portion of the Location.""" 85 self.street = val
86
87 - def get_street(self):
88 """Return the street portion of the Location.""" 89 return self.street
90
91 - def set_city(self, data):
92 """Set the city name of the LocationBase object.""" 93 self.city = data
94
95 - def get_city(self):
96 """Return the city name of the LocationBase object.""" 97 return self.city
98
99 - def set_postal_code(self, data):
100 """Set the postal code of the LocationBase object.""" 101 self.postal = data
102
103 - def get_postal_code(self):
104 """Return the postal code of the LocationBase object.""" 105 return self.postal
106
107 - def set_phone(self, data):
108 """Set the phone number of the LocationBase object.""" 109 self.phone = data
110
111 - def get_phone(self):
112 """Return the phone number of the LocationBase object.""" 113 return self.phone
114
115 - def set_state(self, data):
116 """Set the state name of the LocationBase object.""" 117 self.state = data
118
119 - def get_state(self):
120 """Return the state name of the LocationBase object.""" 121 return self.state
122
123 - def set_country(self, data):
124 """Set the country name of the LocationBase object.""" 125 self.country = data
126
127 - def get_country(self):
128 """Return the country name of the LocationBase object.""" 129 return self.country
130
131 - def set_county(self, data):
132 """Set the county name of the LocationBase object.""" 133 self.county = data
134
135 - def get_county(self):
136 """Return the county name of the LocationBase object.""" 137 return self.county
138