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

Source Code for Module gen.lib.location

 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: location.py 10103 2008-02-24 13:55:55Z acraphae $ 
22   
23  """ 
24  Location class for GRAMPS. 
25  """ 
26   
27  #------------------------------------------------------------------------- 
28  # 
29  # GRAMPS modules 
30  # 
31  #------------------------------------------------------------------------- 
32  from gen.lib.secondaryobj import SecondaryObject 
33  from gen.lib.locationbase import LocationBase 
34   
35  #------------------------------------------------------------------------- 
36  # 
37  # Location class for Places 
38  # 
39  #------------------------------------------------------------------------- 
40 -class Location(SecondaryObject, LocationBase):
41 """ 42 Provide information about a place. 43 44 The data including city, county, state, and country. 45 Multiple Location objects can represent the same place, since names 46 of citys, countys, states, and even countries can change with time. 47 """ 48
49 - def __init__(self, source=None):
50 """ 51 Create a Location object, copying from the source object if it exists. 52 """ 53 LocationBase.__init__(self, source) 54 if source: 55 self.parish = source.parish 56 else: 57 self.parish = ""
58
59 - def serialize(self):
60 """ 61 Convert the object to a serialized tuple of data. 62 """ 63 return (LocationBase.serialize(self), self.parish)
64
65 - def unserialize(self, data):
66 """ 67 Convert a serialized tuple of data to an object. 68 """ 69 (lbase, self.parish) = data 70 LocationBase.unserialize(self, lbase) 71 return self
72
73 - def get_text_data_list(self):
74 """ 75 Return the list of all textual attributes of the object. 76 77 @return: Returns the list of all textual attributes of the object. 78 @rtype: list 79 """ 80 return [self.parish] + LocationBase.get_text_data_list(self)
81
82 - def is_empty(self):
83 return not self.city and not self.county and not self.state and \ 84 not self.country and not self.postal and not self.phone
85
86 - def set_parish(self, data):
87 """Set the religious parish name.""" 88 self.parish = data
89
90 - def get_parish(self):
91 """Get the religious parish name.""" 92 return self.parish
93