From 46295f8139ab7a66d58cf53bf955a2df8cf30db5 Mon Sep 17 00:00:00 2001 From: Thomas Hooge Date: Fri, 18 Jul 2025 15:26:40 +0200 Subject: [PATCH] Anker weiterprogrammiert --- pages/anchor.py | 34 ++++++++++++++++++++++++++++------ 1 file changed, 28 insertions(+), 6 deletions(-) diff --git a/pages/anchor.py b/pages/anchor.py index 5d9da59..d3d04e8 100644 --- a/pages/anchor.py +++ b/pages/anchor.py @@ -37,8 +37,8 @@ class Anchor(Page): super().__init__(pageno, cfg, boatdata) self.sym_anchor = cairo.ImageSurface.create_from_png(os.path.join(cfg['imgpath'], "anchor.png")) self.buttonlabel[1] = 'MODE' - self.buttonlabel[2] = 'SET' - self.buttonlabel[5] = 'ALARM' + self.buttonlabel[2] = 'DROP' + self.buttonlabel[5] = '' # ALARM erst möglich wenn der Anker unten ist self.mode = 'N' # (N)ormal, (C)onfiguration @@ -75,8 +75,14 @@ class Anchor(Page): self.anchor_lat = self._bd.lat self.anchor_lon = self._bd.lon self.anchor_set = True + self.buttonlabel[2] = 'RISE' + self.buttonlabel[5] = 'ALARM' else: self.anchor_set = False + self.alarm = False + self.alarm_enabled = False + self.buttonlabel[2] = 'SET' + self.buttonlabel[5] = '' if buttonid == 5: # Bei aktivem Alarm kann mit dieser Taste der Alarm zurückgesetzt # werden. Die Tastenbeschriftung wechselt zwischen ALARM und OFF. @@ -110,6 +116,8 @@ class Anchor(Page): ctx.move_to(2, 50) ctx.show_text("Anchor") + ctx.move_to(2, 200) + ctx.show_text("Depth") ctx.move_to(320, 50) ctx.show_text("Chain") @@ -122,6 +130,11 @@ class Anchor(Page): ctx.show_text("Off") ctx.move_to(320, 70) ctx.show_text(f"{self.chain} m") + + ctx.move_to(10, 220) + if self._bd.dbs.valid: + ctx.show_text(self._bd.dbs.format()) + ctx.stroke() # Spezialseite @@ -133,10 +146,19 @@ class Anchor(Page): 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() + # Ankersymbol falls Anker fallen gelassen wurde, ansonsten nur Kreis- + # mittelpunkt kennzeichnen + if self.anchor_set: + ctx.save() + ctx.set_source_surface(self.sym_anchor, cx-8, cy-8) + ctx.paint() + ctx.restore() + else: + ctx.move_to(cx-6, cy-6) + ctx.line_to(cx+6, cy+6) + ctx.move_to(cx+6, cy-6) + ctx.line_to(cx-6, cy+6) + ctx.stroke() # Boot zeichnen # Heading beachten