Weiterarbeit am Tracker
This commit is contained in:
@@ -4,6 +4,10 @@ Tracker with MQTT client
|
||||
|
||||
TODO get data from mqtt thread
|
||||
|
||||
Verbindungsabbrüche
|
||||
- on_disconnect
|
||||
|
||||
|
||||
"""
|
||||
|
||||
import cairo
|
||||
@@ -14,27 +18,64 @@ class Tracker(Page):
|
||||
def __init__(self, pageno, cfg, appdata, boatdata):
|
||||
super().__init__(pageno, cfg, boatdata)
|
||||
self._appdata = appdata
|
||||
self.bv_lat = boatdata.getRef("LAT")
|
||||
self.bv_lon = boatdata.getRef("LON")
|
||||
self.bv_sog = boatdata.getRef("SOG")
|
||||
self.buttonlabel[1] = 'MODE'
|
||||
print(cfg)
|
||||
self.buttonlabel[2] = 'ON'
|
||||
|
||||
def handle_key(self, buttonid):
|
||||
if buttonid == 1:
|
||||
|
||||
pass
|
||||
elif buttonid == 2:
|
||||
# Tracking ein/-ausschalten
|
||||
if self._appdata.track.is_active():
|
||||
self._appdata.track.set_active(False)
|
||||
self.buttonlabel[2] = 'ON'
|
||||
else:
|
||||
self._appdata.track.set_active(True)
|
||||
self.buttonlabel[2] = 'OFF'
|
||||
|
||||
def draw(self, ctx):
|
||||
# Name
|
||||
ctx.select_font_face("Ubuntu", cairo.FontSlant.NORMAL, cairo.FontWeight.BOLD)
|
||||
ctx.set_font_size(32)
|
||||
ctx.move_to(20, 100)
|
||||
ctx.move_to(20, 80)
|
||||
ctx.show_text("Tracker")
|
||||
|
||||
ctx.set_font_size(16)
|
||||
ctx.move_to(20, 120)
|
||||
ctx.show_text("Type: ")
|
||||
ctx.show_text(self._appdata.track.ttype)
|
||||
|
||||
ctx.move_to(20, 140)
|
||||
ctx.show_text("active: ")
|
||||
if self._appdata.track.is_active():
|
||||
ctx.show_text("yes")
|
||||
else:
|
||||
ctx.show_text("no")
|
||||
|
||||
ctx.move_to(20, 160)
|
||||
ctx.show_text("Lat=")
|
||||
ctx.show_text(self.bv_lat.format())
|
||||
ctx.move_to(20, 180)
|
||||
ctx.show_text("Lon=")
|
||||
ctx.show_text(self.bv_lon.format())
|
||||
ctx.move_to(20, 200)
|
||||
ctx.show_text("Sog=")
|
||||
ctx.show_text(self.bv_sog.format())
|
||||
|
||||
# Mögliche Regatten
|
||||
x = 250
|
||||
y = 160
|
||||
ctx.move_to(x, y - 24)
|
||||
ctx.show_text("Regatten")
|
||||
for r in self._appdata.track.hero_get_races():
|
||||
ctx.move_to(x, y)
|
||||
ctx.show_text(r)
|
||||
y += 20
|
||||
if y == 160:
|
||||
ctx.move_to(x, y)
|
||||
ctx.show_text("keine")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user