initial commit
This commit is contained in:
commit
43b2e35602
5 changed files with 60 additions and 0 deletions
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
*.pyc
|
||||
settings.json
|
||||
|
53
__init__.py
Normal file
53
__init__.py
Normal 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>
|
||||
|
||||
</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
BIN
res/do-not-disturb.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 34 KiB |
2
vocab/en-us/cancel-do-not-disturb.voc
Normal file
2
vocab/en-us/cancel-do-not-disturb.voc
Normal file
|
@ -0,0 +1,2 @@
|
|||
cancel do not disturb
|
||||
cancel meeting mode
|
2
vocab/en-us/do-not-disturb.voc
Normal file
2
vocab/en-us/do-not-disturb.voc
Normal file
|
@ -0,0 +1,2 @@
|
|||
do not disturb
|
||||
meeting mode
|
Loading…
Reference in a new issue