commit 43b2e356020c438aaccb93856c89d0fadd9a8dc7 Author: Rudis Muiznieks Date: Mon Oct 31 15:48:05 2022 -0500 initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..8958124 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +*.pyc +settings.json + diff --git a/__init__.py b/__init__.py new file mode 100644 index 0000000..1d140da --- /dev/null +++ b/__init__.py @@ -0,0 +1,53 @@ +import re +import sys +from os.path import dirname +from adapt.intent import IntentBuilder +from mycroft import MycroftSkill, intent_handler + +class MeetingModeSkill(MycroftSkill): + """ + Skill to show or hide a DO NOT DISTURB message + """ + + def __init__(self): + super().__init__("MeetingModeSkill") + self.html_resources = "file://" + dirname(__file__) + '/res/' + + def initialize(self): + self.gui.register_handler('MeetingModeSkill.doNotDisturb', + self.handle_do_not_disturb_intent) + self.gui.register_handler('MeetingModeSkill.cancelDoNotDisturb', + self.handle_cancel_do_not_disturb_intent) + + @intent_handler(IntentBuilder('handle_do_not_disturb_intent').require('do-not-disturb')) + def handle_do_not_disturb_intent(self, message): + self.gui.clear() + self.enclosure.display_manager.remove_active() + html = """ + + + +DO NOT DISTURB + + +   + + +""" + self.gui.show_html(html, resource_url=self.html_resources, override_idle=True) + + @intent_handler(IntentBuilder('handle_cancel_do_not_disturb_intent').require('cancel-do-not-disturb')) + def handle_cancel_do_not_disturb_intent(self, message): + self.gui.clear() + + def stop(self): + pass + + +def create_skill(): + return MeetingModeSkill() diff --git a/res/do-not-disturb.png b/res/do-not-disturb.png new file mode 100644 index 0000000..a399cf3 Binary files /dev/null and b/res/do-not-disturb.png differ diff --git a/vocab/en-us/cancel-do-not-disturb.voc b/vocab/en-us/cancel-do-not-disturb.voc new file mode 100644 index 0000000..7e898ae --- /dev/null +++ b/vocab/en-us/cancel-do-not-disturb.voc @@ -0,0 +1,2 @@ +cancel do not disturb +cancel meeting mode diff --git a/vocab/en-us/do-not-disturb.voc b/vocab/en-us/do-not-disturb.voc new file mode 100644 index 0000000..93fac43 --- /dev/null +++ b/vocab/en-us/do-not-disturb.voc @@ -0,0 +1,2 @@ +do not disturb +meeting mode