diff --git a/src/glade/editaddress.glade b/src/glade/editaddress.glade index a9b8a1fe8..0d8d40dcd 100644 --- a/src/glade/editaddress.glade +++ b/src/glade/editaddress.glade @@ -38,7 +38,7 @@ True 0 - Add_ress: + St_reet: True center street @@ -54,14 +54,14 @@ True 0 - C_ity/County: + C_ity: True center city - 2 - 3 + 3 + 4 GTK_FILL @@ -70,14 +70,14 @@ True True - The village or city of the address + The town or city of the address 1 3 - 2 - 3 + 3 + 4 @@ -85,7 +85,7 @@ True 0 - _State/Province: + _State/County: True center state @@ -109,8 +109,8 @@ postal - 3 - 4 + 4 + 5 GTK_FILL @@ -125,8 +125,8 @@ 1 3 - 3 - 4 + 4 + 5 @@ -157,6 +157,8 @@ phone + 4 + 5 4 5 GTK_FILL @@ -171,8 +173,8 @@ - 1 - 3 + 5 + 7 4 5 @@ -182,7 +184,7 @@ True True - The state or province of the address in case a mail address must contain this. + The state or county of the address in case a mail address must contain this. @@ -282,13 +284,34 @@ Note: Use Residence Event for genealogical address data. - + + True + 0 + _Locality: + True + locality + + + 2 + 3 + GTK_FILL + + - - - - + + True + True + The locality of the address + + + + 1 + 3 + 2 + 3 + + diff --git a/src/gui/editors/displaytabs/addrembedlist.py b/src/gui/editors/displaytabs/addrembedlist.py index fad75cca5..a3db37bfe 100644 --- a/src/gui/editors/displaytabs/addrembedlist.py +++ b/src/gui/editors/displaytabs/addrembedlist.py @@ -54,7 +54,7 @@ class AddrEmbedList(EmbeddedList): Derives from the EmbeddedList class. """ - _HANDLE_COL = 5 + _HANDLE_COL = 6 _DND_TYPE = DdTargets.ADDRESS _MSG = { @@ -68,11 +68,12 @@ class AddrEmbedList(EmbeddedList): #index = column in model. Value = # (name, sortcol in model, width, markup/text, weigth_col _column_names = [ - (_('Date'), 0, 150, 1, -1), - (_('Address'), 1, 225, 0, -1), - (_('City'), 2, 100, 0, -1), - (_('State'), 3, 100, 0, -1), - (_('Country'), 4, 75, 0, -1), + (_('Date'), 0, 150, 1, -1), + (_('Street'), 1, 225, 0, -1), + (_('Locality'), 2, 100, 0, -1), + (_('City'), 3, 100, 0, -1), + (_('State/County'), 4, 100, 0, -1), + (_('Country'), 5, 75, 0, -1), ] def __init__(self, dbstate, uistate, track, data): @@ -96,7 +97,7 @@ class AddrEmbedList(EmbeddedList): """ Return the column order of the columns in the display tab. """ - return ((1, 0), (1, 1), (1, 2), (1, 3), (1, 4)) + return ((1, 0), (1, 1), (1, 2), (1, 3), (1, 4), (1, 5)) def add_button_clicked(self, obj): """ diff --git a/src/gui/editors/displaytabs/addressmodel.py b/src/gui/editors/displaytabs/addressmodel.py index da8e63d2e..509210e2f 100644 --- a/src/gui/editors/displaytabs/addressmodel.py +++ b/src/gui/editors/displaytabs/addressmodel.py @@ -52,12 +52,13 @@ class AddressModel(gtk.ListStore): """ AddressModel derives from the ListStore, defining te items in the list """ - gtk.ListStore.__init__(self, str, str, str, str, str, object) + gtk.ListStore.__init__(self, str, str, str, str, str, str, object) self.db = dbase for obj in obj_list: self.append(row=[ DateHandler.get_date(obj), obj.street, + obj.locality, obj.city, obj.state, obj.country, diff --git a/src/gui/editors/editaddress.py b/src/gui/editors/editaddress.py index 39f607571..e531aac4e 100644 --- a/src/gui/editors/editaddress.py +++ b/src/gui/editors/editaddress.py @@ -2,7 +2,8 @@ # Gramps - a GTK+/GNOME based genealogy program # # Copyright (C) 2000-2007 Donald N. Allingham -# 2009 Gary Burton +# Copyright (C) 2009 Gary Burton +# Copyright (C) 2010 Nick Hall # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -97,6 +98,10 @@ class EditAddress(EditSecondary): self.top.get_object("city"), self.obj.set_city, self.obj.get_city, self.db.readonly) + self.locality = MonitoredEntry( + self.top.get_object("locality"), self.obj.set_locality, + self.obj.get_locality, self.db.readonly) + self.state = MonitoredEntry( self.top.get_object("state"), self.obj.set_state, self.obj.get_state, self.db.readonly) diff --git a/src/plugins/export/ExportGedcom.py b/src/plugins/export/ExportGedcom.py index 566d087ad..95bce2b77 100644 --- a/src/plugins/export/ExportGedcom.py +++ b/src/plugins/export/ExportGedcom.py @@ -6,6 +6,7 @@ # Copyright (C) 2008-2009 Gary Burton # Copyright (C) 2008 Robert Cheramy # Copyright (C) 2010 Jakim Friant +# Copyright (C) 2010 Nick Hall # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -361,6 +362,7 @@ class GedcomWriter(UpdateCallback): owner = self.dbase.get_researcher() name = owner.get_name() addr = owner.get_address() + adr2 = owner.get_locality() city = owner.get_city() state = owner.get_state() ctry = owner.get_country() @@ -380,6 +382,8 @@ class GedcomWriter(UpdateCallback): self.__writeln(2, "CONT", "%s, %s %s" % (city, state, post)) else: self.__writeln(2, "CONT", u"Not Provided") + if adr2: + self.__writeln(2, "ADR2", adr2) if city: self.__writeln(2, "CITY", city) if state: @@ -679,6 +683,8 @@ class GedcomWriter(UpdateCallback): self.__writeln(1, 'RESI') self.__date(2, addr.get_date_object()) self.__writeln(2, "ADDR", addr.get_street()) + if addr.get_locality(): + self.__writeln(3, 'ADR2', addr.get_locality()) if addr.get_city(): self.__writeln(3, 'CITY', addr.get_city()) if addr.get_state(): @@ -1005,6 +1011,8 @@ class GedcomWriter(UpdateCallback): self.__writeln(1, 'NAME', repo.get_name()) for addr in repo.get_address_list(): self.__writeln(1, "ADDR", addr.get_street()) + if addr.get_locality(): + self.__writeln(2, 'ADR2', addr.get_locality()) if addr.get_city(): self.__writeln(2, 'CITY', addr.get_city()) if addr.get_state(): @@ -1359,6 +1367,8 @@ class GedcomWriter(UpdateCallback): location = place.get_main_location() if location and not location.is_empty(): self.__writeln(level, "ADDR", location.get_street()) + if location.get_locality(): + self.__writeln(level + 1, 'ADR2', location.get_locality()) if location.get_city(): self.__writeln(level + 1, 'CITY', location.get_city()) if location.get_state(): diff --git a/src/plugins/lib/libgedcom.py b/src/plugins/lib/libgedcom.py index cf7681f5c..a646df69d 100644 --- a/src/plugins/lib/libgedcom.py +++ b/src/plugins/lib/libgedcom.py @@ -3,6 +3,7 @@ # # Copyright (C) 2000-2007 Donald N. Allingham # Copyright (C) 2009-2010 Gary Burton +# Copyright (C) 2010 Nick Hall # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -1513,6 +1514,11 @@ class PlaceParser(object): 'subdivision' : gen.lib.Location.set_street, 'addr1' : gen.lib.Location.set_street, 'adr1' : gen.lib.Location.set_street, + 'street' : gen.lib.Location.set_street, + 'addr2' : gen.lib.Location.set_locality, + 'adr2' : gen.lib.Location.set_locality, + 'locality' : gen.lib.Location.set_locality, + 'neighborhood' : gen.lib.Location.set_locality, 'city' : gen.lib.Location.set_city, 'town' : gen.lib.Location.set_city, 'village' : gen.lib.Location.set_city, @@ -1523,6 +1529,8 @@ class PlaceParser(object): 'region' : gen.lib.Location.set_state, 'province' : gen.lib.Location.set_state, 'area code' : gen.lib.Location.set_postal_code, + 'post code' : gen.lib.Location.set_postal_code, + 'zip code' : gen.lib.Location.set_postal_code, } def __init__(self, line=None): @@ -2029,7 +2037,7 @@ class GedcomParser(UpdateCallback): self.parse_loc_tbl = { TOKEN_ADDR : self.__location_addr, TOKEN_ADR1 : self.__location_addr, - TOKEN_ADR2 : self.__location_addr, + TOKEN_ADR2 : self.__location_adr2, TOKEN_DATE : self.__location_date, TOKEN_CITY : self.__location_city, TOKEN_STAE : self.__location_stae, @@ -2128,6 +2136,7 @@ class GedcomParser(UpdateCallback): self.parse_addr_tbl = { TOKEN_DATE : self.__address_date, + TOKEN_ADR2 : self.__address_adr2, TOKEN_CITY : self.__address_city, TOKEN_STAE : self.__address_state, TOKEN_POST : self.__address_post, @@ -3044,8 +3053,8 @@ class GedcomParser(UpdateCallback): n ADDR {0:1} +1 CONT {0:M} - +1 ADR1 {0:1} - +1 ADR2 {0:1} + +1 ADR1 {0:1} (Street) + +1 ADR2 {0:1} (Locality) +1 CITY {0:1} +1 STAE {0:1} +1 POST {0:1} @@ -4635,6 +4644,17 @@ class GedcomParser(UpdateCallback): """ state.addr.set_date_object(line.data) + def __address_adr2(self, line, state): + """ + Parses the ADR2 line of an ADDR tag + + @param line: The current line in GedLine format + @type line: GedLine + @param state: The current state + @type state: CurrentState + """ + state.addr.set_locality(line.data) + def __address_city(self, line, state): """ Parses the CITY line of an ADDR tag @@ -5249,8 +5269,8 @@ class GedcomParser(UpdateCallback): """ n ADDR {0:1} +1 CONT {0:M} - +1 ADR1 {0:1} - +1 ADR2 {0:1} + +1 ADR1 {0:1} (Street) + +1 ADR2 {0:1} (Locality) +1 CITY {0:1} +1 STAE {0:1} +1 POST {0:1} @@ -5328,6 +5348,17 @@ class GedcomParser(UpdateCallback): state.location = gen.lib.Location() state.location.set_date_object(line.data) + def __location_adr2(self, line, state): + """ + @param line: The current line in GedLine format + @type line: GedLine + @param state: The current state + @type state: CurrentState + """ + if not state.location: + state.location = gen.lib.Location() + state.location.set_locality(line.data) + def __location_city(self, line, state): """ @param line: The current line in GedLine format @@ -5796,6 +5827,7 @@ class GedcomParser(UpdateCallback): location = sub_state.location state.res.set_address(location.get_street()) + state.res.set_locality(location.get_locality()) state.res.set_city(location.get_city()) state.res.set_state(location.get_state()) state.res.set_country(location.get_country())