OBP60v/pages/tracker.py

37 lines
862 B
Python

"""
Tracker with MQTT client
- currentry only Ragatta hero supported
TODO get data from mqtt thread
"""
import cairo
from .page import Page
class Tracker(Page):
def __init__(self, pageno, cfg, boatdata):
super().__init__(pageno, cfg, boatdata)
self.buttonlabel[1] = 'MODE'
def handle_key(self, buttonid):
global tracker_active;
if buttonid == 1:
tracker_active = not tracker_active
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.show_text("Tracker")
ctx.set_font_size(16)
ctx.move_to(20, 140)
ctx.show_text("active: ")
if tracker_active:
ctx.show_text("yes")
else:
ctx.show_text("no")