""" 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, 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, 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(self.ref1.valname) ctx.move_to(20, 145) ctx.show_text(self.ref2.valname) ctx.set_font_size(24) ctx.move_to(20, 220) ctx.show_text(self.ref3.valname) ctx.move_to(220, 220) ctx.show_text(self.ref4.valname) # Einheiten ctx.set_font_size(16) ctx.move_to(20, 90) ctx.show_text(self.ref1.unit) ctx.move_to(20, 180) ctx.show_text(self.ref2.unit) ctx.set_font_size(16) ctx.move_to(20, 240) ctx.show_text(self.ref3.unit) ctx.move_to(220, 240) ctx.show_text(self.ref4.unit) # Meßwerte ctx.select_font_face("DSEG7 Classic") ctx.set_font_size(60) ctx.move_to(180, 90) ctx.show_text(self.ref1.format()) ctx.move_to(180, 180) ctx.show_text(self.ref2.format()) ctx.set_font_size(40) ctx.move_to(80, 270) ctx.show_text(self.ref3.format()) ctx.move_to(280, 270) ctx.show_text(self.ref4.format()) ctx.stroke()