Fix after refactor
This commit is contained in:
parent
f5a347ddb5
commit
8459129b49
1 changed files with 32 additions and 30 deletions
|
@ -39,6 +39,8 @@ class ISO7000():
|
|||
(VehicleStatus.ENGINE_FAULT, 'mil', '#fa0'),
|
||||
(VehicleStatus.OIL_LOW, 'oil', '#fa0'),
|
||||
(VehicleStatus.OIL_OVERHEAT, 'oil', '#f00'),
|
||||
(VehicleStatus.PARKING_BRAKE_ON, 'parking', '#fa0'),
|
||||
(VehicleStatus.PARKING_BRAKE_FAULT, 'parking', '#f00'),
|
||||
(VehicleStatus.STABILITY_OFF, 'stability', '#fa0'),
|
||||
(VehicleStatus.TPMS_WARNING, 'tpms', '#f00'),
|
||||
(VehicleStatus.TRACTION_OFF, 'traction', '#fa0'),
|
||||
|
@ -67,14 +69,14 @@ class ISO7000():
|
|||
style = 'rect,path,circle{stroke:%(s)s;fill:%(s)s}' % {'s': icon.color}
|
||||
path = ISO7000._locate(icon.name)
|
||||
|
||||
self.icons[icon.name] = render_to_image(path, width, height, style)
|
||||
self.icons[icon.status.value] = render_to_image(path, width, height, style)
|
||||
|
||||
def __del__(self):
|
||||
for name in self.icons:
|
||||
self.icons[name].finish()
|
||||
for status_value in self.icons:
|
||||
self.icons[status_value].finish()
|
||||
|
||||
def draw(self, cr: cairo.Context, name: str, x: float, y: float):
|
||||
icon = self.icons[name]
|
||||
def draw(self, cr: cairo.Context, status: VehicleStatus, x: float, y: float):
|
||||
icon = self.icons[status.value]
|
||||
|
||||
cr.set_source_surface(icon, 0, 0)
|
||||
cr.rectangle(x, y, self.width, self.height)
|
||||
|
|
Loading…
Add table
Reference in a new issue