예제 #1
0
 def __init__(self):
     Clutter.Box.__init__(self)
     self.set_layout_manager(Clutter.BinLayout())
     self.set_color(Clutter.Color.new(0, 0, 0, 96))
     Gst.bind('show-map-coords', self, 'visible')
     MapView.bin_layout_add(self, START, START)
     self.get_layout_manager().add(CoordLabel, CENTER, CENTER)
     MapView.connect('notify::width',
         lambda *ignore: self.set_size(MapView.get_width(), 30))
예제 #2
0
def move_by_arrow_keys(accel_group, acceleratable, keyval, modifier):
    """Move the map view by 5% of its length in the given direction."""
    key = Gdk.keyval_name(keyval)
    factor = 0.45 if key in ('Up', 'Left') else 0.55
    if key in ('Up', 'Down'):
        lat = MapView.y_to_latitude(MapView.get_height() * factor)
        lon = MapView.get_center_longitude()
    else:
        lat = MapView.get_center_latitude()
        lon = MapView.x_to_longitude(MapView.get_width() * factor)
    if valid_coords(lat, lon):
        MapView.center_on(lat, lon)