Beispiel #1
0
        def get_results(results):
            # Auto-switch to time mode in charts only if the user
            # did not request it.
            if (self.line_chart_mode == LineChartMode.DISTANCE
                    and not self._results_has_distance(results)):
                if self._user_refresh_requested == True:
                    toast(
                        "Warning: one or more selected laps have missing distance data",
                        length_long=True)
                    self._user_refresh_requested = False
                else:
                    self.line_chart_mode = LineChartMode.TIME
                    self._refresh_chart_mode_toggle()

            # clone the incoming list of channels and pass it to the handler
            if self.line_chart_mode == LineChartMode.TIME:
                Clock.schedule_once(lambda dt: self._add_channels_results_time(
                    channels[:], results))
            elif self.line_chart_mode == LineChartMode.DISTANCE:
                Clock.schedule_once(
                    lambda dt: self._add_channels_results_distance(
                        channels[:], results))
            else:
                Logger.error('LineChart: Unknown line chart mode ' +
                             str(self.line_chart_mode))
Beispiel #2
0
 def on_set_logfile_level_error(self, detail):
     '''
     Callback for error condition of setting the logfile
     :param detail the description of the error
     :type detail string
     '''
     toast('Error Setting Logfile Level:\n\n{}'.format(detail), length_long=True)
Beispiel #3
0
 def _refresh_chart_mode_toggle(self):
     if self.line_chart_mode == LineChartMode.DISTANCE:
         self.chart_mode_toggle_button.text = u'\uf178'
         toast('Distance')
     else:
         self.chart_mode_toggle_button.text = u'\uf017'
         toast('Time')
Beispiel #4
0
 def on_run_script_complete(self, result):
     '''
     Callback when the script has been restarted successfully
     :param result the result of the API call
     :type result dict
     '''
     toast('Script restarted')
 def _refresh_chart_mode_toggle(self):
     if self.line_chart_mode == LineChartMode.DISTANCE:
         self.chart_mode_toggle_button.text = u'\uf178'
         toast('Distance')
     else:
         self.chart_mode_toggle_button.text = u'\uf017'
         toast('Time')
 def on_run_script_error(self, detail):
     """
     Callback when the script fails to restart
     :param detail the description of the error
     :type detail string
     """
     toast("Error Running Script:\n\n{}".format(str(detail)), length_long=True)
Beispiel #7
0
 def on_run_script_error(self, detail):
     '''
     Callback when the script fails to restart
     :param detail the description of the error
     :type detail string
     '''
     toast('Error Running Script:\n\n{}'.format(str(detail)), length_long=True)
 def on_run_script_complete(self, result):
     """
     Callback when the script has been restarted successfully
     :param result the result of the API call
     :type result dict
     """
     toast("Script restarted")
 def on_set_logfile_level_error(self, detail):
     """
     Callback for error condition of setting the logfile
     :param detail the description of the error
     :type detail string
     """
     toast("Error Setting Logfile Level:\n\n{}".format(detail), length_long=True)
Beispiel #10
0
    def _add_new_action(self, *args):
        def popup_dismissed(instance, result):
            if result:
                selected = instance.content.selected_item
                if selected is not None:
                    alertaction = selected.key
                    self.alertrule.alert_actions.append(alertaction)
                    self.dispatch('on_edit_action', alertaction)
                    self.refresh_view()
            popup.dismiss()

        alertaction_prototypes = get_alertaction_default_collection(
            exclude_filter=self.alertrule.alert_actions)

        items = [
            ItemSelectionRef(title=alertaction.title,
                             image_source=alertaction.PREVIEW_IMAGE,
                             key=alertaction)
            for alertaction in alertaction_prototypes
        ]

        if len(items) == 0:
            toast('No more actions available')
        else:
            view = ItemSelectorView(item_references=items)
            popup = editor_popup('Select Action',
                                 view,
                                 popup_dismissed,
                                 size_hint=(None, None),
                                 size=(min(Window.width, dp(700)),
                                       min(Window.height, dp(400))),
                                 auto_dismiss_time=10)
Beispiel #11
0
 def _on_gps_source(self, instance, source):
     msg = None
     if source == GeoProvider.GPS_SOURCE_RACECAPTURE:
         msg = "GPS Source: RaceCapture"
     elif source == GeoProvider.GPS_SOURCE_INTERNAL:
         msg = "GPS source: this device"
     if msg is not None:
         toast(msg, length_long=True)
Beispiel #12
0
 def on_update_target(self, *args):
     try:
         if self._get_gps_quality() >= GpsConfig.GPS_QUALITY_2D:
             self._refresh_view(self._gps_sample.latitude, self._gps_sample.longitude)
         else:
             toast('No GPS Fix', True)
     except Exception:
         toast('Error reading GPS target')
 def _on_gps_source(self, instance, source):
     msg = None
     if source == GeoProvider.GPS_SOURCE_RACECAPTURE:
         msg = "GPS Source: RaceCapture"
     elif source == GeoProvider.GPS_SOURCE_INTERNAL:
         msg = "GPS source: this device"
     if msg is not None:
         toast(msg, length_long=True)
 def on_update_target(self, *args):
     try:
         if self._get_gps_quality() >= GpsConfig.GPS_QUALITY_2D:
             channel_data = self.databus.channel_data
             self._refresh_view(channel_data.get('Latitude'), channel_data.get('Longitude'))
         else:
             toast('No GPS Fix', True)
     except Exception:
         toast('Error reading GPS target')
 def on_paste_point(self, *args):
     try:
         point_string = Clipboard.get('UTF8_STRING')
         lat_lon = point_string.split(",")
         lat = float(lat_lon[0])
         lon = float(lat_lon[1])
         self.ids.lat.text = str(lat)
         self.ids.lon.text = str(lon)
     except Exception:
         toast('Required format is: Latitude, Longitude\nin NN.NNNNN decimal format', True)
 def on_update_target(self, *args):
     try:
         if self._get_gps_quality() >= GpsConfig.GPS_QUALITY_2D:
             channel_data = self.databus.channel_data
             self._refresh_view(channel_data.get('Latitude'),
                                channel_data.get('Longitude'))
         else:
             toast('No GPS Fix', True)
     except Exception:
         toast('Error reading GPS target')
Beispiel #17
0
 def copy_app_log(self):
     try:
         recent_log = ''
         for record in reversed(LoggerHistory.history):
             recent_log += record.msg + '\r\n'
         paste_clipboard(recent_log)
         toast('Application log copied to clipboard')
     except Exception as e:
         Logger.error("ApplicationLogView: Error copying app log to clipboard: " + str(e))
         toast('Unable to copy to clipboard\n' + str(e), True)
 def close(self):
     Clock.unschedule(self.update_gps_status)              
     point = self.point
     try:
         point.latitude = float(self.ids.lat.text)
         point.longitude = float(self.ids.lon.text)
         self.dispatch('on_point_edited', self.point)
     except Exception:
         toast('NN.NNNNN decimal latitude/longitude format required', True)
     self.dispatch('on_close')
 def close(self):
     Clock.unschedule(self.update_gps_status)
     point = self.point
     try:
         point.latitude = float(self.ids.lat.text)
         point.longitude = float(self.ids.lon.text)
         self.dispatch('on_point_edited', self.point)
     except Exception:
         toast('NN.NNNNN decimal latitude/longitude format required', True)
     self.dispatch('on_close')
Beispiel #20
0
 def on_paste_point(self, *args):
     try:
         point_string = Clipboard.get('UTF8_STRING')
         lat_lon = point_string.split(",")
         lat = float(lat_lon[0])
         lon = float(lat_lon[1])
         self.ids.lat.text = str(lat)
         self.ids.lon.text = str(lon)
     except ValueError as e:
         Logger.error("GeoPointEditor: error handling paste: {}".format(e))
         toast('Required format is: Latitude, Longitude\nin NN.NNNNN decimal format', True)
 def close(self):
     Clock.unschedule(self.update_gps_status)
     point = self.point
     try:
         point.latitude = float(self.ids.lat.text)
         point.longitude = float(self.ids.lon.text)
         self.dispatch('on_point_edited', self.point)
     except ValueError as e:
         Logger.error("GeoPointEditor: error closing: {}".format(e))
         toast('NN.NNNNN decimal latitude/longitude format required', True)
     self.dispatch('on_close')
 def close(self):
     Clock.unschedule(self.update_gps_status)
     point = self.point
     try:
         point.latitude = float(self.ids.lat.text)
         point.longitude = float(self.ids.lon.text)
         self.dispatch('on_point_edited', self.point)
     except ValueError as e:
         Logger.error("GeoPointEditor: error closing: {}".format(e))
         toast('NN.NNNNN decimal latitude/longitude format required', True)
     self.dispatch('on_close')
 def copy_log(self):
     """
     Copies the current logfile text to the system clipboard
     """
     try:
         paste_clipboard(self.ids.logfile.text)
         toast("RaceCapture log copied to clipboard")
     except Exception as e:
         Logger.error("ApplicationLogView: Error copying RaceCapture log to clipboard: " + str(e))
         toast("Unable to copy to clipboard\n" + str(e), True)
         # Allow crash handler to report on exception
         raise e
Beispiel #24
0
 def copy_app_log(self):
     try:
         recent_log = ''
         for record in reversed(LoggerHistory.history):
             recent_log += record.msg + '\r\n'
         paste_clipboard(recent_log)
         toast('Application log copied to clipboard')
     except Exception as e:
         Logger.error(
             "ApplicationLogView: Error copying app log to clipboard: " +
             str(e))
         toast('Unable to copy to clipboard\n' + str(e), True)
 def on_paste_point(self, *args):
     try:
         point_string = Clipboard.get('UTF8_STRING')
         lat_lon = point_string.split(",")
         lat = float(lat_lon[0])
         lon = float(lat_lon[1])
         self.ids.lat.text = str(lat)
         self.ids.lon.text = str(lon)
     except Exception:
         toast(
             'Required format is: Latitude, Longitude\nin NN.NNNNN decimal format',
             True)
Beispiel #26
0
 def copy_log(self):
     '''
     Copies the current logfile text to the system clipboard
     '''
     try:
         paste_clipboard(self.ids.logfile.text)
         toast('RaceCapture log copied to clipboard')
     except Exception as e:
         Logger.error("ApplicationLogView: Error copying RaceCapture log to clipboard: " + str(e))
         toast('Unable to copy to clipboard\n' + str(e), True)
         # Allow crash handler to report on exception
         raise e
Beispiel #27
0
 def on_track_select_close(instance, answer):
     if answer:
         selected_track = content.selected_track
         if selected_track is None:
             toast('Please select a track')
             return
         if self._track_cfg:
             Logger.info("SingleAutoConfigScreen: setting track: {}".format(selected_track.name))
             track_cfg = Track.fromTrackMap(selected_track)
             self._track_cfg.track = track_cfg
             self._track_cfg.stale = True
             self._update_track()
             self.dispatch('on_modified')
     popup.dismiss()
        def get_results(results):
            # Auto-switch to time mode in charts only if the user
            # did not request it.
            if (
                    self.line_chart_mode == LineChartMode.DISTANCE and
                    not self._results_has_distance(results)
                ):
                    if self._user_refresh_requested == True:
                        toast("Warning: one or more selected laps have missing distance data", length_long=True)
                        self._user_refresh_requested = False
                    else:
                        self.line_chart_mode = LineChartMode.TIME
                        self._refresh_chart_mode_toggle()

            # clone the incoming list of channels and pass it to the handler
            if self.line_chart_mode == LineChartMode.TIME:
                Clock.schedule_once(lambda dt: self._add_channels_results_time(channels[:], results))
            elif self.line_chart_mode == LineChartMode.DISTANCE:
                Clock.schedule_once(lambda dt: self._add_channels_results_distance(channels[:], results))
            else:
                Logger.error('LineChart: Unknown line chart mode ' + str(self.line_chart_mode))
Beispiel #29
0
 def on_update_target(self, *args):
     try:
         if self._get_gps_quality() >= GpsConfig.GPS_QUALITY_2D:
             point = self.point
             point.latitude = self.gps_sample.latitude
             point.longitude = self.gps_sample.longitude
             self._refresh_point_view()
             self.dispatch('on_config_changed')
             toast('Target updated')
         else:
             toast('No GPS Fix', True)
     except Exception as e:
         toast('Error reading GPS target')
 def on_update_target(self, *args):
     try:
         if self._get_gps_quality() >= GpsConfig.GPS_QUALITY_2D:
             channel_data = self.databus.channel_data
             point = self.point
             point.latitude = channel_data.get("Latitude")
             point.longitude = channel_data.get("Longitude")
             self._refresh_point_view()
             self.dispatch("on_config_changed")
             toast("Target updated")
         else:
             toast("No GPS Fix", True)
     except Exception as e:
         toast("Error reading GPS target")
 def _on_internal_gps_available(self, instance, available):
     if not available:
         toast("Could not activate internal GPS on this device", length_long=True)
 def delete_session(self, list_item):
     self.datastore.delete_session(list_item.session.session_id)
     self.ids.session_list.remove_widget(list_item)
     self.dispatch('on_delete', list_item.session)
     toast("Session deleted", center_on=self)
 def add_session(self, list_item):
     self.dispatch('on_add', list_item.session)
     toast("Session loaded", center_on=self)
Beispiel #34
0
 def _on_session_recording(self, instance, is_recording):
     toast('Session recording started' if is_recording else 'Session recording stopped', length_long=True)
 def add_session(self, list_item):
     self.dispatch('on_add', list_item.session)
     toast("Session loaded", center_on=self)
Beispiel #36
0
 def _on_internal_gps_available(self, instance, available):
     if not available:
         toast("Could not activate internal GPS on this device",
               length_long=True)
Beispiel #37
0
 def _on_session_recording(self, instance, is_recording):
     toast('Session recording started'
           if is_recording else 'Session recording stopped',
           length_long=True)
Beispiel #38
0
 def on_read_config_error(self, detail):
     self.showActivity("Error reading configuration")
     toast("Error reading configuration. Check your connection", length_long=True)
     Logger.error("RaceCaptureApp:Error reading configuration: {}".format(str(detail)))
 def delete_session(self, list_item):
     self.datastore.delete_session(list_item.session.session_id)
     self.ids.session_list.remove_widget(list_item)
     self.dispatch('on_delete', list_item.session)
     toast("Session deleted", center_on=self)
Beispiel #40
0
 def on_read_config_error(self, detail):
     self.showActivity("Error reading configuration")
     toast("Error reading configuration. Check your connection", length_long=True)
     Logger.error("RaceCaptureApp:Error reading configuration: {}".format(str(detail)))