Seitenstil an aktuelles OBP60 angenähert

This commit is contained in:
Thomas Hooge 2025-07-03 15:20:23 +02:00
parent 5c2f058888
commit 8b5168a83e
2 changed files with 39 additions and 24 deletions

BIN
images/swipe3.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 165 B

View File

@ -48,6 +48,7 @@ class Page():
def __init__(self, pageno, cfg, boatdata):
self.pageno = pageno
self.cfg = cfg
self.fullscreen = cfg['guistyle'] == 'fullscreen'
self.bd = boatdata
self.header = True
self.footer = True
@ -59,7 +60,7 @@ class Page():
self.icon['NEXT'] = cairo.ImageSurface.create_from_png(os.path.join(cfg['imgpath'], "arrow_r1.png"))
self.icon['ILUM'] = cairo.ImageSurface.create_from_png(os.path.join(cfg['imgpath'], "lighton.png"))
self.sym_lock = cairo.ImageSurface.create_from_png(os.path.join(cfg['imgpath'], "lock.png"))
self.sym_swipe = cairo.ImageSurface.create_from_png(os.path.join(cfg['imgpath'], "swipe.png"))
self.sym_swipe = cairo.ImageSurface.create_from_png(os.path.join(cfg['imgpath'], "swipe3.png"))
self.buttonlabel = {
1: '',
2: '',
@ -81,12 +82,23 @@ class Page():
Wie ausschalten bei Seitenwechsel?
"""
ctx.save()
ctx.set_line_width(1)
ctx.set_source_rgb(0, 0, 0)
ctx.rectangle(201.5, 0.5, 23, 19)
if self.hbled:
ctx.fill_preserve()
ctx.stroke()
if self.hbled:
ctx.set_source_rgb(0, 0, 0)
else:
ctx.set_source_rgb(0.86, 0.86, 0.86) # 0xdcdcdc
ctx.arc(210, 9, 6, 0, math.pi*2)
ctx.fill()
else:
ctx.set_source_rgb(0, 0, 0)
pno = str(self.pageno)
ext = ctx.text_extents(pno)
ctx.move_to(211 - ext.width / 2.0, 9 + ext.height / 2.0)
ctx.show_text(pno)
ctx.stroke()
ctx.restore()
self.hbled = not self.hbled
@ -109,22 +121,12 @@ class Page():
ctx.show_text(f"N2K GPS")
ctx.stroke()
# Seitennummer neue Darstellung
ctx.set_line_width(1)
ctx.move_to(170.5, 1.5)
ctx.line_to(190.5, 1.5)
ctx.line_to(190.5, 16.5)
ctx.line_to(170.5, 16.5)
ctx.line_to(170.5, 1.5)
ctx.stroke()
self.draw_text_center(ctx, 180, 9.5, str(self.pageno))
# Tastenstatus
ctx.save()
if self.keylock:
ctx.set_source_surface(self.sym_lock, 150, 1)
ctx.set_source_surface(self.sym_lock, 170, 1)
else:
ctx.set_source_surface(self.sym_swipe, 150, 1)
ctx.set_source_surface(self.sym_swipe, 166, 1)
ctx.paint()
ctx.restore()
@ -140,11 +142,24 @@ class Page():
"""
Nur Belegung der Buttons (label[1] bis label[6])
"""
ctx.select_font_face("AtariST8x16SystemFont")
#ctx.select_font_face("Ubuntu", cairo.FontSlant.NORMAL, cairo.FontWeight.BOLD)
ctx.set_font_size(16)
x = (35, 101, 167, 233, 299, 365)
y = 294
ctx.set_line_width(1)
ctx.move_to(0, 280.5)
ctx.line_to(10, 280.5)
ctx.move_to(380, 280.5)
ctx.line_to(400, 280.5)
for i in range(5):
ctx.move_to(x[i]+32.5-10, 280.5)
ctx.line_to(x[i]+32.5+10, 280.5)
ctx.move_to(x[i]+32.5, 280)
ctx.line_to(x[i]+32.5, 300)
ctx.stroke()
# Fullscreen-Buttons
bx = 400
by = (128, 192, 256, 320, 384, 448)
@ -162,14 +177,14 @@ class Page():
ctx.paint()
ctx.restore()
else:
text = "[ {} ]".format(self.buttonlabel[i+1])
text = self.buttonlabel[i+1]
w = ctx.text_extents(text).width
ctx.move_to(x[i] - w/2, y)
ctx.move_to(x[i] - w/2, y+2)
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])
if self.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):