Geography : add motion events to show places in the status bar.

svn: r17590
This commit is contained in:
Serge Noiraud 2011-05-27 15:58:19 +00:00
parent 7a86fc841b
commit 13f1654b3f

View File

@ -180,6 +180,7 @@ class osmGpsMap():
self.osm.connect('button_release_event', self.map_clicked) self.osm.connect('button_release_event', self.map_clicked)
self.osm.connect('changed', self.zoom_changed) self.osm.connect('changed', self.zoom_changed)
self.osm.connect("motion-notify-event", self.motion_event)
self.osm.show() self.osm.show()
self.vbox.pack_start(self.osm) self.vbox.pack_start(self.osm)
if obj is not None: if obj is not None:
@ -200,6 +201,14 @@ class osmGpsMap():
config.set("geography.zoom",self.osm.props.zoom) config.set("geography.zoom",self.osm.props.zoom)
self.save_center(self.osm.props.latitude, self.osm.props.longitude) self.save_center(self.osm.props.latitude, self.osm.props.longitude)
def motion_event(self, osmmap, event):
"""
Show the place name if found on the status bar
"""
current = osmgpsmap.point_new_degrees(0.0,0.0)
osmmap.convert_screen_to_geographic(int(event.x), int(event.y), current)
lat, lon = current.get_degrees()
def save_center(self, lat, lon): def save_center(self, lat, lon):
""" """
Save the longitude and lontitude in case we switch between maps. Save the longitude and lontitude in case we switch between maps.