Add an existing place to a map

svn: r13896
This commit is contained in:
Gary Burton 2009-12-23 18:20:44 +00:00
parent 61e3237d5a
commit 2de02b5899

View File

@ -67,6 +67,7 @@ from BasicUtils import name_displayer as _nd
from PlaceUtils import conv_lat_lon from PlaceUtils import conv_lat_lon
from gui.views.pageview import PageView from gui.views.pageview import PageView
from gui.editors import EditPlace from gui.editors import EditPlace
from gui.selectors.selectplace import SelectPlace
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -322,9 +323,10 @@ class GeoView(HtmlView):
self.without_coord_file = os.path.join(GEOVIEW_SUBPATH, self.without_coord_file = os.path.join(GEOVIEW_SUBPATH,
"without_coord.html") "without_coord.html")
self.endinit = False self.endinit = False
self.signal_map = {'place-add': self._place_added} self.signal_map = {'place-add': self._place_changed,
'place-update' : self._place_changed}
def _place_added(self, handle_list): def _place_changed(self, handle_list):
self.displaytype = "places" self.displaytype = "places"
self._set_lock_unlock(True) self._set_lock_unlock(True)
self._geo_places() self._geo_places()
@ -717,6 +719,7 @@ class GeoView(HtmlView):
<toolitem action="Google"/> <toolitem action="Google"/>
<toolitem action="SaveZoom"/> <toolitem action="SaveZoom"/>
<toolitem action="AddPlace"/> <toolitem action="AddPlace"/>
<toolitem action="LinkPlace"/>
<toolitem action="StyleSheet"/> <toolitem action="StyleSheet"/>
<separator/> <separator/>
<toolitem action="PersonMaps"/> <toolitem action="PersonMaps"/>
@ -748,6 +751,11 @@ class GeoView(HtmlView):
callback=self._add_place, callback=self._add_place,
tip=_("Add the location centred on the map as a new place in " tip=_("Add the location centred on the map as a new place in "
"Gramps. Double click the location to centre on the map.")) "Gramps. Double click the location to centre on the map."))
self._add_action('LinkPlace', 'gramps-place',
_('_Link Place'),
callback=self._link_place,
tip=_("Link the location centred on the map to a place in "
"Gramps. Double click the location to centre on the map."))
self.lock_action = gtk.ActionGroup(self.title + "/SaveZoom") self.lock_action = gtk.ActionGroup(self.title + "/SaveZoom")
self.lock_action.add_toggle_actions([ self.lock_action.add_toggle_actions([
('SaveZoom', 'gramps-lock', _("_SaveZoom"), "<ALT>L", ('SaveZoom', 'gramps-lock', _("_SaveZoom"), "<ALT>L",
@ -1921,3 +1929,18 @@ class GeoView(HtmlView):
EditPlace(self.dbstate, self.uistate, [], new_place) EditPlace(self.dbstate, self.uistate, [], new_place)
except Errors.WindowActiveError: except Errors.WindowActiveError:
pass pass
def _link_place(self,url):
"""
Link an existing place using longitude and latitude of location centred
on the map
"""
selector = SelectPlace(self.dbstate, self.uistate, [])
place = selector.run()
if place:
place.set_latitude(self.reallatitude)
place.set_longitude(self.reallongitude)
try:
EditPlace(self.dbstate, self.uistate, [], place)
except Errors.WindowActiveError:
pass