From 2cd742578a72fbb495958ad7029e899c7bc88187 Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Tue, 9 Dec 2003 06:00:51 +0000 Subject: [PATCH] * src/edit_person.glade: Add postal code fields * src/dialog.glade: Add postal code and phone fields * src/places.glade: Add postal code * src/WriteXML.py: Add support for new place and postal code fields * src/GrampsParser.py: Add support for new place and postal code fields svn: r2479 --- src/AddrEdit.py | 8 ++- src/EditPlace.py | 12 ++++ src/LocEdit.py | 18 ++++- src/RelLib.py | 32 ++++++++- src/dialog.glade | 154 +++++++++++++++++++++++++++++++++++++++--- src/edit_person.glade | 70 ++++++++++++++++--- 6 files changed, 270 insertions(+), 24 deletions(-) diff --git a/src/AddrEdit.py b/src/AddrEdit.py index ae7afb447..0b38f8894 100644 --- a/src/AddrEdit.py +++ b/src/AddrEdit.py @@ -72,6 +72,7 @@ class AddressEditor: self.state = self.top.get_widget("state") self.country = self.top.get_widget("country") self.postal = self.top.get_widget("postal") + self.phone = self.top.get_widget("phone") self.note_field = self.top.get_widget("addr_note") self.priv = self.top.get_widget("priv") self.slist = self.top.get_widget("slist") @@ -101,6 +102,7 @@ class AddressEditor: self.state.set_text(self.addr.getState()) self.country.set_text(self.addr.getCountry()) self.postal.set_text(self.addr.getPostal()) + self.phone.set_text(self.addr.getPhone()) self.priv.set_active(self.addr.getPrivacy()) self.note_field.get_buffer().set_text(self.addr.getNote()) if self.addr.getNote(): @@ -144,6 +146,7 @@ class AddressEditor: city = self.city.get_text() state = self.state.get_text() country = self.country.get_text() + phone = self.phone.get_text() postal = self.postal.get_text() b = self.note_field.get_buffer() note = b.get_text(b.get_start_iter(),b.get_end_iter(),gtk.FALSE) @@ -154,7 +157,7 @@ class AddressEditor: self.parent.plist.append(self.addr) self.addr.setSourceRefList(self.srcreflist) - self.update(date,street,city,state,country,postal,note,priv) + self.update(date,street,city,state,country,postal,phone,note,priv) self.callback(self.addr) def check(self,get,set,data): @@ -164,7 +167,7 @@ class AddressEditor: set(data) self.parent.lists_changed = 1 - def update(self,date,street,city,state,country,postal,note,priv): + def update(self,date,street,city,state,country,postal,phone,note,priv): """Compares the data items, and updates if necessary""" d = Date.Date() d.set(date) @@ -178,6 +181,7 @@ class AddressEditor: self.check(self.addr.getCity,self.addr.setCity,city) self.check(self.addr.getState,self.addr.setState,state) self.check(self.addr.getPostal,self.addr.setPostal,postal) + self.check(self.addr.getPhone,self.addr.setPhone,phone) self.check(self.addr.getNote,self.addr.setNote,note) self.check(self.addr.getPrivacy,self.addr.setPrivacy,priv) diff --git a/src/EditPlace.py b/src/EditPlace.py index 727b20d90..8e4df2d9b 100644 --- a/src/EditPlace.py +++ b/src/EditPlace.py @@ -91,6 +91,8 @@ class EditPlace: self.parish = self.top_window.get_widget("parish") self.county = self.top_window.get_widget("county") self.state = self.top_window.get_widget("state") + self.phone = self.top_window.get_widget("phone") + self.postal = self.top_window.get_widget("postal") self.country = self.top_window.get_widget("country") self.longitude = self.top_window.get_widget("longitude") self.latitude = self.top_window.get_widget("latitude") @@ -113,6 +115,8 @@ class EditPlace: self.loc_city = self.top_window.get_widget("loc_city") self.loc_county = self.top_window.get_widget("loc_county") self.loc_state = self.top_window.get_widget("loc_state") + self.loc_postal = self.top_window.get_widget("loc_postal") + self.loc_phone = self.top_window.get_widget("loc_phone") self.loc_parish = self.top_window.get_widget("loc_parish") self.loc_country = self.top_window.get_widget("loc_country") @@ -132,6 +136,8 @@ class EditPlace: self.city.set_text(mloc.get_city()) self.county.set_text(mloc.get_county()) self.state.set_text(mloc.get_state()) + self.phone.set_text(mloc.get_phone()) + self.postal.set_text(mloc.get_postal_code()) self.parish.set_text(mloc.get_parish()) self.country.set_text(mloc.get_country()) self.longitude.set_text(place.get_longitude()) @@ -280,6 +286,8 @@ class EditPlace: self.set(self.city,mloc.get_city,mloc.set_city) self.set(self.parish,mloc.get_parish,mloc.set_parish) self.set(self.state,mloc.get_state,mloc.set_state) + self.set(self.phone,mloc.get_phone,mloc.set_phone) + self.set(self.postal,mloc.get_postal_code,mloc.set_postal_code) self.set(self.county,mloc.get_county,mloc.set_county) self.set(self.country,mloc.get_country,mloc.set_country) self.set(self.title,self.place.get_title,self.place.set_title) @@ -381,6 +389,8 @@ class EditPlace: self.loc_city.set_text('') self.loc_county.set_text('') self.loc_state.set_text('') + self.loc_postal.set_text('') + self.loc_phone.set_text('') self.loc_parish.set_text('') self.loc_country.set_text('') else: @@ -390,6 +400,8 @@ class EditPlace: self.loc_city.set_text(loc.get_city()) self.loc_county.set_text(loc.get_county()) self.loc_state.set_text(loc.get_state()) + self.loc_postal.set_text(loc.get_postal_code()) + self.loc_phone.set_text(loc.get_phone()) self.loc_parish.set_text(loc.get_parish()) self.loc_country.set_text(loc.get_country()) diff --git a/src/LocEdit.py b/src/LocEdit.py index 10aa8329e..0a40c304b 100644 --- a/src/LocEdit.py +++ b/src/LocEdit.py @@ -54,6 +54,8 @@ class LocationEditor: self.window = self.top.get_widget("loc_edit") self.city = self.top.get_widget("city") self.state = self.top.get_widget("state") + self.postal = self.top.get_widget("postal") + self.phone = self.top.get_widget("phone") self.parish = self.top.get_widget("parish") self.county = self.top.get_widget("county") self.country = self.top.get_widget("country") @@ -66,6 +68,8 @@ class LocationEditor: self.county.set_text(location.get_county()) self.country.set_text(location.get_country()) self.state.set_text(location.get_state()) + self.phone.set_text(location.get_phone()) + self.postal.set_text(location.get_postal_code()) self.parish.set_text(location.get_parish()) self.window.set_data("o",self) @@ -92,17 +96,19 @@ class LocationEditor: county = self.county.get_text() country = self.country.get_text() state = self.state.get_text() + phone = self.phone.get_text() + postal = self.postal.get_text() parish = self.parish.get_text() if self.location == None: self.location = RelLib.Location() self.parent.llist.append(self.location) - self.update_location(city,parish,county,state,country) + self.update_location(city,parish,county,state,phone,postal,country) self.parent.redraw_location_list() - def update_location(self,city,parish,county,state,country): + def update_location(self,city,parish,county,state,phone,postal,country): if self.location.get_city() != city: self.location.set_city(city) self.parent.lists_changed = 1 @@ -119,6 +125,14 @@ class LocationEditor: self.location.set_state(state) self.parent.lists_changed = 1 + if self.location.get_phone() != phone: + self.location.set_phone(phone) + self.parent.lists_changed = 1 + + if self.location.get_postal_code() != postal: + self.location.set_postal_code(postal) + self.parent.lists_changed = 1 + if self.location.get_country() != country: self.location.set_country(country) self.parent.lists_changed = 1 diff --git a/src/RelLib.py b/src/RelLib.py index 5f8df4e30..910589dfa 100644 --- a/src/RelLib.py +++ b/src/RelLib.py @@ -464,20 +464,40 @@ class Location: self.county = source.county self.state = source.state self.country = source.country + self.postal = source.postal + self.phone = source.phone else: self.city = "" self.parish = "" self.county = "" self.state = "" self.country = "" + self.postal = "" + self.phone = "" def is_empty(self): - return self.city=="" and self.county=="" and self.state=="" and self.country=="" + return self.city=="" and self.county=="" and self.state=="" and self.country=="" and self.postal=="" and self.phone=="" def set_city(self,data): """sets the city name of the Location object""" self.city = data + def get_postal_code(self): + """returns the postal code of the Location object""" + return self.postal + + def set_postal_code(self,data): + """sets the postal code of the Location object""" + self.postal = data + + def get_phone(self): + """returns the phone number of the Location object""" + return self.phone + + def set_phone(self,data): + """sets the phone number of the Location object""" + self.phone = data + def get_city(self): """returns the city name of the Location object""" return self.city @@ -725,6 +745,7 @@ class Address(DataObj): self.country = source.country self.postal = source.postal self.date = Date(source.date) + self.phone = source.phone else: self.street = "" self.city = "" @@ -732,6 +753,7 @@ class Address(DataObj): self.country = "" self.postal = "" self.date = Date() + self.phone = "" def setDate(self,text): """attempts to sets the date that the person lived at the address @@ -764,6 +786,14 @@ class Address(DataObj): """returns the street portion of the Address""" return self.street + def setPhone(self,val): + """sets the phone number portion of the Address""" + self.phone = val + + def getPhone(self): + """returns the phone number portion of the Address""" + return self.phone + def setCity(self,val): """sets the city portion of the Address""" self.city = val diff --git a/src/dialog.glade b/src/dialog.glade index 2136a9f4d..1d857aa15 100644 --- a/src/dialog.glade +++ b/src/dialog.glade @@ -1515,7 +1515,7 @@ 12 True - 5 + 7 2 False 6 @@ -1599,8 +1599,8 @@ 0 1 - 4 - 5 + 5 + 6 fill @@ -1671,7 +1671,7 @@ True True 0 - + : True * False @@ -1763,8 +1763,100 @@ 1 2 + 5 + 6 + + + + + + + True + P_hone: + True + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + phone + + + 0 + 1 4 5 + fill + + + + + + + True + True + True + True + 0 + + True + * + False + + + 1 + 2 + 4 + 5 + + + + + + + True + _Zip/Postal code: + True + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + postal + + + 0 + 1 + 6 + 7 + fill + + + + + + + True + True + True + True + 0 + + True + * + False + + + 1 + 2 + 6 + 7 @@ -1900,7 +1992,7 @@ 12 True - 7 + 8 4 False 6 @@ -1993,7 +2085,7 @@ True - _State/Province + _State/Province: True False GTK_JUSTIFY_CENTER @@ -2088,8 +2180,8 @@ 1 2 - 6 - 7 + 7 + 8 fill @@ -2292,6 +2384,52 @@ + + + + True + P_hone: + True + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + phone + + + 0 + 1 + 6 + 7 + fill + + + + + + + True + True + True + True + 0 + + True + * + False + + + 1 + 4 + 6 + 7 + + + False diff --git a/src/edit_person.glade b/src/edit_person.glade index 0cb474933..5fc4cd9b1 100644 --- a/src/edit_person.glade +++ b/src/edit_person.glade @@ -2833,7 +2833,7 @@ 12 True - 8 + 9 6 False 3 @@ -2952,8 +2952,8 @@ 1 2 - 7 - 8 + 8 + 9 fill @@ -2976,8 +2976,8 @@ 4 5 - 7 - 8 + 8 + 9 fill @@ -3072,8 +3072,8 @@ 0 6 - 6 - 7 + 7 + 8 fill @@ -3120,8 +3120,8 @@ 2 3 - 7 - 8 + 8 + 9 fill @@ -3168,8 +3168,8 @@ 5 6 - 7 - 8 + 8 + 9 fill @@ -3268,6 +3268,54 @@ + + + + True + Phone: + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + + + 1 + 2 + 5 + 6 + fill + + + + + + + True + + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + + + 2 + 3 + 5 + 6 + fill + + + 0