Пример #1
0
def remember_location(view):
    """Add current location to history stack."""
    history = list(gst.get('history'))
    location = tuple([view.get_property(x) for x in
        ('latitude', 'longitude', 'zoom-level')])
    if history[-1] != location:
        history.append(location)
    gst.set_history(history[-30:])
Пример #2
0
def remember_location(view):
    """Add current location to history stack."""
    history = list(gst.get('history'))
    location = tuple(view.get_property(x) for x in
            ('latitude', 'longitude', 'zoom-level'))
    if history[-1] != location:
        history.append(location)
    gst.set_history(history[-30:])
Пример #3
0
def go_back(button, view):
    """Return the map view to where the user last set it."""
    history = list(gst.get('history'))
    lat, lon, zoom = history.pop()
    if valid_coords(lat, lon):
        view.set_zoom_level(zoom)
        view.center_on(lat, lon)
    if len(history) > 1:
        gst.set_history(history)
    else:
        gst.reset('history')
    map_view.emit('animation-completed')
Пример #4
0
def go_back(button, view):
    """Return the map view to where the user last set it."""
    history = list(gst.get('history'))
    lat, lon, zoom = history.pop()
    if valid_coords(lat, lon):
        view.set_zoom_level(zoom)
        view.center_on(lat, lon)
    if len(history) > 1:
        gst.set_history(history)
    else:
        gst.reset('history')
    map_view.emit('animation-completed')