Public Member Functions | Public Attributes | Private Attributes | List of all members
mycroft.skills.core.SkillGUI Class Reference

Public Member Functions

def __contains__ (self, key)
 
def __getitem__ (self, key)
 
def __init__ (self, skill)
 
def __setitem__ (self, key, value)
 
def build_message_type (self, event)
 
def clear (self)
 
def gui_set (self, message)
 
def register_handler (self, event, handler)
 
def remote_url (self)
 
def remove_page (self, page)
 
def remove_pages (self, page_names)
 
def send_event (self, event_name, params={})
 
def set_on_gui_changed (self, callback)
 
def setup_default_handlers (self)
 
def show_html (self, html, resource_url=None, override_idle=None)
 
def show_image (self, url, caption=None, title=None, fill=None, override_idle=None)
 
def show_page (self, name, override_idle=None)
 
def show_pages (self, page_names, index=0, override_idle=None)
 
def show_text (self, text, title=None, override_idle=None)
 
def show_url (self, url, override_idle=None)
 

Public Attributes

 config
 
 on_gui_changed_callback
 
 page
 
 skill
 

Private Attributes

 __session_data
 

Detailed Description

SkillGUI - Interface to the Graphical User Interface

Values set in this class are synced to the GUI, accessible within QML
via the built-in sessionData mechanism.  For example, in Python you can
write in a skill:
    self.gui['temp'] = 33
    self.gui.show_page('Weather.qml')
Then in the Weather.qml you'd access the temp via code such as:
    text: sessionData.time

Definition at line 220 of file core.py.

Constructor & Destructor Documentation

def mycroft.skills.core.SkillGUI.__init__ (   self,
  skill 
)

Definition at line 233 of file core.py.

Member Function Documentation

def mycroft.skills.core.SkillGUI.__contains__ (   self,
  key 
)

Definition at line 294 of file core.py.

def mycroft.skills.core.SkillGUI.__getitem__ (   self,
  key 
)

Definition at line 291 of file core.py.

def mycroft.skills.core.SkillGUI.__setitem__ (   self,
  key,
  value 
)

Definition at line 282 of file core.py.

def mycroft.skills.core.SkillGUI.build_message_type (   self,
  event 
)
Builds a message matching the output from the enclosure. 

Definition at line 245 of file core.py.

def mycroft.skills.core.SkillGUI.clear (   self)
Reset the value dictionary, and remove namespace from GUI 

Definition at line 297 of file core.py.

def mycroft.skills.core.SkillGUI.gui_set (   self,
  message 
)

Definition at line 276 of file core.py.

def mycroft.skills.core.SkillGUI.register_handler (   self,
  event,
  handler 
)
Register a handler for GUI events.

    when using the triggerEvent method from Qt
    triggerEvent("event", {"data": "cool"})

    Arguments:
event (str):    event to catch
handler:        function to handle the event

Definition at line 254 of file core.py.

def mycroft.skills.core.SkillGUI.remote_url (   self)
Returns configuration value for url of remote-server. 

Definition at line 241 of file core.py.

def mycroft.skills.core.SkillGUI.remove_page (   self,
  page 
)
Remove a single page from the GUI.

    Args:
page (str): Page to remove from the GUI

Definition at line 378 of file core.py.

def mycroft.skills.core.SkillGUI.remove_pages (   self,
  page_names 
)
Remove a list of pages in the GUI.

    Args:
page_names (list): List of page names (str) to display, such as
                   ["Weather.qml", "Forecast.qml", "Other.qml"]

Definition at line 386 of file core.py.

def mycroft.skills.core.SkillGUI.send_event (   self,
  event_name,
  params = {} 
)
Trigger a gui event.

Arguments:
    event_name (str): name of event to be triggered
    params: json serializable object containing any parameters that
    should be sent along with the request.

Definition at line 304 of file core.py.

def mycroft.skills.core.SkillGUI.set_on_gui_changed (   self,
  callback 
)
Registers a callback function to run when a value is
    changed from the GUI.

    Arguments:
callback:   Function to call when a value is changed

Definition at line 267 of file core.py.

def mycroft.skills.core.SkillGUI.setup_default_handlers (   self)
Sets the handlers for the default messages. 

Definition at line 249 of file core.py.

def mycroft.skills.core.SkillGUI.show_html (   self,
  html,
  resource_url = None,
  override_idle = None 
)
Display an HTML page in the GUI

Arguments:
    html (str): HTML text to display
    resource_url (str): Pointer to HTML resources

Definition at line 440 of file core.py.

def mycroft.skills.core.SkillGUI.show_image (   self,
  url,
  caption = None,
  title = None,
  fill = None,
  override_idle = None 
)
Display a GUI page for viewing an image

Arguments:
    url (str): Pointer to the image
    caption (str): A caption to show under the image
    title (str): A title to display above the image content
    fill (str): Fill type supports 'PreserveAspectFit',
    'PreserveAspectCrop', 'Stretch'

Definition at line 423 of file core.py.

def mycroft.skills.core.SkillGUI.show_page (   self,
  name,
  override_idle = None 
)
Begin showing the page in the GUI

Args:
    name (str): Name of page (e.g "mypage.qml") to display
    override_idle (boolean, int):
True: Takes over the resting page indefinitely
(int): Delays resting page for the specified number of
       seconds.

Definition at line 317 of file core.py.

def mycroft.skills.core.SkillGUI.show_pages (   self,
  page_names,
  index = 0,
  override_idle = None 
)
Begin showing the list of pages in the GUI

Args:
    page_names (list): List of page names (str) to display, such as
               ["Weather.qml", "Forecast.qml", "Details.qml"]
    index (int): Page number (0-based) to show initially.  For the
         above list a value of 1 would start on "Forecast.qml"
    override_idle (boolean, int):
True: Takes over the resting page indefinitely
(int): Delays resting page for the specified number of
       seconds.

Definition at line 330 of file core.py.

def mycroft.skills.core.SkillGUI.show_text (   self,
  text,
  title = None,
  override_idle = None 
)
Display a GUI page for viewing simple text

Arguments:
    text (str): Main text content.  It will auto-paginate
    title (str): A title to display above the text content.

Definition at line 409 of file core.py.

def mycroft.skills.core.SkillGUI.show_url (   self,
  url,
  override_idle = None 
)
Display an HTML page in the GUI

Arguments:
    url (str): URL to render

Definition at line 452 of file core.py.

Member Data Documentation

mycroft.skills.core.SkillGUI.__session_data
private

Definition at line 234 of file core.py.

mycroft.skills.core.SkillGUI.config

Definition at line 238 of file core.py.

mycroft.skills.core.SkillGUI.on_gui_changed_callback

Definition at line 237 of file core.py.

mycroft.skills.core.SkillGUI.page

Definition at line 235 of file core.py.

mycroft.skills.core.SkillGUI.skill

Definition at line 236 of file core.py.


The documentation for this class was generated from the following file:


mycroft_ros
Author(s):
autogenerated on Mon Apr 26 2021 02:35:41