def _refresh_lap_legends(self): """ Wholesale refresh the list of lap legends """ self.ids.legend_list.clear_widgets() height_pct = 0.4 for source_ref in self.sources.itervalues(): source_key = str(source_ref) # specify the heatmap color if multiple laps are selected, else use the default # multi-color heatmap for a single lap selection heatmap_channel = self.heatmap_channel source_key = str(source_ref) if heatmap_channel: session_info = self.datastore.get_session_by_id(source_ref.session) channel_info = self.datastore.get_channel(heatmap_channel) self.heatmap_channel_units = channel_info.units lap_legend = GradientLapLegend(session=session_info.name, lap=str(source_ref.lap), min_value=channel_info.min, max_value=channel_info.max, color=None, height_pct=height_pct ) else: session_info = self.datastore.get_session_by_id(source_ref.session) lap = self.datastore.get_cached_lap_info(source_ref) path_color = self.ids.track.get_path(source_key).color lap_legend = LapLegend(color=path_color, session=session_info.name, lap=str(source_ref.lap), lap_time=format_laptime(lap.lap_time)) self.ids.legend_list.add_widget(lap_legend) height_pct *= 0.6
def _refresh_lap_legends(self): """ Wholesale refresh the list of lap legends """ self.ids.legend_list.clear_widgets() height_pct = 0.4 for source_ref in self.sources.itervalues(): source_key = str(source_ref) # specify the heatmap color if multiple laps are selected, else use the default # multi-color heatmap for a single lap selection heatmap_channel = self.heatmap_channel source_key = str(source_ref) if heatmap_channel: session_info = self.datastore.get_session_by_id( source_ref.session) channel_info = self.datastore.get_channel(heatmap_channel) self.heatmap_channel_units = channel_info.units lap_legend = GradientLapLegend(session=session_info.name, lap=str(source_ref.lap), min_value=channel_info.min, max_value=channel_info.max, color=None, height_pct=height_pct) else: session_info = self.datastore.get_session_by_id( source_ref.session) lap = self.datastore.get_cached_lap_info(source_ref) path_color = self.ids.track.get_path(source_key).color lap_legend = LapLegend(color=path_color, session=session_info.name, lap=str(source_ref.lap), lap_time=format_laptime(lap.lap_time)) self.ids.legend_list.add_widget(lap_legend) height_pct *= 0.6
def on_value(self, instance, value): view = self.valueView if view: if value == '': view.text = '' else: view.text = format_laptime(value)
def append_lap(self, session, lap, laptime): text = '{} :: {}'.format(int(lap), format_laptime(laptime)) lapitem = LapItemButton(session=session, text=text, lap=lap, laptime=laptime) self.ids.lap_list.add_widget(lapitem) return lapitem
def format_value(mode, value): ''' Format the value based on the specified mode :param mode the LineChartMode value :type enum :param value the value to format :type float ''' # Label marker that follows marker position if mode == LineChartMode.TIME: return format_laptime(value * LineChartMode.MS_TO_MINUTES) elif mode == LineChartMode.DISTANCE: return '{:.2f}'.format(value) else: return '---'
def _format_stopwatch_time(self): ''' Format current laptime for display ''' return format_laptime(self._current_time / 60.0)
def on_value(self, instance, value): view = self.valueView if view: view.text = format_laptime(value) self.update_colors()