def _add_unselected_channels(self, channels, source_ref): ProgressSpinner.increment_refcount() 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)) try: self.datastore.get_channel_data(source_ref, ['Interval', 'Distance'] + channels, get_results) except Exception as e: Logger.warn('Non existant channel selected, not loading channels {}; {}'.format(channels, e)) finally: ProgressSpinner.decrement_refcount()
def add_channels(self, channels, source_ref): ProgressSpinner.increment_refcount() def get_results(results): #clone the incoming list of channels and pass it to the handler Clock.schedule_once( lambda dt: self._add_channels_results(channels[:], results)) self.datastore.get_channel_data(source_ref, ['Distance'] + channels, get_results)
def _add_unselected_channels(self, channels, source_ref): ProgressSpinner.increment_refcount() 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)) try: self.datastore.get_channel_data( source_ref, ['Interval', 'Distance'] + channels, get_results) except Exception as e: alertPopup( 'Could not load lap', "There was a problem loading the lap due to missing data:\r\n\r\n{}" .format(e)) raise # allow CrashHandler to record the issue finally: ProgressSpinner.decrement_refcount()
def add_channels(self, channels, source_ref): ProgressSpinner.increment_refcount() def get_results(results): #clone the incoming list of channels and pass it to the handler Clock.schedule_once(lambda dt: self._add_channels_results(channels[:], results)) self.datastore.get_channel_data(source_ref, ['Distance'] + channels, get_results)