1
0
Fork 0
mirror of https://github.com/MycroftAI/mycroft-core.git synced 2025-12-06 23:15:18 -05:00
2 Screen Display Service
Kathy Reid edited this page 2017-12-13 16:05:16 +11:00

Status: Available-ish

Proof of Concept : https://github.com/MycroftAI/mycroft-core/issues/995

Please note that all Mycroft Documentation has now moved here.

Using the Display service

The display service handles display and queueing of pictures. A Display Control skill can be used to control display after it has been started so basically the display only needs to be requested in the skill, controlling the display is already implemented.

Setup

First import the DisplayService class.

from mycroft.skills.displayservice import DisplayService

Then in the initialize() method of your skill instantiate an object

    def initialize(self):
        self.display_service = DisplayService(self.emitter)

        #Other initialize code
        [...]

Starting display

With the the display service instance created to start display simply call the display method with a list of file paths:

        self.display_service.display(['file:///path/to/my/pic.jpg'])

the display method has an optional argument to further process the user's utterance. Currently this can only be used to select backend (where you want to send the picture)

To use this feature the utterance received from the intent service must be passed on

    def picture_display_handler(self, message):
        self.display_service.display(PICLIST, utterance=message.data['utterance'])

Adding pictures to queue

It is possible to add pictures to a display without displaying them

    def picture_collector_handler(self, message):
        self.display_service.add_pictures(PICLIST, utterance=message.data['utterance'])

Display Control Skill

  • start display -> display default picture
  • reset display -> reset picture list and window size
  • set/unset fullscreen
  • set width/height to {number of pixels}
  • clear display -> draw black screen
  • next picture
  • previous picture
  • increase/decrease window size -> increase/decrease size by 30%
  • random picture -> display stock photo from unsplash.it

The backends

The default backend can be webbrowser module to open in browser. Included in this release there's also

  • OpenCV

Example config

"Displays": { "backends": { "opencv": { "type": "opencv", "active": true }, "web browser": { "type": "webbrowser", "active": true } }, "default-backend": "opencv" },

Team: Jarbas