diff --git a/gramps/plugins/lib/maps/geography.py b/gramps/plugins/lib/maps/geography.py index fdf37a3f7..b3bf8454d 100644 --- a/gramps/plugins/lib/maps/geography.py +++ b/gramps/plugins/lib/maps/geography.py @@ -397,6 +397,13 @@ class GeoGraphyView(OsmGps, NavigationView): found = True if found: self.bubble_message(event, lat, lon, mark_selected) + # add the first place found to history + hobj = self.uistate.get_history(self.navigation_type(), + self.navigation_group()) + place = self.dbstate.db.get_place_from_gramps_id(mark_selected[0][9]) + handle = place.get_handle() + if handle and not hobj.lock and not (handle == hobj.present()): + hobj.push(handle) self.uistate.set_busy_cursor(False) def bubble_message(self, event, lat, lon, mark): diff --git a/gramps/plugins/lib/maps/osmGps.py b/gramps/plugins/lib/maps/osmGps.py index b7ea691b1..9ee37d045 100644 --- a/gramps/plugins/lib/maps/osmGps.py +++ b/gramps/plugins/lib/maps/osmGps.py @@ -320,7 +320,7 @@ class OsmGps(): self.end_selection = current self.zone_selection = False elif event.button == 3 and event.type == Gdk.EventType.BUTTON_PRESS: - self.build_nav_menu(osm, event, lat, lon ) + self.build_nav_menu(osm, event, lat, lon) else: self.save_center(lat, lon) diff --git a/gramps/plugins/view/geoclose.py b/gramps/plugins/view/geoclose.py index e6b73cc62..bed78b180 100644 --- a/gramps/plugins/view/geoclose.py +++ b/gramps/plugins/view/geoclose.py @@ -34,6 +34,7 @@ from gramps.gen.ggettext import gettext as _ import operator from gi.repository import Gtk from math import * +import cgi #------------------------------------------------------------------------- # @@ -50,7 +51,7 @@ _LOG = logging.getLogger("GeoGraphy.geoclose") #------------------------------------------------------------------------- from gramps.gen.lib import EventRoleType, EventType from gramps.gen.config import config -from gramps.gen.datehandler import displayer +from gramps.gen.datehandler import displayer, get_date from gramps.gen.display.name import displayer as _nd from gramps.gen.utils.place import conv_lat_lon from gramps.gui.views.navigationview import NavigationView @@ -58,6 +59,7 @@ from gramps.gui.views.bookmarks import PersonBookmarks from gramps.plugins.lib.maps import constants from gramps.plugins.lib.maps.geography import GeoGraphyView from gramps.gui.selectors import SelectorFactory +from gramps.gen.utils.db import (get_birth_or_fallback, get_death_or_fallback) #------------------------------------------------------------------------- # @@ -214,8 +216,12 @@ class GeoClose(GeoGraphyView): self._createmap(p1, color, self.place_list_active, False) if self.refperson: color = self._config.get('geography.color1') - self.message_layer.add_message(_("Reference : %s" % _nd.display(self.refperson))) - self.message_layer.add_message(_("The other : %s" % _nd.display(p1))) + self.message_layer.add_message(_("Reference : %s ( %s - %s )" % ( _nd.display(self.refperson), + self.birth(self.refperson), + self.death(self.refperson)))) + self.message_layer.add_message(_("The other : %s ( %s - %s )" % ( _nd.display(p1), + self.birth(p1), + self.death(p1)))) self._createmap(self.refperson, color, self.place_list_ref, True) else: self.message_layer.add_message(_("You must choose one reference person.")) @@ -225,6 +231,40 @@ class GeoClose(GeoGraphyView): self.possible_meeting(self.place_list_ref, self.place_list_active) self.uistate.modify_statusbar(self.dbstate) + def birth(self, person): + """ + return "" or the birth date of the person + """ + birth = get_birth_or_fallback(self.dbstate.db, person) + if birth and birth.get_type() != EventType.BIRTH: + sdate = get_date(birth) + if sdate: + bdate = "%s" % cgi.escape(sdate) + else: + bdate = "" + elif birth: + bdate = cgi.escape(get_date(birth)) + else: + bdate = "" + return bdate + + def death(self, person): + """ + return "" or the death date of the person + """ + death = get_death_or_fallback(self.dbstate.db, person) + if death and death.get_type() != EventType.DEATH: + sdate = get_date(death) + if sdate: + ddate = "%s" % cgi.escape(sdate) + else: + ddate = "" + elif death: + ddate = cgi.escape(get_date(death)) + else: + ddate = "" + return ddate + def define_actions(self): """ Define action for the reference person button. diff --git a/gramps/plugins/view/geoplaces.py b/gramps/plugins/view/geoplaces.py index 90dc94bc2..bffd3f7e1 100644 --- a/gramps/plugins/view/geoplaces.py +++ b/gramps/plugins/view/geoplaces.py @@ -263,17 +263,18 @@ class GeoPlaces(GeoGraphyView): place = dbstate.db.get_place_from_handle(place_handle) self._create_one_place(place) else: - if place_x is None: - try: - places_handle = dbstate.db.get_place_handles() - except: - return - for place_hdl in places_handle: - place = dbstate.db.get_place_from_handle(place_hdl) - self._create_one_place(place) - else: - place = dbstate.db.get_place_from_handle(place_x) + try: + places_handle = dbstate.db.get_place_handles() + except: + return + for place_hdl in places_handle: + place = dbstate.db.get_place_from_handle(place_hdl) self._create_one_place(place) + if place_x: + place = dbstate.db.get_place_from_handle(place_x) + self.osm.set_center_and_zoom(float(place.get_latitude()), + float(place.get_longitude()), + int(config.get("geography.zoom"))) _LOG.debug(" stop createmap.") _LOG.debug("%s" % time.strftime("begin sort : " "%a %d %b %Y %H:%M:%S", time.gmtime()))