Skip to content

Commit

Permalink
Merge pull request #57 from AIIX/feat/add_gui_release
Browse files Browse the repository at this point in the history
Add proper handler for gui release events
  • Loading branch information
krisgesling authored Feb 18, 2021
2 parents b0183a2 + 78b4169 commit 0d1e39d
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,9 @@ def initialize(self):

# Handle device settings events
self.add_event("mycroft.device.settings", self.handle_device_settings)

# Handle GUI release events
self.add_event("mycroft.gui.screen.close", self.handle_remove_namespace)

# Use Legacy for QuickSetting delegate
self.gui.register_handler(
Expand Down Expand Up @@ -244,7 +247,7 @@ def initialize(self):
self._sync_wake_beep_setting()

self.settings_change_callback = self.on_websettings_changed

###################################################################
# System events
def handle_system_reboot(self, _):
Expand All @@ -253,6 +256,14 @@ def handle_system_reboot(self, _):

def handle_system_shutdown(self, _):
subprocess.call(["/usr/bin/systemctl", "poweroff"])

def handle_remove_namespace(self, message):
get_skill_namespace = message.data.get("skill_id", "")
if get_skill_namespace:
self.bus.emit(Message("gui.clear.namespace",
{"__from": get_skill_namespace}))
self.resting_screen.cancel_override()
self.cancel_scheduled_event("IdleCheck")

###################################################################
# Idle screen mechanism
Expand Down

0 comments on commit 0d1e39d

Please sign in to comment.