""" Ankerinfo / -alarm """ import os import cairo import math from .page import Page class Anchor(Page): def __init__(self, pageno, cfg, boatdata): super().__init__(pageno, cfg, boatdata) self.sym_anchor = cairo.ImageSurface.create_from_png(os.path.join(cfg['imgpath'], "anchor.png")) self.buttonlabel[1] = 'DEC' self.buttonlabel[2] = 'INC' self.buttonlabel[5] = 'SET' def draw(self, ctx): # Name ctx.select_font_face("Ubuntu", cairo.FontSlant.NORMAL, cairo.FontWeight.BOLD) ctx.set_font_size(20) ctx.move_to(2, 50) ctx.show_text("Anchor") ctx.move_to(320, 50) ctx.show_text("Chain") ctx.set_font_size(16) ctx.move_to(2, 70) ctx.show_text("Alarm: off") ctx.move_to(320, 70) ctx.show_text("45 m") ctx.stroke() # Spezialseite cx = 200 cy = 150 r = 125 ctx.set_line_width(1.5) ctx.arc(cx, cy, r, 0, 2*math.pi) ctx.stroke() ctx.save() ctx.set_source_surface(self.sym_anchor, cx-8, cy-8) ctx.paint() ctx.restore()