Vollbildmodus eingebaut

This commit is contained in:
2025-06-21 19:45:08 +02:00
parent 81836bc5f1
commit ea82d5731e
8 changed files with 316 additions and 49 deletions

View File

@@ -9,7 +9,11 @@ class ApparentWind(Page):
super().__init__(pageno, cfg, boatdata)
self.buttonlabel[1] = 'MODE'
self.mode = 'L' # (W)ind (L)ens
self.symbol = cairo.ImageSurface.create_from_png(os.path.join(cfg['imgpath'], "front.png"))
try:
self.symbol = cairo.ImageSurface.create_from_png(os.path.join(cfg['imgpath'], "front.png"))
except:
self.symbol = None
print("Warning: Missing image: {}".format(os.path.join(cfg['imgpath'], "front.png")))
def handle_key(self, buttonid):
if buttonid == 1:
@@ -27,10 +31,11 @@ class ApparentWind(Page):
ctx.show_text("Apparent Wind")
def draw_lens(self, ctx):
ctx.save()
ctx.set_source_surface(self.symbol, 140, 30)
ctx.paint()
ctx.restore()
if self.symbol:
ctx.save()
ctx.set_source_surface(self.symbol, 140, 30)
ctx.paint()
ctx.restore()
ctx.set_line_width(2)

View File

@@ -145,6 +145,11 @@ class Page():
ctx.set_font_size(16)
x = (35, 101, 167, 233, 299, 365)
y = 294
# Fullscreen-Buttons
bx = 400
by = (128, 192, 256, 320, 384, 448)
bw = 160
bh = 64
for i in range(6):
if len(self.buttonlabel[i+1]) > 0 :
if self.buttonlabel[i+1][0] == "#":
@@ -153,12 +158,18 @@ class Page():
key = self.buttonlabel[i+1][1:]
ctx.set_source_surface(self.icon[key], x[i]-8, y-13)
ctx.paint()
ctx.set_source_surface(self.icon[key], bx + bw / 3.2 - 8, by[i] / 1.6 - 6)
ctx.paint()
ctx.restore()
else:
text = "[ {} ]".format(self.buttonlabel[i+1])
w = ctx.text_extents(text).width
ctx.move_to(x[i] - w/2, y)
ctx.show_text(text)
# Fullscreen
w = ctx.text_extents(self.buttonlabel[i+1]).width
ctx.move_to(bx + bw/3.2 - w/2, by[i] / 1.6 + 8)
ctx.show_text(self.buttonlabel[i+1])
ctx.stroke()
def clear(self):