Warning, /system/mycroft-gui/documentation/README.md is written in an unsupported language. File is not indexed.
0001 **Draft Version: 0.1 | Document Author: Aditya Mehra | Status: Incomplete | Last Modified: 23rd August 2019** 0002 0003 In the age of information visualization is eminently essential to grab attention and create a promising communication strategy. Visual content that supports your spoken content can make it easier to present information well and more engaging for your audience and users. 0004 0005 <img src="https://images.theconversation.com/files/205921/original/file-20180212-58348-1sbutu2.jpg?ixlib=rb-1.1.0&rect=0%2C604%2C3994%2C1994&q=45&auto=format&w=1356&h=668&fit=crop" /> 0006 0007 (Image to be replaced by orignal artwork..) 0008 0009 #### INTRODUCTION TO MYCROFT-GUI 0010 0011 Mycroft-GUI is an open source visual and display framework for Mycroft running on top of KDE Plasma Technology and built using Kirigami a lightweight user interface framework for convergent applications which are empowered by Qt. 0012 0013 #### GETTING STARTED 0014 0015 Mycroft is an open source voice assistant that can be extended and expanded to the limits of your imagination. Mycroft can run anywhere from your desktop to your automobiles or on smart devices that empower your home. 0016 0017 Want Mycroft to do something new? Teach Mycroft a skill, share it, and improve the experience for tens of thousands of people all over the world. This guide aims to provide you with resources to create familar and consistent visual experiences with your expanding and innovative skills. 0018 0019 The Mycroft GUI Visual Skill Development Guide is divided into two sections: 0020 0021 ##### Visual Skill Development API Foundation 0022 0023 - Learn and familarize yourself with the basics of expanding your voice only skills with the Visual Skill Development API for devices that support displays..(Learn More Link) 0024 0025 ##### Visual Skill Development Human Interface Guidelines 0026 0027 - Learn about the best practises and design philosphy to creating consistent visual experiences..(Learn More Link) 0028 0029 ## VISUAL SKILL DEVELOPMENT API FOUNDATION 0030 0031 Mycroft enabled devices with displays such as the Mark II, KDE Plasmoid provide skill developers the opportunity to create skills that can be empowered by both voice and screen interaction. The display interaction technology is based on the QML user interface markup language that gives you complete freedom to create in-depth innovative interactions without boundries or provide you with simple templates within the Mycroft GUI framework that allow minimalistic display of text and images based on your skill development specifics and preferences. 0032 0033 This section of the guide is divided into two skill examples that will show you how to create: 0034 0035 - In-depth QML based audio and visual interaction skills 0036 0037 - Simple template based text and image skills 0038 0039 #### In-depth QML based audio and visual interaction skills 0040 0041 QML user interface markup language is a declartive language built on top of Qt's existing strengths designed to describe the user interface of a program: both what it looks like, and how it behaves. QML provides modules that consist of sophisticated set of graphical and behavioral building elements. In the example below we will showcase how to create a QML interface for your skill including how it interacts with your voice skill. 0042 0043 ##### Before Getting Started Resources 0044 0045 A collection of resources to familarize you with QML and Kirigami Framework. 0046 0047 - [Introduction to QML ](http://doc.qt.io/qt-5/qml-tutorial.html) 0048 0049 - [Introduction to Kirigami](https://www.kde.org/products/kirigami/) 0050 0051 ##### Building your skill to support display 0052 0053 Skills for Mycroft AI are written in Python, using the skills development guide available [here](https://mycroft.ai/documentation/skills/developing-skills/) 0054 0055 #### Recipes Skill Example 0056 0057 Let's walk you through some basics of writing your QML user interface, this section is divided into 5 parts: 0058 0059 - [Importing Modules](#Importing-Modules) 0060 0061 - [Using Mycroft-GUI Framework Base Delegates](#Using-Mycroft-GUI-Framework) 0062 0063 - [Using Mycroft Framework Components](#Using-Mycroft-Framework-Components) 0064 0065 - [Event Handling](#Event-Handling) 0066 0067 - [Resting Faces](#Resting-Faces) 0068 0069 ##### Importing Modules 0070 0071 A QML module provides versioned types and JavaScript resources in a type namespace which may be used by clients who import the module. Modules make use of the QML versioning system which allows modules to be independently updated. More in-depth information about QML modules can be found here [Qt Qml Modules Documentation](http://doc.qt.io/qt-5/qtqml-modules-topic.html) 0072 0073 In the code snippet example below we will look at importing some of the common modules that provide the components required to get started with our Visual User Interface. 0074 0075 ``` 0076 import QtQuick 2.4 0077 import QtQuick.Controls 2.2 0078 import QtQuick.Layouts 1.4 0079 import org.kde.kirigami 2.4 as Kirigami 0080 import Mycroft 1.0 as Mycroft 0081 import org.kde.lottie 1.0 0082 ``` 0083 0084 ###### QTQuick Module: 0085 0086 Qt Quick module is the standard library for writing QML applications, the module provides a visual canvas and includes types for creating and animating visual components, receiving user input, creating data models and views and delayed object instantiation. In-depth information about QTQuick can be found at [Qt Quick Documentation](https://doc.qt.io/qt-5.11/qtquick-index.html) 0087 0088 ###### QTQuick.Controls Module: 0089 0090 The QtQuick Controls module provides a set of controls that can be used to build complete interfaces in Qt Quick. Some of the controls provided are button controls, container controls, delegate controls, indicator controls, input controls, navigation controls and more, for a complete list of controls and components provided by QtQuick Controls you can refer to [QtQuick Controls 2 Guidelines](https://doc.qt.io/qt-5.11/qtquickcontrols2-guidelines.html) 0091 0092 ###### QtQuick.Layouts Module: 0093 0094 QtQuick Layouts are a set of QML types used to arrange items in a user interface. Some of the layouts provided by QtQuick Layouts are Coloumn Layout, Grid Layout, Row Layout and more, for a complete list of layouts you can refer to [QtQuick Layouts Documentation](http://doc.qt.io/qt-5/qtquicklayouts-index.html) 0095 0096 ###### Kirigami Module: 0097 0098 [Kirigami](https://api.kde.org/frameworks/kirigami/html/index.html) is a set of QtQuick components for mobile and convergent applications. [Kirigami](https://api.kde.org/frameworks/kirigami/html/index.html) is a set of high level components to make the creation of applications that look and feel great on mobile as well as desktop devices and follow the [Kirigami Human Interface Guidelines](https://community.kde.org/KDE_Visual_Design_Group/KirigamiHIG) 0099 0100 ###### Mycroft Module: 0101 0102 Mycroft GUI frameworks provides a set of high level components and events system for aiding in the development of mycroft visual skills. One of the controls provided by Mycroft GUI frameworks are Mycroft-GUI Framework Base Delegates [Mycroft-GUI Framework Base Delegates Documentation](#) 0103 0104 ###### QML Lottie Module: 0105 0106 This provides a QML `Item` to render Adobe® After Effects™ animations exported as JSON with Bodymovin using the Lottie Web library. For list of all properties supported refer [Lottie QML](https://github.com/kbroulik/lottie-qml) 0107 0108 ##### Using Mycroft-GUI Framework Base Delegates 0109 0110 When you design your skill with QML, Mycroft-GUI frameworks provides you with some base delegates you should use when desiging your GUI skill. The base delegates provide you with a basic presentation layer for your skill with some property assignments that can help you setup background images, background dim, timeout and grace time properties to give you the control you need for rendereing an experience. In your GUI Skill you can use: 0111 0112 - Mycroft.Delegate: *Needs Description* 0113 0114 Simple display Image and Text Example using Mycroft.Delegate 0115 0116 ``` 0117 import Mycroft 1.0 as Mycroft 0118 0119 Mycroft.Delegate { 0120 skillBackgroundSource: sessionData.exampleImage 0121 ColumnLayout { 0122 anchors.fill: parent 0123 Image { 0124 id: imageId 0125 Layout.fillWidth: true 0126 Layout.preferredHeight: Kirigami.Units.gridUnit * 2 0127 source: "https://source.unsplash.com/1920x1080/?+autumn" 0128 } 0129 Label { 0130 id: labelId 0131 Layout.fillWidth: true 0132 Layout.preferredHeight: Kirigami.Units.gridUnit * 4 0133 text: "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua." 0134 } 0135 } 0136 } 0137 ``` 0138 0139 - Mycroft.ScrollableDelegate: *Needs Description* 0140 0141 Example of using Mycroft.ScrollableDelegate 0142 0143 ``` 0144 import QtQuick 2.4 0145 import QtQuick.Controls 2.2 0146 import QtQuick.Layouts 1.4 0147 import org.kde.kirigami 2.4 as Kirigami 0148 import Mycroft 1.0 as Mycroft 0149 0150 Mycroft.ScrollableDelegate{ 0151 id: root 0152 skillBackgroundSource: sessionData.background 0153 property var sampleModel: sessionData.sampleBlob 0154 0155 Kirigami.CardsListView { 0156 id: exampleListView 0157 Layout.fillWidth: true 0158 Layout.fillHeight: true 0159 model: sampleModel.lorem 0160 delegate: Kirigami.AbstractCard { 0161 id: rootCard 0162 implicitHeight: delegateItem.implicitHeight + Kirigami.Units.largeSpacing 0163 contentItem: Item { 0164 implicitWidth: parent.implicitWidth 0165 implicitHeight: parent.implicitHeight 0166 ColumnLayout { 0167 id: delegateItem 0168 anchors.left: parent.left 0169 anchors.right: parent.right 0170 anchors.top: parent.top 0171 spacing: Kirigami.Units.largeSpacing 0172 Kirigami.Heading { 0173 id: restaurantNameLabel 0174 Layout.fillWidth: true 0175 text: modelData.text 0176 level: 2 0177 wrapMode: Text.WordWrap 0178 } 0179 Kirigami.Separator { 0180 Layout.fillWidth: true 0181 } 0182 Image { 0183 id: placeImage 0184 source: modelData.image 0185 Layout.fillWidth: true 0186 Layout.preferredHeight: Kirigami.Units.gridUnit * 3 0187 fillMode: Image.PreserveAspectCrop 0188 } 0189 Item { 0190 Layout.fillWidth: true 0191 Layout.preferredHeight: Kirigami.Units.gridUnit * 1 0192 } 0193 } 0194 } 0195 } 0196 } 0197 } 0198 ``` 0199 0200 ##### Using Mycroft Framework Components 0201 0202 #### Simple template based text and image skill displays 0203 0204 Designing a simple skill and only want to display text or images ? Mycroft GUI framwork and Mycroft enclosure API provides ready to use QML based template wrappers that can minimalisticly display simple skills data such as text and images. In the example below we will showcase how to create a simple voice skill that displays simple text on your mycroft enabled device with a display. 0205 0206 **Text Example:** 0207 0208 ```python 0209 ... 0210 def handle_hello_world(self, message): 0211 ... 0212 self.gui.show_text("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmo tempor incididunt ut labore et dolore magna aliqua.") 0213 ... 0214 ``` 0215 0216 **Image Example** 0217 0218 ```python 0219 ... 0220 def handle_hello_world(self, message): 0221 ... 0222 self.gui.show_image("https://source.unsplash.com/1920x1080/?+autumn") 0223 ... 0224 ``` 0225 0226 **HTML Url Example** 0227 0228 ```python 0229 ... 0230 def handle_hello_world(self, message): 0231 ... 0232 self.gui.show_url("https://mycroft.ai") 0233 ... 0234 ``` 0235 0236 **HTML Raw Example** 0237 0238 ``` 0239 ... 0240 def handle_hello_world(self, message): 0241 ... 0242 rawhtmlexample = """<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 0243 <html xmlns="http://www.w3.org/1999/xhtml"> 0244 <head> 0245 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 0246 <title>Untitled Document</title> 0247 <body> 0248 <h1> HTML Example </h1> 0249 <p> This is an example of an HTML webpage. </p> 0250 <p> <b>Tags</b> can be wrapped <i>inside other tags!</i> </p> 0251 0252 <p> 0253 HTML doesn't care about extra spaces, tabs or newlines, 0254 so we can use indentation and spacing to keep everything 0255 lined up nicely. 0256 </p> 0257 0258 <ul> 0259 <li> This is how you create a bulleted list! </li> 0260 <li> Item 2 </li> 0261 <li> Item 3 </li> 0262 </ul> 0263 </body> 0264 </html> 0265 """ 0266 self.gui.show_html(rawhtmlexample) 0267 ... 0268 ``` 0269 0270 #### Advanced skill displays using QML 0271 0272 **Display Lottie Animations**: 0273 0274 You can use the `LottieAnimation` item just like any other `QtQuick` element, such as an `Image` and place it in your scene any way you please. 0275 0276 **QML Example** 0277 0278 ``` 0279 import QtQuick 2.4 0280 import QtQuick.Controls 2.2 0281 import QtQuick.Layouts 1.4 0282 import org.kde.kirigami 2.4 as Kirigami 0283 import Mycroft 1.0 as Mycroft 0284 import org.kde.lottie 1.0 0285 0286 Mycroft.Delegate { 0287 LottieAnimation { 0288 id: fancyAnimation 0289 anchors.fill: parent 0290 source: Qt.resolvedUrl("animations/fancy_animation.json") 0291 loops: Animation.Infinite 0292 fillMode: Image.PreserveAspectFit 0293 running: true 0294 } 0295 } 0296 ``` 0297 0298 **Display Sliding Images** 0299 0300 Contains an image that will slowly scroll in order to be shown completely 0301 0302 **QML Example** 0303 0304 ``` 0305 import QtQuick 2.4 0306 import QtQuick.Controls 2.2 0307 import QtQuick.Layouts 1.4 0308 import org.kde.kirigami 2.4 as Kirigami 0309 import Mycroft 1.0 as Mycroft 0310 0311 Mycroft.Delegate { 0312 background: Mycroft.SlidingImage { 0313 source: "foo.jpg" 0314 running: bool //If true the sliding animation is active 0315 speed: 1 //Animation speed in Kirigami.Units.gridUnit / second 0316 } 0317 } 0318 ``` 0319 0320 **Display Paginated Text** 0321 0322 Takes a long text and breaks it down into pages that can be horizontally swiped 0323 0324 **QML Example** 0325 0326 ``` 0327 import QtQuick 2.4 0328 import QtQuick.Controls 2.2 0329 import QtQuick.Layouts 1.4 0330 import org.kde.kirigami 2.4 as Kirigami 0331 import Mycroft 1.0 as Mycroft 0332 0333 Mycroft.Delegate { 0334 Mycroft.PaginatedText { 0335 text: string //The text that should be displayed 0336 currentIndex: 0 //The currently visible page number (starting from 0) 0337 } 0338 } 0339 ``` 0340 0341 **Display A Vertical ListView With Information Cards** 0342 0343 Kirigami CardsListView is a ListView which can have AbstractCard as its delegate: it will automatically assign the proper spacings and margins around the cards adhering to the design guidelines. 0344 0345 **Python Skill Example** 0346 0347 ```python 0348 ... 0349 def handle_food_places(self, message): 0350 ... 0351 self.gui["foodPlacesBlob"] = results.json 0352 self.gui.show_page("foodplaces.qml") 0353 ... 0354 ``` 0355 0356 **QML Example** 0357 0358 ``` 0359 import QtQuick 2.4 0360 import QtQuick.Controls 2.2 0361 import QtQuick.Layouts 1.4 0362 import org.kde.kirigami 2.4 as Kirigami 0363 import Mycroft 1.0 as Mycroft 0364 0365 Mycroft.Delegate{ 0366 id: root 0367 property var foodPlacesModel: sessionData.foodPlacesBlob 0368 0369 Kirigami.CardsListView { 0370 id: restaurantsListView 0371 Layout.fillWidth: true 0372 Layout.fillHeight: true 0373 model: foodPlacesModel 0374 delegate: Kirigami.AbstractCard { 0375 id: rootCard 0376 implicitHeight: delegateItem.implicitHeight + Kirigami.Units.largeSpacing 0377 contentItem: Item { 0378 implicitWidth: parent.implicitWidth 0379 implicitHeight: parent.implicitHeight 0380 ColumnLayout { 0381 id: delegateItem 0382 anchors.left: parent.left 0383 anchors.right: parent.right 0384 anchors.top: parent.top 0385 spacing: Kirigami.Units.smallSpacing 0386 Kirigami.Heading { 0387 id: restaurantNameLabel 0388 Layout.fillWidth: true 0389 text: modelData.name 0390 level: 3 0391 wrapMode: Text.WordWrap 0392 } 0393 Kirigami.Separator { 0394 Layout.fillWidth: true 0395 } 0396 RowLayout { 0397 Layout.fillWidth: true 0398 Layout.preferredHeight: form.implicitHeight 0399 Image { 0400 id: placeImage 0401 source: modelData.image 0402 Layout.fillHeight: true 0403 Layout.preferredWidth: placeImage.implicitHeight + Kirigami.Units.gridUnit * 2 0404 fillMode: Image.PreserveAspectFit 0405 } 0406 Kirigami.Separator { 0407 Layout.fillHeight: true 0408 } 0409 Kirigami.FormLayout { 0410 id: form 0411 Layout.fillWidth: true 0412 Layout.minimumWidth: aCard.implicitWidth 0413 Layout.alignment: Qt.AlignLeft | Qt.AlignBottom 0414 Label { 0415 Kirigami.FormData.label: "Description:" 0416 Layout.fillWidth: true 0417 wrapMode: Text.WordWrap 0418 elide: Text.ElideRight 0419 text: modelData.restaurantDescription 0420 } 0421 Label { 0422 Kirigami.FormData.label: "Phone:" 0423 Layout.fillWidth: true 0424 wrapMode: Text.WordWrap 0425 elide: Text.ElideRight 0426 text: modelData.phone 0427 } 0428 } 0429 } 0430 } 0431 } 0432 } 0433 } 0434 } 0435 ``` 0436 0437 **Using Proportional Delegate For Simple Display Skills & Auto Layout** 0438 0439 **ProportionalDelegate** is a delegate which has proportional paddings and a columnlayout as mainItem. The delegate supports a proportionalGridUnit which is based upon its size and the contents are supposed to be scaled proportionally to the delegate size either directly or using the proportionalGridUnit. 0440 0441 **AutoFitLabel** is a label that will always scale its text size according to the item size rather than the other way around 0442 0443 **QML Example** 0444 0445 ``` 0446 import QtQuick 2.4 0447 import QtQuick.Controls 2.2 0448 import QtQuick.Layouts 1.4 0449 import org.kde.kirigami 2.4 as Kirigami 0450 import Mycroft 1.0 as Mycroft 0451 0452 Mycroft.ProportionalDelegate { 0453 id: root 0454 0455 Mycroft.AutoFitLabel { 0456 id: monthLabel 0457 font.weight: Font.Bold 0458 Layout.fillWidth: true 0459 Layout.preferredHeight: proportionalGridUnit * 40 0460 text: sessionData.month 0461 } 0462 0463 Mycroft.AutoFitLabel { 0464 id: dayLabel 0465 font.weight: Font.Bold 0466 Layout.fillWidth: true 0467 Layout.preferredHeight: proportionalGridUnit * 40 0468 text: sessionData.day 0469 } 0470 } 0471 ``` 0472 0473 **Using Slideshow Component To Show Cards Slideshow** 0474 0475 Slideshow component lets you insert a slideshow yith your custom delegate in any skill display which can be tuned to autoplay and loop and also scrolled or flicked manually by the user. 0476 0477 **QML Example** 0478 0479 ``` 0480 import QtQuick 2.4 0481 import QtQuick.Controls 2.2 0482 import QtQuick.Layouts 1.4 0483 import org.kde.kirigami 2.4 as Kirigami 0484 import Mycroft 1.0 as Mycroft 0485 0486 Mycroft.Delegate { 0487 id: root 0488 0489 Mycroft.SlideShow { 0490 id: simpleSlideShow 0491 model: sessionData.exampleModel // model with slideshow data 0492 anchors.fill: parent 0493 interval: 5000 // time to switch between slides 0494 running: true // can be set to false if one wants to swipe manually 0495 loop: true // can be set to play through continously or just once 0496 delegate: Kirigami.AbstractCard { 0497 width: rootItem.width 0498 height: rootItem.height 0499 contentItem: ColumnLayout { 0500 anchors.fill: parent 0501 Kirigami.Heading { 0502 Layout.fillWidth: true 0503 wrapMode: Text.WordWrap 0504 level: 3 0505 text: modelData.Title 0506 } 0507 Kirigami.Separator { 0508 Layout.fillWidth: true 0509 Layout.preferredHeight: 1 0510 } 0511 Image { 0512 Layout.fillWidth: true 0513 Layout.preferredHeight: rootItem.height / 4 0514 source: modelData.Image 0515 fillMode: Image.PreserveAspectCrop 0516 } 0517 } 0518 } 0519 } 0520 } 0521 ``` 0522 0523 ##### Using AudioPlayer Component To Play Audio Files / Audio Streaming 0524 0525 AudioPlayer component is a custom wrapper around Qt Multimedia MediaPlayer, that gives the Skill Authors a basic responsive design audio player they can plug into their skills. 0526 0527 **QML Example** 0528 0529 ``` 0530 import QtQuick 2.4 0531 import QtQuick.Controls 2.2 0532 import QtQuick.Layouts 1.4 0533 import org.kde.kirigami 2.4 as Kirigami 0534 import Mycroft 1.0 as Mycroft 0535 0536 Mycroft.Delegate { 0537 id: root 0538 skillBackgroundSource: sessionData.audioThumbnail 0539 0540 Mycroft.AudioPlayer { 0541 id: examplePlayer 0542 anchors.fill: parent 0543 source: sessionData.audioSource //Set URL of audio file 0544 thumbnail: sessionData.audioThumbnail //Set Thumbnail of audio 0545 title: sessionData.audioTitle //Set Title of audio 0546 nextAction: "author.example-player.next" //Event to drive next button action in skill 0547 previousAction: "author.example-player.previous" //Event to drive previous button action in skill 0548 status: sessionData.status //Current status of playing audio 0549 } 0550 } 0551 ``` 0552 0553 ##### Event Handling 0554 0555 Mycroft GUI API provides an Event Handling Protocol between the skill and QML display which allow Skill Authors to forward events in either direction to an event consumer. Skill Authors have the ability to create any amount of custom events. Event names that start with "system." are available to all skills, like previous/next/pick. 0556 0557 **Simple Event Trigger Example From QML Display To Skill** 0558 0559 **Python Skill Example** 0560 0561 ```python 0562 def initialize(self): 0563 # Initialize... 0564 self.gui.register_handler('skill.foo.event', self.handle_foo_event) 0565 ... 0566 def handle_foo_event(self, message): 0567 self.speak(message.data["string"]) 0568 ... 0569 ... 0570 ``` 0571 0572 **QML Example** 0573 0574 ``` 0575 import QtQuick 2.4 0576 import QtQuick.Controls 2.2 0577 import QtQuick.Layouts 1.4 0578 import org.kde.kirigami 2.4 as Kirigami 0579 import Mycroft 1.0 as Mycroft 0580 0581 Mycroft.Delegate { 0582 id: root 0583 0584 Button { 0585 anchors.fill: parent 0586 text: "Click Me" 0587 onClicked: { 0588 triggerGuiEvent("skill.foo.event", {"string": "Lorem ipsum dolor sit amet"}) 0589 } 0590 } 0591 } 0592 ``` 0593 0594 **Simple Event Trigger Example From Skill To QML Display** 0595 0596 **Python Skill Example** 0597 0598 ```python 0599 ... 0600 def handle_foo_intent(self, message): 0601 self.gui['foobar'] = message.data.get("utterance") 0602 self.gui['color'] = "blue" 0603 self.gui.show_page("foo.qml") 0604 ... 0605 ... 0606 ``` 0607 0608 **QML Example** 0609 0610 ``` 0611 import QtQuick 2.4 0612 import QtQuick.Controls 2.2 0613 import QtQuick.Layouts 1.4 0614 import org.kde.kirigami 2.4 as Kirigami 0615 import Mycroft 1.0 as Mycroft 0616 0617 Mycroft.Delegate { 0618 id: root 0619 property var fooString: sessionData.foobar 0620 0621 onFooStringChanged: { 0622 fooRect.color = sessionData.color 0623 } 0624 0625 Rectangle { 0626 id: fooRect 0627 anchors.fill: parent 0628 color: "#fff" 0629 } 0630 } 0631 ``` 0632 0633 ##### Resting Faces 0634 0635 The resting face API provides skill authors the ability to extend their skills to supply their own customized IDLE screens that will be displayed when there is no activity on the screen. 0636 0637 **Simple Idle Screen Example** 0638 0639 **Python Skill Example** 0640 0641 ``` 0642 from mycroft.skills.core import resting_screen_handler 0643 ... 0644 @resting_screen_handler('NameOfIdleScreen') 0645 def handle_idle(self, message): 0646 self.gui.clear() 0647 self.log.info('Activating foo/bar resting page') 0648 self.gui["exampleText"] = "This Is A Idle Screen" 0649 self.gui.show_page('idle.qml') 0650 ``` 0651 0652 **QML Example** 0653 0654 ``` 0655 import QtQuick 2.4 0656 import QtQuick.Controls 2.2 0657 import QtQuick.Layouts 1.4 0658 import org.kde.kirigami 2.4 as Kirigami 0659 import Mycroft 1.0 as Mycroft 0660 0661 Mycroft.Delegate { 0662 id: root 0663 property var fooString: sessionData.exampleText 0664 0665 Kirigami.Heading { 0666 id: headerExample 0667 anchors.centerIn: parent 0668 text: fooString 0669 } 0670 } 0671 ```