Display Lat/Lon optionally on places list page (#467)

Fixes #05382
This commit is contained in:
Serge Noiraud 2017-11-23 09:37:47 +01:00 committed by GitHub
parent d677a1a785
commit d59fe6b2af
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 46 additions and 25 deletions

View File

@ -1730,6 +1730,12 @@ class NavWebOptions(MenuReportOptions):
_('Whether to display children in birth order or in entry order?')) _('Whether to display children in birth order or in entry order?'))
addopt("birthorder", birthorder) addopt("birthorder", birthorder)
coordinates = BooleanOption(
_('Do we display coordinates in the places list?'), False)
coordinates.set_help(
_('Whether to display latitude/longitude in the places list?'))
addopt("coordinates", coordinates)
def __add_page_generation_options(self, menu): def __add_page_generation_options(self, menu):
""" """
Options on the "Page Generation" tab. Options on the "Page Generation" tab.

View File

@ -100,6 +100,9 @@ class PlacePages(BasePage):
self.familymappages = None self.familymappages = None
self.googlemapkey = None self.googlemapkey = None
# Place needs to display coordinates?
self.display_coordinates = report.options["coordinates"]
def display_pages(self, title): def display_pages(self, title):
""" """
Generate and output the pages under the Place tab, namely the place Generate and output the pages under the Place tab, namely the place
@ -168,17 +171,28 @@ class PlacePages(BasePage):
trow = Html("tr") trow = Html("tr")
thead += trow thead += trow
trow.extend( if self.display_coordinates:
Html("th", label, class_=colclass, inline=True) trow.extend(
for (label, colclass) in [ Html("th", label, class_=colclass, inline=True)
[self._("Letter"), "ColumnLetter"], for (label, colclass) in [
[self._("Place Name | Name"), "ColumnName"], [self._("Letter"), "ColumnLetter"],
[self._("State/ Province"), "ColumnState"], [self._("Place Name | Name"), "ColumnName"],
[self._("Country"), "ColumnCountry"], [self._("State/ Province"), "ColumnState"],
[self._("Latitude"), "ColumnLatitude"], [self._("Country"), "ColumnCountry"],
[self._("Longitude"), "ColumnLongitude"] [self._("Latitude"), "ColumnLatitude"],
] [self._("Longitude"), "ColumnLongitude"]
) ]
)
else:
trow.extend(
Html("th", label, class_=colclass, inline=True)
for (label, colclass) in [
[self._("Letter"), "ColumnLetter"],
[self._("Place Name | Name"), "ColumnName"],
[self._("State/ Province"), "ColumnState"],
[self._("Country"), "ColumnCountry"]
]
)
# bug 9495 : incomplete display of place hierarchy labels # bug 9495 : incomplete display of place hierarchy labels
def sort_by_place_name(obj): def sort_by_place_name(obj):
@ -243,21 +257,22 @@ class PlacePages(BasePage):
] ]
) )
tcell1 = Html("td", class_="ColumnLatitude", if self.display_coordinates:
inline=True) tcell1 = Html("td", class_="ColumnLatitude",
tcell2 = Html("td", class_="ColumnLongitude", inline=True)
inline=True) tcell2 = Html("td", class_="ColumnLongitude",
trow += (tcell1, tcell2) inline=True)
trow += (tcell1, tcell2)
if place.lat and place.long: if place.lat and place.long:
latitude, longitude = conv_lat_lon(place.lat, latitude, longitude = conv_lat_lon(place.lat,
place.long, place.long,
"DEG") "DEG")
tcell1 += latitude tcell1 += latitude
tcell2 += longitude tcell2 += longitude
else: else:
tcell1 += ' ' tcell1 += ' '
tcell2 += ' ' tcell2 += ' '
# add clearline for proper styling # add clearline for proper styling
# add footer section # add footer section