Anker weiterprogrammiert

This commit is contained in:
Thomas Hooge 2025-07-18 15:26:40 +02:00
parent f7337a0c6c
commit 46295f8139
1 changed files with 28 additions and 6 deletions

View File

@ -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()
# 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