* 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
This commit is contained in:
Don Allingham 2003-12-09 06:00:51 +00:00
parent c923bd5bff
commit 2cd742578a
6 changed files with 270 additions and 24 deletions

View File

@ -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)

View File

@ -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())

View File

@ -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

View File

@ -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

View File

@ -1515,7 +1515,7 @@
<widget class="GtkTable" id="table23">
<property name="border_width">12</property>
<property name="visible">True</property>
<property name="n_rows">5</property>
<property name="n_rows">7</property>
<property name="n_columns">2</property>
<property name="homogeneous">False</property>
<property name="row_spacing">6</property>
@ -1599,8 +1599,8 @@
<packing>
<property name="left_attach">0</property>
<property name="right_attach">1</property>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="top_attach">5</property>
<property name="bottom_attach">6</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
@ -1671,7 +1671,7 @@
<property name="editable">True</property>
<property name="visibility">True</property>
<property name="max_length">0</property>
<property name="text" translatable="yes"></property>
<property name="text" translatable="yes">:</property>
<property name="has_frame">True</property>
<property name="invisible_char" translatable="yes">*</property>
<property name="activates_default">False</property>
@ -1763,8 +1763,100 @@
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">5</property>
<property name="bottom_attach">6</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label296">
<property name="visible">True</property>
<property name="label" translatable="yes">P_hone:</property>
<property name="use_underline">True</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">phone</property>
</widget>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">1</property>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkEntry" id="phone">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">True</property>
<property name="visibility">True</property>
<property name="max_length">0</property>
<property name="text" translatable="yes"></property>
<property name="has_frame">True</property>
<property name="invisible_char" translatable="yes">*</property>
<property name="activates_default">False</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label297">
<property name="visible">True</property>
<property name="label" translatable="yes">_Zip/Postal code:</property>
<property name="use_underline">True</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">postal</property>
</widget>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">1</property>
<property name="top_attach">6</property>
<property name="bottom_attach">7</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkEntry" id="postal">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">True</property>
<property name="visibility">True</property>
<property name="max_length">0</property>
<property name="text" translatable="yes"></property>
<property name="has_frame">True</property>
<property name="invisible_char" translatable="yes">*</property>
<property name="activates_default">False</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">6</property>
<property name="bottom_attach">7</property>
<property name="y_options"></property>
</packing>
</child>
@ -1900,7 +1992,7 @@
<widget class="GtkTable" id="table26">
<property name="border_width">12</property>
<property name="visible">True</property>
<property name="n_rows">7</property>
<property name="n_rows">8</property>
<property name="n_columns">4</property>
<property name="homogeneous">False</property>
<property name="row_spacing">6</property>
@ -1993,7 +2085,7 @@
<child>
<widget class="GtkLabel" id="label215">
<property name="visible">True</property>
<property name="label" translatable="yes">_State/Province</property>
<property name="label" translatable="yes">_State/Province:</property>
<property name="use_underline">True</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_CENTER</property>
@ -2088,8 +2180,8 @@
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">6</property>
<property name="bottom_attach">7</property>
<property name="top_attach">7</property>
<property name="bottom_attach">8</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
@ -2292,6 +2384,52 @@
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label295">
<property name="visible">True</property>
<property name="label" translatable="yes">P_hone:</property>
<property name="use_underline">True</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">phone</property>
</widget>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">1</property>
<property name="top_attach">6</property>
<property name="bottom_attach">7</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkEntry" id="phone">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">True</property>
<property name="visibility">True</property>
<property name="max_length">0</property>
<property name="text" translatable="yes"></property>
<property name="has_frame">True</property>
<property name="invisible_char" translatable="yes">*</property>
<property name="activates_default">False</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">4</property>
<property name="top_attach">6</property>
<property name="bottom_attach">7</property>
<property name="y_options"></property>
</packing>
</child>
</widget>
<packing>
<property name="tab_expand">False</property>

View File

@ -2833,7 +2833,7 @@
<widget class="GtkTable" id="table28">
<property name="border_width">12</property>
<property name="visible">True</property>
<property name="n_rows">8</property>
<property name="n_rows">9</property>
<property name="n_columns">6</property>
<property name="homogeneous">False</property>
<property name="row_spacing">3</property>
@ -2952,8 +2952,8 @@
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">7</property>
<property name="bottom_attach">8</property>
<property name="top_attach">8</property>
<property name="bottom_attach">9</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
@ -2976,8 +2976,8 @@
<packing>
<property name="left_attach">4</property>
<property name="right_attach">5</property>
<property name="top_attach">7</property>
<property name="bottom_attach">8</property>
<property name="top_attach">8</property>
<property name="bottom_attach">9</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
@ -3072,8 +3072,8 @@
<packing>
<property name="left_attach">0</property>
<property name="right_attach">6</property>
<property name="top_attach">6</property>
<property name="bottom_attach">7</property>
<property name="top_attach">7</property>
<property name="bottom_attach">8</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
@ -3120,8 +3120,8 @@
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">7</property>
<property name="bottom_attach">8</property>
<property name="top_attach">8</property>
<property name="bottom_attach">9</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
@ -3168,8 +3168,8 @@
<packing>
<property name="left_attach">5</property>
<property name="right_attach">6</property>
<property name="top_attach">7</property>
<property name="bottom_attach">8</property>
<property name="top_attach">8</property>
<property name="bottom_attach">9</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
@ -3268,6 +3268,54 @@
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label348">
<property name="visible">True</property>
<property name="label" translatable="yes">Phone:</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">5</property>
<property name="bottom_attach">6</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="phone">
<property name="visible">True</property>
<property name="label" translatable="yes"></property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">5</property>
<property name="bottom_attach">6</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>