OBP60v/pages/sixvalues.py

76 lines
1.9 KiB
Python

"""
Sechs frei wählbare Meßwerte
Layout
+--------------------+--------------------+
| 1 | 2 |
+--------------------+--------------------+
| 3 | 4 |
+--------------------+--------------------+
| 5 | 6 |
+--------------------+--------------------+
"""
import cairo
from .page import Page
class SixValues(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
self.value5 = boatvalue5
self.value6 = boatvalue6
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()
#
ctx.select_font_face("Ubuntu", cairo.FontSlant.NORMAL, cairo.FontWeight.BOLD)
ctx.set_font_size(32)
ctx.move_to(20, 45)
ctx.show_text("AWA")
ctx.move_to(20, 113)
ctx.show_text("AWS")
ctx.move_to(20, 181)
ctx.show_text("COG")
ctx.move_to(20, 249)
ctx.show_text("STW")
ctx.stroke()
# Units
ctx.set_font_size(16)
ctx.move_to(20, 65)
ctx.show_text("Deg")
ctx.move_to(20, 133)
ctx.show_text("kn")
ctx.move_to(20, 201)
ctx.show_text("Deg")
ctx.move_to(20, 269)
ctx.show_text("kn")
ctx.stroke()
# Meßwerte
ctx.select_font_face("DSEG7 Classic")
ctx.set_font_size(40)
ctx.move_to(180, 65)
ctx.show_text("150")
ctx.move_to(180, 133)
ctx.show_text("25.3")
ctx.move_to(180, 201)
ctx.show_text("146")
ctx.move_to(180, 269)
ctx.show_text("56.4")