Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix:no wait for ready #56

Merged
merged 3 commits into from
Oct 21, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 1 addition & 14 deletions ovos_gui/homescreen.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ def __init__(self, bus: MessageBusClient):
super().__init__()
self.bus = bus
self.homescreens: List[dict] = []
self.mycroft_ready = False

self.bus.on('homescreen.manager.add', self.add_homescreen)
self.bus.on('homescreen.manager.remove', self.remove_homescreen)
Expand All @@ -22,13 +21,13 @@ def __init__(self, bus: MessageBusClient):
self.bus.on("homescreen.manager.set_active", self.handle_set_active_homescreen)
self.bus.on("homescreen.manager.disable_active", self.disable_active_homescreen)
self.bus.on("homescreen.manager.show_active", self.show_homescreen)
self.bus.on("mycroft.ready", self.set_mycroft_ready)

def run(self):
"""
Start the Manager after it has been constructed.
"""
self.reload_homescreens_list()
self.show_homescreen()

def add_homescreen(self, message: Message):
"""
Expand Down Expand Up @@ -127,9 +126,6 @@ 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 @@ -172,12 +168,3 @@ def show_homescreen(self, message: Optional[Message] = None):
else:
LOG.warning(f"Requested {active_homescreen} not found in: "
f"{self.homescreens}")

def set_mycroft_ready(self, message: Message):
"""
Handle `mycroft.ready` and show the homescreen
@param message: `mycroft.ready` Message
"""
self.mycroft_ready = True
self.reload_homescreens_list()
self.show_homescreen()
6 changes: 0 additions & 6 deletions test/unittests/test_homescreen.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ class TestHomescreenManager(unittest.TestCase):

def test_00_homescreen_manager_init(self):
self.assertEqual(self.homescreen_manager.bus, self.bus)
self.assertFalse(self.homescreen_manager.mycroft_ready)
self.assertIsInstance(self.homescreen_manager.homescreens, list)
# TODO: Test messagebus handlers

Expand Down Expand Up @@ -71,8 +70,3 @@ def test_disable_active_homescreen(self, update_config, config):
def test_show_homescreen(self):
# TODO
pass

def test_set_mycroft_ready(self):
self.homescreen_manager.mycroft_ready = False
self.homescreen_manager.set_mycroft_ready(Message("mycroft.ready"))
self.assertTrue(self.homescreen_manager.mycroft_ready)
Loading