GEPS 006: Add Locality field to Location
svn: r16063
This commit is contained in:
@@ -585,6 +585,7 @@ class GrampsXmlWriter(UpdateCallback):
|
||||
self.g.write('%s<address%s>\n' % (sp,conf_priv(address)))
|
||||
self.write_date(address.get_date_object(),index+1)
|
||||
self.write_line("street",address.get_street(),index+1)
|
||||
self.write_line("locality",address.get_locality(),index+1)
|
||||
self.write_line("city",address.get_city(),index+1)
|
||||
self.write_line("county",address.get_county(),index+1)
|
||||
self.write_line("state",address.get_state(),index+1)
|
||||
@@ -950,45 +951,51 @@ class GrampsXmlWriter(UpdateCallback):
|
||||
|
||||
def build_place_title(self,loc):
|
||||
"Builds a title from a location"
|
||||
city = self.fix(loc.get_city())
|
||||
street = self.fix(loc.get_street())
|
||||
locality = self.fix(loc.get_locality())
|
||||
city = self.fix(loc.get_city())
|
||||
parish = self.fix(loc.get_parish())
|
||||
county = self.fix(loc.get_county())
|
||||
state = self.fix(loc.get_state())
|
||||
country = self.fix(loc.get_country())
|
||||
county = self.fix(loc.get_county())
|
||||
|
||||
value = ""
|
||||
|
||||
if street:
|
||||
value = street
|
||||
if locality:
|
||||
value = self.append_value(value, locality)
|
||||
if city:
|
||||
value = self.append_value(value,city)
|
||||
value = self.append_value(value, city)
|
||||
if parish:
|
||||
value = self.append_value(value,parish)
|
||||
value = self.append_value(value, parish)
|
||||
if county:
|
||||
value = self.append_value(value,county)
|
||||
value = self.append_value(value, county)
|
||||
if state:
|
||||
value = self.append_value(value,state)
|
||||
value = self.append_value(value, state)
|
||||
if country:
|
||||
value = self.append_value(value,country)
|
||||
value = self.append_value(value, country)
|
||||
return value
|
||||
|
||||
def dump_location(self,loc):
|
||||
"Writes the location information to the output file"
|
||||
if loc.is_empty():
|
||||
return
|
||||
street = self.fix(loc.get_street())
|
||||
locality = self.fix(loc.get_locality())
|
||||
city = self.fix(loc.get_city())
|
||||
parish = self.fix(loc.get_parish())
|
||||
county = self.fix(loc.get_county())
|
||||
state = self.fix(loc.get_state())
|
||||
country = self.fix(loc.get_country())
|
||||
county = self.fix(loc.get_county())
|
||||
zip_code = self.fix(loc.get_postal_code())
|
||||
phone = self.fix(loc.get_phone())
|
||||
street = self.fix(loc.get_street())
|
||||
|
||||
self.g.write(' <location')
|
||||
if street:
|
||||
self.g.write(' street="%s"' % street)
|
||||
if locality:
|
||||
self.g.write(' locality="%s"' % locality)
|
||||
if city:
|
||||
self.g.write(' city="%s"' % city)
|
||||
if parish:
|
||||
|
@@ -895,14 +895,15 @@ class GrampsParser(UpdateCallback):
|
||||
take up quite a bit of time"""
|
||||
|
||||
loc = gen.lib.Location()
|
||||
loc.phone = attrs.get('phone', '')
|
||||
loc.postal = attrs.get('postal', '')
|
||||
loc.city = attrs.get('city', '')
|
||||
loc.street = attrs.get('street', '')
|
||||
loc.locality = attrs.get('locality', '')
|
||||
loc.city = attrs.get('city', '')
|
||||
loc.parish = attrs.get('parish', '')
|
||||
loc.state = attrs.get('state', '')
|
||||
loc.county = attrs.get('county', '')
|
||||
loc.state = attrs.get('state', '')
|
||||
loc.country = attrs.get('country', '')
|
||||
loc.postal = attrs.get('postal', '')
|
||||
loc.phone = attrs.get('phone', '')
|
||||
if self.locations > 0:
|
||||
self.placeobj.add_alternate_locations(loc)
|
||||
else:
|
||||
@@ -2269,6 +2270,9 @@ class GrampsParser(UpdateCallback):
|
||||
def stop_street(self, tag):
|
||||
self.address.street = tag
|
||||
|
||||
def stop_locality(self, tag):
|
||||
self.address.locality = tag
|
||||
|
||||
def stop_city(self, tag):
|
||||
self.address.city = tag
|
||||
|
||||
|
@@ -2,6 +2,7 @@
|
||||
#
|
||||
# Copyright (C) 2001-2006 Donald N. Allingham
|
||||
# Copyright (C) 2008 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
|
||||
@@ -74,42 +75,44 @@ class PlaceBaseView(ListView):
|
||||
"""
|
||||
COL_NAME = 0
|
||||
COL_ID = 1
|
||||
COL_PARISH = 2
|
||||
COL_ZIP = 3
|
||||
COL_STREET = 2
|
||||
COL_LOCALITY = 3
|
||||
COL_CITY = 4
|
||||
COL_COUNTY = 5
|
||||
COL_STATE = 6
|
||||
COL_COUNTRY = 7
|
||||
COL_LAT = 8
|
||||
COL_LON = 9
|
||||
COL_CHAN = 10
|
||||
COL_STREET = 11
|
||||
COL_ZIP = 8
|
||||
COL_PARISH = 9
|
||||
COL_LAT = 10
|
||||
COL_LON = 11
|
||||
COL_CHAN = 12
|
||||
# name of the columns
|
||||
COLUMN_NAMES = [
|
||||
_('Place Name'),
|
||||
_('ID'),
|
||||
_('Church Parish'),
|
||||
_('ZIP/Postal Code'),
|
||||
_('Street'),
|
||||
_('Locality'),
|
||||
_('City'),
|
||||
_('County'),
|
||||
_('State'),
|
||||
_('Country'),
|
||||
_('ZIP/Postal Code'),
|
||||
_('Church Parish'),
|
||||
_('Latitude'),
|
||||
_('Longitude'),
|
||||
_('Last Changed'),
|
||||
_('Street'),
|
||||
]
|
||||
# columns that contain markup
|
||||
MARKUP_COLS = [COL_NAME]
|
||||
# default setting with visible columns, order of the col, and their size
|
||||
CONFIGSETTINGS = (
|
||||
('columns.visible', [COL_NAME, COL_ID, COL_STREET, COL_CITY, COL_STATE
|
||||
]),
|
||||
('columns.rank', [COL_NAME, COL_ID, COL_STREET, COL_ZIP, COL_CITY,
|
||||
COL_COUNTY, COL_STATE, COL_COUNTRY, COL_LAT,
|
||||
COL_LON, COL_PARISH, COL_CHAN]),
|
||||
('columns.size', [250, 75, 100, 100, 100, 100, 150, 150, 150,
|
||||
150, 150, 100])
|
||||
('columns.visible', [COL_NAME, COL_ID, COL_STREET, COL_LOCALITY,
|
||||
COL_CITY, COL_COUNTY, COL_STATE]),
|
||||
('columns.rank', [COL_NAME, COL_ID, COL_STREET, COL_LOCALITY, COL_CITY,
|
||||
COL_COUNTY, COL_STATE, COL_COUNTRY, COL_ZIP,
|
||||
COL_PARISH, COL_LAT, COL_LON, COL_CHAN]),
|
||||
('columns.size', [250, 75, 150, 150, 150, 150, 100, 100, 100,
|
||||
100, 150, 150, 100])
|
||||
)
|
||||
ADD_MSG = _("Add a new place")
|
||||
EDIT_MSG = _("Edit the selected place")
|
||||
@@ -132,7 +135,7 @@ class PlaceBaseView(ListView):
|
||||
|
||||
ListView.__init__(
|
||||
self, title, dbstate, uistate,
|
||||
self.COLUMN_NAMES, 13,
|
||||
self.COLUMN_NAMES, 14,
|
||||
model, signal_map,
|
||||
dbstate.db.get_place_bookmarks(),
|
||||
Bookmarks.PlaceBookmarks, nav_group,
|
||||
|
@@ -121,6 +121,7 @@ class PlaceReport(Report):
|
||||
place_details = [_("Gramps ID: %s ") % place.get_gramps_id(),
|
||||
_("Street: %s ") % location.get_street(),
|
||||
_("Parish: %s ") % location.get_parish(),
|
||||
_("Locality: %s ") % location.get_locality(),
|
||||
_("City: %s ") % location.get_city(),
|
||||
_("County: %s ") % location.get_county(),
|
||||
_("State: %s") % location.get_state(),
|
||||
|
@@ -53,43 +53,45 @@ class PlaceTreeView(PlaceBaseView):
|
||||
"""
|
||||
COL_PLACE = 0
|
||||
COL_ID = 1
|
||||
COL_PARISH = 2
|
||||
COL_ZIP = 3
|
||||
COL_STREET = 2
|
||||
COL_LOCALITY = 3
|
||||
COL_CITY = 4
|
||||
COL_COUNTY = 5
|
||||
COL_STATE = 6
|
||||
COL_COUNTRY = 7
|
||||
COL_LAT = 8
|
||||
COL_LON = 9
|
||||
COL_CHAN = 10
|
||||
COL_STREET = 11
|
||||
COL_NAME = 12
|
||||
COL_ZIP = 8
|
||||
COL_PARISH = 9
|
||||
COL_LAT = 10
|
||||
COL_LON = 11
|
||||
COL_CHAN = 12
|
||||
COL_NAME = 13
|
||||
# name of the columns
|
||||
COLUMN_NAMES = [
|
||||
_('Place'),
|
||||
_('ID'),
|
||||
_('Church Parish'),
|
||||
_('ZIP/Postal Code'),
|
||||
_('Street'),
|
||||
_('Locality'),
|
||||
_('City'),
|
||||
_('County'),
|
||||
_('State'),
|
||||
_('Country'),
|
||||
_('ZIP/Postal Code'),
|
||||
_('Church Parish'),
|
||||
_('Latitude'),
|
||||
_('Longitude'),
|
||||
_('Last Changed'),
|
||||
_('Street'),
|
||||
_('Place Name'),
|
||||
]
|
||||
# default setting with visible columns, order of the col, and their size
|
||||
CONFIGSETTINGS = (
|
||||
('columns.visible', [COL_PLACE, COL_ID, COL_STREET, COL_CITY, COL_STATE
|
||||
]),
|
||||
('columns.rank', [COL_PLACE, COL_ID, COL_STREET, COL_ZIP, COL_CITY,
|
||||
COL_COUNTY, COL_STATE, COL_COUNTRY, COL_LAT,
|
||||
COL_LON, COL_PARISH, COL_CHAN, COL_NAME]),
|
||||
('columns.size', [250, 75, 100, 100, 100, 100, 150, 150, 150,
|
||||
150, 150, 100, 150])
|
||||
)
|
||||
('columns.visible', [COL_PLACE, COL_ID, COL_STREET, COL_LOCALITY,
|
||||
COL_CITY, COL_COUNTY, COL_STATE]),
|
||||
('columns.rank', [COL_PLACE, COL_ID, COL_STREET, COL_LOCALITY, COL_CITY,
|
||||
COL_COUNTY, COL_STATE, COL_COUNTRY, COL_ZIP,
|
||||
COL_PARISH, COL_LAT, COL_LON, COL_CHAN, COL_NAME]),
|
||||
('columns.size', [250, 75, 150, 150, 150, 150, 100, 100, 100,
|
||||
100, 150, 150, 100, 150])
|
||||
)
|
||||
|
||||
def __init__(self, dbstate, uistate):
|
||||
PlaceBaseView.__init__(self, dbstate, uistate,
|
||||
|
Reference in New Issue
Block a user