diff --git a/py/hexagram/dial.py b/py/hexagram/dial.py index 3f82e48..64b86f1 100644 --- a/py/hexagram/dial.py +++ b/py/hexagram/dial.py @@ -44,8 +44,8 @@ class Dial(Gauge): (self.max_angle - self.min_angle) * (adj / adj_max) \ - self.ANGLE_OFFSET - def draw_number(self, cr: cairo.Context, radius: float, value: float, text: str): angle = self.angle(value) + def draw_legend(self, cr: cairo.Context, radius: float, value: float, text: str): cr.move_to(self.x + radius * self.radius * math.cos(angle) - 20, self.y + radius * self.radius * math.sin(angle)) @@ -120,7 +120,7 @@ class BottomDial(Dial): def angle(self, value: float): return super().angle((self.max_value - value) + self.min_value) - def draw_value(self, cr: cairo.Context, radius: float, value: float, text: str, x_offset: float=0.0, y_offset: float=0.0): + def draw_legend(self, cr: cairo.Context, radius: float, value: float, text: str, x_offset: float=0.0, y_offset: float=0.0): angle = self.angle(value) cr.move_to(self.x + radius * self.radius * math.cos(angle) + x_offset, diff --git a/py/hexagram/fuel.py b/py/hexagram/fuel.py index 276a6cb..4cb6cfa 100644 --- a/py/hexagram/fuel.py +++ b/py/hexagram/fuel.py @@ -29,10 +29,10 @@ class FuelGauge(BottomDial): cr.set_font_size(self.radius * 0.1) cr.set_source_rgb(1, 0, 0) - self.draw_value(cr, 0.75, 0, "0", -5, 5) + self.draw_legend(cr, 0.75, 0, "0", -5, 5) cr.set_source_rgb(1, 1, 1) - self.draw_value(cr, 0.75, 15, "1", -10, 5) + self.draw_legend(cr, 0.75, 15, "1", -10, 5) cr.set_line_width(6.0) diff --git a/py/hexagram/speedo.py b/py/hexagram/speedo.py index abe03fd..78c2609 100644 --- a/py/hexagram/speedo.py +++ b/py/hexagram/speedo.py @@ -40,7 +40,7 @@ class Speedo(Dial): self.draw_mark(cr, min_radius, 0.87, speed) for speed in range(0, int(self.max_value)+1, 20): - self.draw_number(cr, 0.68, speed, "%d" % int(speed)) + self.draw_legend(cr, 0.68, speed, "%d" % int(speed)) def _draw_text(self, cr: cairo.Context, x: float, y: float, text: str, size: float): cr.select_font_face("Muli", diff --git a/py/hexagram/tacho.py b/py/hexagram/tacho.py index 6772f1c..b1df76c 100644 --- a/py/hexagram/tacho.py +++ b/py/hexagram/tacho.py @@ -22,7 +22,7 @@ class Tacho(Dial): self.gear: Gear = Gear.N self.shift_mode: ShiftMode = ShiftMode.NORMAL - def draw_number(self, cr: cairo.Context, radius: float, value: float, text: str): + def draw_legend(self, cr: cairo.Context, radius: float, value: float, text: str): scale = value / self.max_value angle = self.min_angle + ((self.max_angle - self.min_angle) * scale) - Dial.ANGLE_OFFSET @@ -57,7 +57,7 @@ class Tacho(Dial): if speed >= self.redline: cr.set_source_rgb(1.0, 0.1, 0.1) - self.draw_number(cr, 0.69, speed, "%d" % int(speed / 1000)) + self.draw_legend(cr, 0.69, speed, "%d" % int(speed / 1000)) def gear_text(self): text = '' diff --git a/py/hexagram/thermo.py b/py/hexagram/thermo.py index 10c32aa..45fe208 100644 --- a/py/hexagram/thermo.py +++ b/py/hexagram/thermo.py @@ -28,10 +28,10 @@ class Thermometer(BottomDial): cr.set_font_size(self.radius * 0.1) cr.set_source_rgb(1, 1, 1) - self.draw_value(cr, 0.78, self.min_value, "C") + self.draw_legend(cr, 0.78, self.min_value, "C") cr.set_source_rgb(1, 0, 0) - self.draw_value(cr, 0.75, self.max_value, "H", -15, 5) + self.draw_legend(cr, 0.75, self.max_value, "H", -15, 5) cr.set_line_width(6.0)