def draw(self): """ Draws a line from values stored in buffer. """ if len(self.buffer) == 0: return if self.first_packet: self.y_offset = self.buffer[0][0] self.first_packet = False pos = self.x_offset, self.calc_y(self.buffer[0][0]) + self.y for i, (value, quality) in enumerate(self.buffer): y = self.calc_y(value) + self.y if self.old_model: color = str(get_quality_scale_level_color(quality, True)) else: color = str(get_quality_scale_level_color(quality, False)) pygame.draw.line(self.screen, color, pos, (self.x_offset + i, y)) pos = (self.x_offset + i, y) self.screen.blit(self.text, self.text_pos)
def draw(self): """ Draws a line from values stored in buffer. """ if len(self.buffer) == 0: return if self.first_packet: self.y_offset = self.buffer[0][0] self.first_packet = False pos = self.x_offset, self.calc_y(self.buffer[0][0]) + self.y for i, (value, quality) in enumerate(self.buffer): y = self.calc_y(value) + self.y if self.old_model: color = str(get_quality_scale_level_color(quality, True)) else: color = str(get_quality_scale_level_color(quality, False)) pygame.draw.line(self.screen, color, pos, (self.x_offset + i, y)) pos = (self.x_offset + i, y) self.screen.blit(self.text, self.text_pos)