def OnGpsUpload(self, event=None): """ Uploads caches to GPS """ self.pushStatus(_("Uploading caches to GPS")) opts = ExportOptions(self, True) if opts.ShowModal() == wx.ID_OK: opts.SaveConf() caches = self.selectCaches(True) if len(caches) == 0: wx.MessageBox( parent=self, message=_("With the current settings there is nothing to export!"), caption=_("Nothing to export"), style=wx.OK | wx.ICON_ERROR, ) else: fd, tmpFile = tempfile.mkstemp() gpx = Gpx() if gpx.export(tmpFile, caches): gpsCom = GpsCom(gps=geocacher.config().gpsType, port=geocacher.config().gpsConnection) ok, message = gpsCom.gpxToGps(tmpFile) if not ok: self.GpsError(message) os.remove(tmpFile) self.popStatus()
def OnGpsUpload(self, event=None): ''' Uploads caches to GPS ''' self.pushStatus(_('Uploading caches to GPS')) opts = ExportOptions(self, True) if opts.ShowModal() == wx.ID_OK: opts.SaveConf() caches = self.selectCaches(True) if len(caches) == 0: wx.MessageBox( parent=self, message=_( 'With the current settings there is nothing to export!' ), caption=_('Nothing to export'), style=wx.OK | wx.ICON_ERROR) else: fd, tmpFile = tempfile.mkstemp() gpx = Gpx() if gpx.export( tmpFile, caches, ): gpsCom = GpsCom(gps=geocacher.config().gpsType, port=geocacher.config().gpsConnection) ok, message = gpsCom.gpxToGps(tmpFile) if not ok: self.GpsError(message) os.remove(tmpFile) self.popStatus()
def OnGpsLocation(self, event=None): """ Handles the event from the "Location from GPS" menu item. Keyword Argument event: The event causing this function to be called. """ self.pushStatus(_("Loading new location form GPS")) gpsCom = GpsCom(gps=geocacher.config().gpsType, port=geocacher.config().gpsConnection) ok, lat, lon, message = gpsCom.getCurrentPos() if ok: self.NewLocation(lat, lon, _("the GPS"), _("GPS Point")) else: self.GpsError(message) self.popStatus()
def OnGpsLocation(self, event=None): ''' Handles the event from the "Location from GPS" menu item. Keyword Argument event: The event causing this function to be called. ''' self.pushStatus(_('Loading new location form GPS')) gpsCom = GpsCom(gps=geocacher.config().gpsType, port=geocacher.config().gpsConnection) ok, lat, lon, message = gpsCom.getCurrentPos() if ok: self.NewLocation(lat, lon, _('the GPS'), _('GPS Point')) else: self.GpsError(message) self.popStatus()