OBP60v/pages/fourvalues2.py

78 lines
1.8 KiB
Python

"""
Vier frei auswählbare Meßwerte
Layout
+--------------------+
| 1 |
+--------------------+
| 2 |
+--------------------+
| 3 | 4 |
+--------------------+
"""
import cairo
from .page import Page
class FourValues2(Page):
def __init__(self, pageno, cfg, boatdata, boatvalue1, boatvalue2, boatvalue3, boatvalue4):
super().__init__(pageno, cfg, boatdata)
self.value1 = boatvalue1
self.value2 = boatvalue2
self.value3 = boatvalue3
self.value4 = boatvalue4
def draw(self, ctx):
# Seitenunterteilung
ctx.rectangle(0, 105, 400, 3)
ctx.rectangle(0, 195, 400, 3)
ctx.rectangle(200, 195, 3, 75)
ctx.fill()
ctx.select_font_face("Ubuntu", cairo.FontSlant.NORMAL, cairo.FontWeight.BOLD)
# Titel
ctx.set_font_size(40)
ctx.move_to(20, 55)
ctx.show_text("AWA")
ctx.move_to(20, 145)
ctx.show_text("AWS")
ctx.set_font_size(24)
ctx.move_to(20, 220)
ctx.show_text("COG")
ctx.move_to(220, 220)
ctx.show_text("STW")
# Einheiten
ctx.set_font_size(16)
ctx.move_to(20, 90)
ctx.show_text("Deg")
ctx.move_to(20, 180)
ctx.show_text("kn")
ctx.set_font_size(16)
ctx.move_to(20, 240)
ctx.show_text("Deg")
ctx.move_to(220, 240)
ctx.show_text("kn")
# Meßwerte
ctx.select_font_face("DSEG7 Classic")
ctx.set_font_size(60)
ctx.move_to(180, 90)
ctx.show_text("150")
ctx.move_to(180, 180)
ctx.show_text("33.0")
ctx.set_font_size(40)
ctx.move_to(80, 270)
ctx.show_text("146")
ctx.move_to(280, 270)
ctx.show_text("50.5")
ctx.stroke()