From 9ff09e3385ee585b166102bc71cc575642779c21 Mon Sep 17 00:00:00 2001 From: JarbasAI <33701864+JarbasAl@users.noreply.github.com> Date: Sat, 16 Nov 2024 18:21:40 +0000 Subject: [PATCH] fix: only register resting_screen if GUI (#20) avoid showing the skill as a selectable homescreen option if GUI isnt enabled for skill --- __init__.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/__init__.py b/__init__.py index d5237ad..440bfb2 100644 --- a/__init__.py +++ b/__init__.py @@ -8,7 +8,6 @@ from ovos_date_parser import nice_duration from ovos_utils.time import to_local, now_local from ovos_workshop.decorators import intent_handler -from ovos_workshop.decorators import resting_screen_handler from ovos_workshop.intents import IntentBuilder from ovos_workshop.skills import OVOSSkill from skyfield.api import Topos, load @@ -45,6 +44,13 @@ def __init__(self, *args, **kwargs): if "dpi" not in self.settings: self.settings["dpi"] = 500 + def initialize(self): + if self.use_gui: + # equivalent to using the resting_screen_handler decorator + # but we only do it if GUI is enabled + self.idle.resting_handler = "ISS Location" + self.register_resting_screen() + @property def use_gui(self) -> bool: return GUI and self.settings["enable_gui"] @@ -100,7 +106,6 @@ def update_picture(self, toponym, lat, lon, astronauts): except Exception as e: self.log.exception(e) - @resting_screen_handler("ISS") def idle(self, message): toponym, lat, lon, astronauts = self.get_iss_data() self.update_picture(toponym, lat, lon, astronauts) # values available in self.gui