Tracker NONE implementiert und kleine Verbesserungen
This commit is contained in:
@@ -29,15 +29,19 @@ class RaceTracker(Page):
|
||||
|
||||
def __init__(self, pageno, cfg, appdata, boatdata):
|
||||
super().__init__(pageno, cfg, appdata, boatdata)
|
||||
self.ttype = self.app.track.ttype
|
||||
self.bv_lat = boatdata.getRef("LAT")
|
||||
self.bv_lon = boatdata.getRef("LON")
|
||||
self.bv_sog = boatdata.getRef("SOG")
|
||||
self.races = None
|
||||
self.raceid = self.app.track.hero_raceid # Ausgewählte Regatta
|
||||
if self.ttype == 'HERO':
|
||||
self.raceid = self.app.track.hero_raceid # Ausgewählte Regatta
|
||||
self.buttonlabel[1] = 'MODE'
|
||||
self.buttonlabel[2] = 'INFO'
|
||||
self.buttonlabel[5] = 'ABORT'
|
||||
else:
|
||||
self.raceid = None
|
||||
self.menupos = 0
|
||||
self.buttonlabel[1] = 'MODE'
|
||||
self.buttonlabel[2] = 'INFO'
|
||||
self.buttonlabel[5] = 'ABORT'
|
||||
self.mode = 'N' # (N)ormal, (C)onfiguration, (M)itteilung
|
||||
self.query_active = False
|
||||
self.savebuttons = None
|
||||
@@ -76,6 +80,8 @@ class RaceTracker(Page):
|
||||
self.sym_flag[f] = cairo.ImageSurface.create_from_png(flagfile)
|
||||
|
||||
def handle_key(self, buttonid):
|
||||
if self.ttype == 'NONE':
|
||||
return False
|
||||
if self.query_active:
|
||||
if buttonid == 2:
|
||||
self.query_active = False
|
||||
@@ -158,6 +164,38 @@ class RaceTracker(Page):
|
||||
return True
|
||||
return False
|
||||
|
||||
def draw_none(self, ctx):
|
||||
"""
|
||||
TODO Funktion schreiben, die einen längeren Text mit
|
||||
Absätzen auf dem Bildschirma ausgibt.
|
||||
"""
|
||||
x = 8
|
||||
y = 50
|
||||
ctx.select_font_face("Ubuntu", cairo.FontSlant.NORMAL, cairo.FontWeight.BOLD)
|
||||
ctx.set_font_size(24)
|
||||
ctx.move_to(x, y)
|
||||
ctx.show_text("Tracker")
|
||||
|
||||
y += 25
|
||||
ctx.set_font_size(16)
|
||||
ctx.move_to(x, y)
|
||||
ctx.show_text("Disabled by 'NONE in configuration'.")
|
||||
y += 40
|
||||
ctx.move_to(x, y)
|
||||
ctx.show_text("Currently only tracker type 'HERO' is")
|
||||
y += 20
|
||||
ctx.move_to(x, y)
|
||||
ctx.show_text("implemented. Please visit the Regatta")
|
||||
y += 20
|
||||
ctx.move_to(x, y)
|
||||
ctx.show_text("Hero web page for detailed description.")
|
||||
y += 40
|
||||
ctx.move_to(x, y)
|
||||
ctx.show_text("Additionally you should contact your local")
|
||||
y += 20
|
||||
ctx.move_to(x, y)
|
||||
ctx.show_text("race officer to get configuration data.")
|
||||
|
||||
def draw_normal(self, ctx):
|
||||
|
||||
ctx.select_font_face("DSEG7 Classic")
|
||||
@@ -241,9 +279,6 @@ class RaceTracker(Page):
|
||||
ctx.paint()
|
||||
ctx.restore()
|
||||
pos += 1
|
||||
if self.query_active:
|
||||
self.draw_query(ctx, "A B O R T R A C E", "Are you sure to abort the current race? This cannot be undone. Are you sure?")
|
||||
|
||||
|
||||
def draw_config(self, ctx):
|
||||
|
||||
@@ -399,8 +434,13 @@ class RaceTracker(Page):
|
||||
|
||||
def draw(self, ctx):
|
||||
if self.mode == 'N':
|
||||
self.draw_normal(ctx)
|
||||
if self.ttype == 'NONE':
|
||||
self.draw_none(ctx)
|
||||
else:
|
||||
self.draw_normal(ctx)
|
||||
elif self.mode == 'C':
|
||||
self.draw_config(ctx)
|
||||
else:
|
||||
self.draw_info(ctx)
|
||||
if self.query_active:
|
||||
self.draw_query(ctx, "A B O R T R A C E", "Are you sure to abort the current race? This cannot be undone. Are you sure?")
|
||||
|
||||
Reference in New Issue
Block a user