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:])
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:])
def go_back(*ignore): """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): MapView.set_zoom_level(zoom) MapView.center_on(lat, lon) if len(history) > 1: Gst.set_history(history) else: Gst.reset('history')