Add ambient temperature
This commit is contained in:
parent
74103a1c32
commit
8ac463f6cf
1 changed files with 26 additions and 1 deletions
|
@ -100,6 +100,28 @@ class Odometer(Gauge):
|
|||
cr.move_to(self.x, self.y)
|
||||
cr.show_text("%d mi" % self.value)
|
||||
|
||||
class AmbientTemp(Gauge):
|
||||
__slots__ = 'x', 'y',
|
||||
|
||||
def __init__(self, x: float, y: float):
|
||||
self.value = 0
|
||||
self.x = x
|
||||
self.y = y
|
||||
|
||||
def draw_bg(self, cr: cairo.Context):
|
||||
pass
|
||||
|
||||
def draw_fg(self, cr: cairo.Context):
|
||||
cr.set_source_rgb(1, 1, 1)
|
||||
cr.select_font_face("Muli",
|
||||
cairo.FontSlant.NORMAL,
|
||||
cairo.FontWeight.BOLD)
|
||||
|
||||
cr.set_font_size(32)
|
||||
|
||||
cr.move_to(self.x, self.y)
|
||||
cr.show_text("%.1f°C" % self.value)
|
||||
|
||||
class Cluster():
|
||||
WIDTH = 1280
|
||||
HEIGHT = 480
|
||||
|
@ -107,7 +129,7 @@ class Cluster():
|
|||
SHIFT_INDICATOR_X = 392
|
||||
SHIFT_INDICATOR_Y = 24
|
||||
|
||||
__slots__ = 'gauges', 'speedo', 'fuel', 'tacho', 'thermo', 'odo',
|
||||
__slots__ = 'gauges', 'speedo', 'fuel', 'tacho', 'thermo', 'odo', 'ambient',
|
||||
|
||||
def __init__(self, rpm_min: float, rpm_redline: float, rpm_max: float):
|
||||
self.gauges: List[Gauge] = list()
|
||||
|
@ -132,11 +154,14 @@ class Cluster():
|
|||
|
||||
self.odo = Odometer(self.HEIGHT, self.HEIGHT - 32)
|
||||
|
||||
self.ambient = AmbientTemp(self.WIDTH - self.HEIGHT - 64, self.HEIGHT - 32)
|
||||
|
||||
self.gauges.append(self.speedo)
|
||||
self.gauges.append(self.fuel)
|
||||
self.gauges.append(self.tacho)
|
||||
self.gauges.append(self.thermo)
|
||||
self.gauges.append(self.odo)
|
||||
self.gauges.append(self.ambient)
|
||||
|
||||
self.gauges.append(ShiftIndicator(self.SHIFT_INDICATOR_X,
|
||||
self.SHIFT_INDICATOR_Y,
|
||||
|
|
Loading…
Add table
Reference in a new issue