Geography : added history to places view.

added birth and death date to the reference and other people in the messages of the close view.


svn: r20552
This commit is contained in:
Serge Noiraud 2012-10-12 21:50:45 +00:00
parent b1c6d82003
commit 97e0ce0d4c
4 changed files with 62 additions and 14 deletions

View File

@ -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):

View File

@ -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)

View File

@ -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 = "<i>%s</i>" % 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 = "<i>%s</i>" % 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.

View File

@ -263,7 +263,6 @@ 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:
@ -271,9 +270,11 @@ class GeoPlaces(GeoGraphyView):
for place_hdl in places_handle:
place = dbstate.db.get_place_from_handle(place_hdl)
self._create_one_place(place)
else:
if place_x:
place = dbstate.db.get_place_from_handle(place_x)
self._create_one_place(place)
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()))