コード例 #1
0
 def gps_not_found_message(self):
     """
     Shows a "GPS not found" status bar and popup error message.
     """
     mapview_screen = self.mapview_screen_property
     message = "GPS not found."
     # status bar error message
     mapview_screen.update_status_message(message)
     # popup error message
     popup = PopupMessage(title="Error", body=message)
     popup.open()
コード例 #2
0
ファイル: main.py プロジェクト: AndreMiras/GuyPS
 def gps_not_found_message(self):
     """
     Shows a "GPS not found" status bar and popup error message.
     """
     mapview_screen = self.mapview_screen_property
     message = "GPS not found."
     # status bar error message
     mapview_screen.update_status_message(message)
     # popup error message
     popup = PopupMessage(
                 title="Error",
                 body=message)
     popup.open()
コード例 #3
0
 def prepare_download_for_offline1(self, text):
     """
     Verifes location requested for download is valid,
     i.e. exists and is allowed (city only).
     """
     geolocator = Nominatim()
     location = geolocator.geocode(text)
     if location is None:
         popup = PopupMessage(title="Error", body="Can't find location.")
         popup.open()
         return
     location_type = location.raw['type']
     if location_type not in ['city', 'administrative']:
         popup = PopupMessage(title="Error",
                              body="Only cities are allowed.")
         popup.open()
         return
     # move to the downloading location
     mapview = self.mapview_property
     mapview.animated_center_on(location.latitude, location.longitude)
     # exctracts the city from the address string
     city = location.address.split(',')[0]
     # changes geopy bounding box format to landez one
     geopy_bbox = location.raw['boundingbox']
     filename = city + '.mbtiles'
     bbox = self.geopy_bbox_to_bbox(geopy_bbox)
     zoomlevels = range(OFFLINE_CITY_MIN_ZOOM, OFFLINE_CITY_MAX_ZOOM + 1)
     self.prepare_download_for_offline2(filename, bbox, zoomlevels)
コード例 #4
0
ファイル: main.py プロジェクト: AndreMiras/GuyPS
 def prepare_download_for_offline1(self, text):
     """
     Verifes location requested for download is valid,
     i.e. exists and is allowed (city only).
     """
     geolocator = Nominatim()
     location = geolocator.geocode(text)
     if location is None:
         popup = PopupMessage(
                     title="Error",
                     body="Can't find location.")
         popup.open()
         return
     location_type = location.raw['type']
     if location_type not in ['city', 'administrative']:
         popup = PopupMessage(
                     title="Error",
                     body="Only cities are allowed.")
         popup.open()
         return
     # move to the downloading location
     mapview = self.mapview_property
     mapview.animated_center_on(location.latitude, location.longitude)
     # exctracts the city from the address string
     city = location.address.split(',')[0]
     # changes geopy bounding box format to landez one
     geopy_bbox = location.raw['boundingbox']
     filename = city + '.mbtiles'
     bbox = self.geopy_bbox_to_bbox(geopy_bbox)
     zoomlevels = range(OFFLINE_CITY_MIN_ZOOM, OFFLINE_CITY_MAX_ZOOM+1)
     self.prepare_download_for_offline2(filename, bbox, zoomlevels)
コード例 #5
0
 def search(self, text):
     geolocator = Nominatim()
     try:
         location = geolocator.geocode(text)
     except GeocoderServiceError as e:
         popup = PopupMessage(title="Error", body=e.message)
         popup.open()
         return
     if location is None:
         popup = PopupMessage(title="Error", body="Can't find location.")
         popup.open()
         return
     latitude = location.latitude
     longitude = location.longitude
     # self.center_on(latitude, longitude)
     self.animated_center_on(latitude, longitude)
コード例 #6
0
ファイル: main.py プロジェクト: AndreMiras/GuyPS
 def search(self, text):
     geolocator = Nominatim()
     try:
         location = geolocator.geocode(text)
     except GeocoderServiceError as e:
         popup = PopupMessage(
                     title="Error",
                     body=e.message)
         popup.open()
         return
     if location is None:
         popup = PopupMessage(
                     title="Error",
                     body="Can't find location.")
         popup.open()
         return
     latitude = location.latitude
     longitude = location.longitude
     # self.center_on(latitude, longitude)
     self.animated_center_on(latitude, longitude)