Fix after refactor
This commit is contained in:
parent
f5a347ddb5
commit
8459129b49
1 changed files with 32 additions and 30 deletions
|
@ -20,31 +20,33 @@ class ISO7000():
|
|||
'/usr/share/hexagram/icons')
|
||||
|
||||
__icons__ = (
|
||||
(VehicleStatus.ABS_FAULT, 'abs', '#fa0'),
|
||||
(VehicleStatus.AIRBAG_FAULT, 'airbag', '#fa0'),
|
||||
(VehicleStatus.BATTERY_FAULT, 'beams-fog', '#f00'),
|
||||
(VehicleStatus.BEAMS_FOG, 'beams-fog', '#0f0'),
|
||||
(VehicleStatus.BEAMS_HIGH, 'beams-high', '#00f'),
|
||||
(VehicleStatus.BEAMS_LOW, 'beams-low', '#0f0'),
|
||||
(VehicleStatus.BEAMS_PARKING, 'beams-parking', '#ff0'),
|
||||
(VehicleStatus.BELT, 'belt', '#f00'),
|
||||
(VehicleStatus.CAUTION, 'caution', '#fa0'),
|
||||
(VehicleStatus.COLD, 'cold', '#eef'),
|
||||
(VehicleStatus.COLLISION, 'coolant', '#f00'),
|
||||
(VehicleStatus.COOLANT_LOW, 'coolant', '#fa0'),
|
||||
(VehicleStatus.COOLANT_OVERHEAT, 'coolant', '#f00'),
|
||||
(VehicleStatus.CRUISE, 'cruise', '#0f0'),
|
||||
(VehicleStatus.FUEL_LOW, 'fuel', '#fa0'),
|
||||
(VehicleStatus.LANEKEEP_OFF, 'lane-departure', '#fa0'),
|
||||
(VehicleStatus.ENGINE_FAULT, 'mil', '#fa0'),
|
||||
(VehicleStatus.OIL_LOW, 'oil', '#fa0'),
|
||||
(VehicleStatus.OIL_OVERHEAT, 'oil', '#f00'),
|
||||
(VehicleStatus.STABILITY_OFF, 'stability', '#fa0'),
|
||||
(VehicleStatus.TPMS_WARNING, 'tpms', '#f00'),
|
||||
(VehicleStatus.TRACTION_OFF, 'traction', '#fa0'),
|
||||
(VehicleStatus.TRACTION_FAULT, 'traction', '#f00'),
|
||||
(VehicleStatus.WARNING, 'warning', '#f00'),
|
||||
(VehicleStatus.WIPER_WASHER_LOW, 'wiper-washer', '#fa0'),
|
||||
(VehicleStatus.ABS_FAULT, 'abs', '#fa0'),
|
||||
(VehicleStatus.AIRBAG_FAULT, 'airbag', '#fa0'),
|
||||
(VehicleStatus.BATTERY_FAULT, 'beams-fog', '#f00'),
|
||||
(VehicleStatus.BEAMS_FOG, 'beams-fog', '#0f0'),
|
||||
(VehicleStatus.BEAMS_HIGH, 'beams-high', '#00f'),
|
||||
(VehicleStatus.BEAMS_LOW, 'beams-low', '#0f0'),
|
||||
(VehicleStatus.BEAMS_PARKING, 'beams-parking', '#ff0'),
|
||||
(VehicleStatus.BELT, 'belt', '#f00'),
|
||||
(VehicleStatus.CAUTION, 'caution', '#fa0'),
|
||||
(VehicleStatus.COLD, 'cold', '#eef'),
|
||||
(VehicleStatus.COLLISION, 'coolant', '#f00'),
|
||||
(VehicleStatus.COOLANT_LOW, 'coolant', '#fa0'),
|
||||
(VehicleStatus.COOLANT_OVERHEAT, 'coolant', '#f00'),
|
||||
(VehicleStatus.CRUISE, 'cruise', '#0f0'),
|
||||
(VehicleStatus.FUEL_LOW, 'fuel', '#fa0'),
|
||||
(VehicleStatus.LANEKEEP_OFF, 'lane-departure', '#fa0'),
|
||||
(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'),
|
||||
(VehicleStatus.TRACTION_FAULT, 'traction', '#f00'),
|
||||
(VehicleStatus.WARNING, 'warning', '#f00'),
|
||||
(VehicleStatus.WIPER_WASHER_LOW, 'wiper-washer', '#fa0'),
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
|
@ -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