73 lines
1.9 KiB
Python
73 lines
1.9 KiB
Python
"""
|
|
|
|
Vier frei wählbare Meßwerte
|
|
|
|
Layout
|
|
+--------------------+
|
|
| 1 |
|
|
+--------------------+
|
|
| 2 |
|
|
+--------------------+
|
|
| 3 |
|
|
+--------------------+
|
|
| 4 |
|
|
+--------------------+
|
|
|
|
"""
|
|
|
|
import cairo
|
|
from .page import Page
|
|
|
|
class FourValues(Page):
|
|
|
|
def __init__(self, pageno, cfg, appdata, boatdata, boatvalue1, boatvalue2, boatvalue3, boatvalue4):
|
|
super().__init__(pageno, cfg, appdata, boatdata)
|
|
self.ref1 = self.bd.getRef(boatvalue1)
|
|
self.ref2 = self.bd.getRef(boatvalue2)
|
|
self.ref3 = self.bd.getRef(boatvalue3)
|
|
self.ref4 = self.bd.getRef(boatvalue4)
|
|
|
|
def draw(self, ctx):
|
|
# Seitenunterteilung
|
|
ctx.rectangle(0, 80, 400, 3)
|
|
ctx.rectangle(0, 146, 400, 3)
|
|
ctx.rectangle(0, 214, 400, 3)
|
|
ctx.fill()
|
|
|
|
# Titel
|
|
ctx.select_font_face("Ubuntu", cairo.FontSlant.NORMAL, cairo.FontWeight.BOLD)
|
|
ctx.set_font_size(32)
|
|
ctx.move_to(20, 45)
|
|
ctx.show_text(self.ref1.valname)
|
|
ctx.move_to(20, 113)
|
|
ctx.show_text(self.ref2.valname)
|
|
ctx.move_to(20, 181)
|
|
ctx.show_text(self.ref3.valname)
|
|
ctx.move_to(20, 249)
|
|
ctx.show_text(self.ref4.valname)
|
|
|
|
# Units
|
|
ctx.set_font_size(16)
|
|
ctx.move_to(20, 65)
|
|
ctx.show_text(self.ref1.unit)
|
|
ctx.move_to(20, 133)
|
|
ctx.show_text(self.ref2.unit)
|
|
ctx.move_to(20, 201)
|
|
ctx.show_text(self.ref3.unit)
|
|
ctx.move_to(20, 269)
|
|
ctx.show_text(self.ref4.unit)
|
|
|
|
# Meßwerte
|
|
ctx.select_font_face("DSEG7 Classic")
|
|
ctx.set_font_size(40)
|
|
|
|
ctx.move_to(180, 65)
|
|
ctx.show_text(self.ref1.format())
|
|
ctx.move_to(180, 133)
|
|
ctx.show_text(self.ref2.format())
|
|
ctx.move_to(180, 201)
|
|
ctx.show_text(self.ref3.format())
|
|
ctx.move_to(180, 269)
|
|
ctx.show_text(self.ref4.format())
|
|
ctx.stroke()
|