initial commit

This commit is contained in:
Rudis Muiznieks 2022-10-31 15:48:05 -05:00
commit 43b2e35602
Signed by: rudism
GPG key ID: CABF2F86EF7884F9
5 changed files with 60 additions and 0 deletions

3
.gitignore vendored Normal file
View file

@ -0,0 +1,3 @@
*.pyc
settings.json

53
__init__.py Normal file
View file

@ -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 = """<!doctype html>
<html language='en'>
<head>
<meta charset='utf-8'>
<title>DO NOT DISTURB</title>
<style>
html {
background: url('do-not-disturb.png') no-repeat center center fixed;
background-size: cover;
}
</style>
<body>
&nbsp;
</body>
</html>
"""
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()

BIN
res/do-not-disturb.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

View file

@ -0,0 +1,2 @@
cancel do not disturb
cancel meeting mode

View file

@ -0,0 +1,2 @@
do not disturb
meeting mode