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:
parent
b1c6d82003
commit
97e0ce0d4c
@ -397,6 +397,13 @@ class GeoGraphyView(OsmGps, NavigationView):
|
|||||||
found = True
|
found = True
|
||||||
if found:
|
if found:
|
||||||
self.bubble_message(event, lat, lon, mark_selected)
|
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)
|
self.uistate.set_busy_cursor(False)
|
||||||
|
|
||||||
def bubble_message(self, event, lat, lon, mark):
|
def bubble_message(self, event, lat, lon, mark):
|
||||||
|
@ -320,7 +320,7 @@ class OsmGps():
|
|||||||
self.end_selection = current
|
self.end_selection = current
|
||||||
self.zone_selection = False
|
self.zone_selection = False
|
||||||
elif event.button == 3 and event.type == Gdk.EventType.BUTTON_PRESS:
|
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:
|
else:
|
||||||
self.save_center(lat, lon)
|
self.save_center(lat, lon)
|
||||||
|
|
||||||
|
@ -34,6 +34,7 @@ from gramps.gen.ggettext import gettext as _
|
|||||||
import operator
|
import operator
|
||||||
from gi.repository import Gtk
|
from gi.repository import Gtk
|
||||||
from math import *
|
from math import *
|
||||||
|
import cgi
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@ -50,7 +51,7 @@ _LOG = logging.getLogger("GeoGraphy.geoclose")
|
|||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
from gramps.gen.lib import EventRoleType, EventType
|
from gramps.gen.lib import EventRoleType, EventType
|
||||||
from gramps.gen.config import config
|
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.display.name import displayer as _nd
|
||||||
from gramps.gen.utils.place import conv_lat_lon
|
from gramps.gen.utils.place import conv_lat_lon
|
||||||
from gramps.gui.views.navigationview import NavigationView
|
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 import constants
|
||||||
from gramps.plugins.lib.maps.geography import GeoGraphyView
|
from gramps.plugins.lib.maps.geography import GeoGraphyView
|
||||||
from gramps.gui.selectors import SelectorFactory
|
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)
|
self._createmap(p1, color, self.place_list_active, False)
|
||||||
if self.refperson:
|
if self.refperson:
|
||||||
color = self._config.get('geography.color1')
|
color = self._config.get('geography.color1')
|
||||||
self.message_layer.add_message(_("Reference : %s" % _nd.display(self.refperson)))
|
self.message_layer.add_message(_("Reference : %s ( %s - %s )" % ( _nd.display(self.refperson),
|
||||||
self.message_layer.add_message(_("The other : %s" % _nd.display(p1)))
|
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)
|
self._createmap(self.refperson, color, self.place_list_ref, True)
|
||||||
else:
|
else:
|
||||||
self.message_layer.add_message(_("You must choose one reference person."))
|
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.possible_meeting(self.place_list_ref, self.place_list_active)
|
||||||
self.uistate.modify_statusbar(self.dbstate)
|
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):
|
def define_actions(self):
|
||||||
"""
|
"""
|
||||||
Define action for the reference person button.
|
Define action for the reference person button.
|
||||||
|
@ -263,17 +263,18 @@ class GeoPlaces(GeoGraphyView):
|
|||||||
place = dbstate.db.get_place_from_handle(place_handle)
|
place = dbstate.db.get_place_from_handle(place_handle)
|
||||||
self._create_one_place(place)
|
self._create_one_place(place)
|
||||||
else:
|
else:
|
||||||
if place_x is None:
|
try:
|
||||||
try:
|
places_handle = dbstate.db.get_place_handles()
|
||||||
places_handle = dbstate.db.get_place_handles()
|
except:
|
||||||
except:
|
return
|
||||||
return
|
for place_hdl in places_handle:
|
||||||
for place_hdl in places_handle:
|
place = dbstate.db.get_place_from_handle(place_hdl)
|
||||||
place = dbstate.db.get_place_from_handle(place_hdl)
|
|
||||||
self._create_one_place(place)
|
|
||||||
else:
|
|
||||||
place = dbstate.db.get_place_from_handle(place_x)
|
|
||||||
self._create_one_place(place)
|
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(" stop createmap.")
|
||||||
_LOG.debug("%s" % time.strftime("begin sort : "
|
_LOG.debug("%s" % time.strftime("begin sort : "
|
||||||
"%a %d %b %Y %H:%M:%S", time.gmtime()))
|
"%a %d %b %Y %H:%M:%S", time.gmtime()))
|
||||||
|
Loading…
Reference in New Issue
Block a user