""" 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, appdata, boatdata, boatvalue1, boatvalue2, boatvalue3, boatvalue4, boatvalue5, boatvalue6): 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) self.ref5 = self.bd.getRef(boatvalue5) self.ref6 = self.bd.getRef(boatvalue6) def draw(self, ctx): # Seitenunterteilung ctx.rectangle(0, 105, 400, 3) ctx.rectangle(0, 195, 400, 3) ctx.rectangle(200, 22, 3, 256) ctx.fill() # Titel ctx.select_font_face("Ubuntu", cairo.FontSlant.NORMAL, cairo.FontWeight.BOLD) ctx.set_font_size(24) ctx.move_to(20, 40) ctx.show_text(self.ref1.valname) ctx.move_to(220, 40) ctx.show_text(self.ref2.valname) ctx.move_to(20, 130) ctx.show_text(self.ref3.valname) ctx.move_to(220, 130) ctx.show_text(self.ref4.valname) ctx.move_to(20, 220) ctx.show_text(self.ref5.valname) ctx.move_to(220, 220) ctx.show_text(self.ref6.valname) ctx.stroke() # Units ctx.set_font_size(16) ctx.move_to(20, 60) ctx.show_text(self.ref1.unit) ctx.move_to(220, 60) ctx.show_text(self.ref2.unit) ctx.move_to(20, 150) ctx.show_text(self.ref3.unit) ctx.move_to(220, 150) ctx.show_text(self.ref4.unit) ctx.move_to(20, 240) ctx.show_text(self.ref5.unit) ctx.move_to(220, 240) ctx.show_text(self.ref6.unit) ctx.stroke() # Meßwerte ctx.select_font_face("DSEG7 Classic") ctx.set_font_size(40) ctx.move_to(80, 90) ctx.show_text(self.ref1.format()) ctx.move_to(280, 90) ctx.show_text(self.ref2.format()) ctx.move_to(80, 180) ctx.show_text(self.ref3.format()) ctx.move_to(280, 180) ctx.show_text(self.ref4.format()) ctx.move_to(80, 270) ctx.show_text(self.ref5.format()) ctx.move_to(280, 270) ctx.show_text(self.ref6.format()) ctx.stroke()