Skip to content

Commit

Permalink
fix: only register resting_screen if GUI
Browse files Browse the repository at this point in the history
avoid showing the skill as a selectable homescreen option if GUI isnt enabled for skill
  • Loading branch information
JarbasAl committed Nov 16, 2024
1 parent d936d82 commit 103505c
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"]
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 103505c

Please sign in to comment.