Skip to content

Commit

Permalink
restore mycroft.ready
Browse files Browse the repository at this point in the history
refactor in follow up PR
  • Loading branch information
JarbasAl committed Feb 8, 2024
1 parent 4546bee commit 3578f6c
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions ovos_gui/homescreen.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ def __init__(self, bus: MessageBusClient, gui: NamespaceManager):
self.bus = bus
self.gui = gui
self.homescreens: List[dict] = []
self.mycroft_ready = False
# TODO: If service starts after `mycroft_ready`,
# homescreen is never shown
self.bus.on('homescreen.manager.add', self.add_homescreen)
self.bus.on('homescreen.manager.remove', self.remove_homescreen)
self.bus.on('homescreen.manager.list', self.get_homescreens)
Expand Down Expand Up @@ -127,6 +130,9 @@ def show_homescreen_on_add(self, homescreen_id: str):
Check if a homescreen should be displayed immediately upon addition
@param homescreen_id: ID of added homescreen
"""
if not self.mycroft_ready:
LOG.debug("Not ready yet, don't display homescreen")
return
LOG.debug(f"Checking {homescreen_id}")
if self.get_active_homescreen() != homescreen_id:
# Added homescreen isn't the configured one, do nothing
Expand Down Expand Up @@ -175,4 +181,5 @@ def set_mycroft_ready(self, message: Message):
Handle `mycroft.ready` and show the homescreen
@param message: `mycroft.ready` Message
"""
self.mycroft_ready = True
self.show_homescreen()

0 comments on commit 3578f6c

Please sign in to comment.