From db263ff905b3b5e50da5b1f97cb79714711e417d Mon Sep 17 00:00:00 2001 From: Serge Noiraud Date: Fri, 16 Feb 2018 11:10:01 +0100 Subject: [PATCH] Apply places changes to the narrativeweb. (#547) * Apply places changes to the narrativeweb. Also change order between locations and locations alternate names. Fixes #10427 * Put the alternate locations back. * Suppress extra line in Alternate Names section. --- gramps/plugins/webreport/basepage.py | 52 ++++++++++++++++++++-------- 1 file changed, 38 insertions(+), 14 deletions(-) diff --git a/gramps/plugins/webreport/basepage.py b/gramps/plugins/webreport/basepage.py index 0a3826f39..7055fb3af 100644 --- a/gramps/plugins/webreport/basepage.py +++ b/gramps/plugins/webreport/basepage.py @@ -2560,6 +2560,44 @@ class BasePage: # pylint: disable=C1001 ) tbody += trow + # display all related locations + for placeref in place.get_placeref_list(): + place_date = self.rlocale.get_date(placeref.get_date_object()) + if place_date != "": + parent_place = self.r_db.get_place_from_handle(placeref.ref) + parent_name = parent_place.get_name().get_value() + trow = Html('tr') + ( + Html("td", self._("Locations"), class_="ColumnAttribute", + inline=True), + Html("td", parent_name, class_="ColumnValue", inline=True), + Html("td", place_date, class_="ColumnValue", inline=True) + ) + tbody += trow + + altloc = place.get_alternative_names() + if altloc: + tbody += Html("tr") + Html("td", " ", colspan=2) + trow = Html("tr") + ( + Html("th", self._("Alternate Names"), colspan=1, + class_="ColumnAttribute", inline=True), + Html("th", self._("Language"), colspan=1, + class_="ColumnAttribute", inline=True), + Html("th", self._("Date range in which the name is valid."), colspan=1, + class_="ColumnAttribute", inline=True), + ) + tbody += trow + for loc in altloc: + place_date = self.rlocale.get_date(loc.date) + trow = Html("tr") + ( + Html("td", loc.get_value(), class_="ColumnValue", + inline=True), + Html("td", loc.get_language(), class_="ColumnValue", + inline=True), + Html("td", place_date, class_="ColumnValue", + inline=True), + ) + tbody += trow + altloc = place.get_alternate_locations() if altloc: tbody += Html("tr") + Html("td", " ", colspan=2) @@ -2587,20 +2625,6 @@ class BasePage: # pylint: disable=C1001 tbody += trow tbody += Html("tr") + Html("td", " ", colspan=2) - # display all related locations - for placeref in place.get_placeref_list(): - place_date = self.rlocale.get_date(placeref.get_date_object()) - if place_date != "": - parent_place = self.r_db.get_place_from_handle(placeref.ref) - parent_name = parent_place.get_name().get_value() - trow = Html('tr') + ( - Html("td", self._("Locations"), class_="ColumnAttribute", - inline=True), - Html("td", parent_name, class_="ColumnValue", inline=True), - Html("td", place_date, class_="ColumnValue", inline=True) - ) - tbody += trow - # return place table to its callers return table