""" 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, appdata, boatdata): super().__init__(pageno, cfg, boatdata) self._appdata = appdata self.buttonlabel[1] = 'MODE' print(cfg) def handle_key(self, buttonid): if buttonid == 1: if self._appdata.track.is_active(): self._appdata.track.set_active(False) else: self._appdata.track.set_active(True) 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 self._appdata.track.is_active(): ctx.show_text("yes") else: ctx.show_text("no")