GEPS 006: Add Locality to Address and GEDCOM Import/Export
svn: r16071
This commit is contained in:
parent
6a473c8a54
commit
9df5336fde
@ -38,7 +38,7 @@
|
||||
<object class="GtkLabel" id="label210">
|
||||
<property name="visible">True</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes">Add_ress:</property>
|
||||
<property name="label" translatable="yes">St_reet:</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="justify">center</property>
|
||||
<property name="mnemonic_widget">street</property>
|
||||
@ -54,14 +54,14 @@
|
||||
<object class="GtkLabel" id="label214">
|
||||
<property name="visible">True</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes">C_ity/County:</property>
|
||||
<property name="label" translatable="yes">C_ity:</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="justify">center</property>
|
||||
<property name="mnemonic_widget">city</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="top_attach">2</property>
|
||||
<property name="bottom_attach">3</property>
|
||||
<property name="top_attach">3</property>
|
||||
<property name="bottom_attach">4</property>
|
||||
<property name="x_options">GTK_FILL</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
@ -70,14 +70,14 @@
|
||||
<object class="UndoableEntry" id="city">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="tooltip_text" translatable="yes">The village or city of the address</property>
|
||||
<property name="tooltip_text" translatable="yes">The town or city of the address</property>
|
||||
<property name="invisible_char">●</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">3</property>
|
||||
<property name="top_attach">2</property>
|
||||
<property name="bottom_attach">3</property>
|
||||
<property name="top_attach">3</property>
|
||||
<property name="bottom_attach">4</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
@ -85,7 +85,7 @@
|
||||
<object class="GtkLabel" id="label215">
|
||||
<property name="visible">True</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes">_State/Province:</property>
|
||||
<property name="label" translatable="yes">_State/County:</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="justify">center</property>
|
||||
<property name="mnemonic_widget">state</property>
|
||||
@ -109,8 +109,8 @@
|
||||
<property name="mnemonic_widget">postal</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="top_attach">3</property>
|
||||
<property name="bottom_attach">4</property>
|
||||
<property name="top_attach">4</property>
|
||||
<property name="bottom_attach">5</property>
|
||||
<property name="x_options">GTK_FILL</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
@ -125,8 +125,8 @@
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">3</property>
|
||||
<property name="top_attach">3</property>
|
||||
<property name="bottom_attach">4</property>
|
||||
<property name="top_attach">4</property>
|
||||
<property name="bottom_attach">5</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
@ -157,6 +157,8 @@
|
||||
<property name="mnemonic_widget">phone</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">4</property>
|
||||
<property name="right_attach">5</property>
|
||||
<property name="top_attach">4</property>
|
||||
<property name="bottom_attach">5</property>
|
||||
<property name="x_options">GTK_FILL</property>
|
||||
@ -171,8 +173,8 @@
|
||||
<property name="invisible_char">●</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">3</property>
|
||||
<property name="left_attach">5</property>
|
||||
<property name="right_attach">7</property>
|
||||
<property name="top_attach">4</property>
|
||||
<property name="bottom_attach">5</property>
|
||||
<property name="y_options"></property>
|
||||
@ -182,7 +184,7 @@
|
||||
<object class="UndoableEntry" id="state">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="tooltip_text" translatable="yes">The state or province of the address in case a mail address must contain this.</property>
|
||||
<property name="tooltip_text" translatable="yes">The state or county of the address in case a mail address must contain this.</property>
|
||||
<property name="invisible_char">●</property>
|
||||
</object>
|
||||
<packing>
|
||||
@ -282,13 +284,34 @@ Note: Use Residence Event for genealogical address data.</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
<object class="GtkLabel" id="label1">
|
||||
<property name="visible">True</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes">_Locality:</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="mnemonic_widget">locality</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="top_attach">2</property>
|
||||
<property name="bottom_attach">3</property>
|
||||
<property name="x_options">GTK_FILL</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
<object class="GtkEntry" id="locality">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="tooltip_text" translatable="yes">The locality of the address</property>
|
||||
<property name="invisible_char">●</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">3</property>
|
||||
<property name="top_attach">2</property>
|
||||
<property name="bottom_attach">3</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
|
@ -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):
|
||||
"""
|
||||
|
@ -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,
|
||||
|
@ -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)
|
||||
|
@ -6,6 +6,7 @@
|
||||
# Copyright (C) 2008-2009 Gary Burton
|
||||
# Copyright (C) 2008 Robert Cheramy <robert@cheramy.net>
|
||||
# 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():
|
||||
|
@ -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 <ADDRESS_LINE> {0:1}
|
||||
+1 CONT <ADDRESS_LINE> {0:M}
|
||||
+1 ADR1 <ADDRESS_LINE1> {0:1}
|
||||
+1 ADR2 <ADDRESS_LINE2> {0:1}
|
||||
+1 ADR1 <ADDRESS_LINE1> {0:1} (Street)
|
||||
+1 ADR2 <ADDRESS_LINE2> {0:1} (Locality)
|
||||
+1 CITY <ADDRESS_CITY> {0:1}
|
||||
+1 STAE <ADDRESS_STATE> {0:1}
|
||||
+1 POST <ADDRESS_POSTAL_CODE> {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 <ADDRESS_LINE> {0:1}
|
||||
+1 CONT <ADDRESS_LINE> {0:M}
|
||||
+1 ADR1 <ADDRESS_LINE1> {0:1}
|
||||
+1 ADR2 <ADDRESS_LINE2> {0:1}
|
||||
+1 ADR1 <ADDRESS_LINE1> {0:1} (Street)
|
||||
+1 ADR2 <ADDRESS_LINE2> {0:1} (Locality)
|
||||
+1 CITY <ADDRESS_CITY> {0:1}
|
||||
+1 STAE <ADDRESS_STATE> {0:1}
|
||||
+1 POST <ADDRESS_POSTAL_CODE> {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())
|
||||
|
Loading…
Reference in New Issue
Block a user