Dash

class olympus.dashboard.dash.Dashboard(name='olympus.dashboard.dash', secret='__secret__')[source]

Bases: object

Dashboard entry point

Methods

add_page(self, page[, route, header]) Add a new page to the dashboard
on_event(self, event, handler[, namespace]) Register an handler for a givent event
run(self) Run the flask App
add_page(self, page, route=None, header=None, **kwargs)[source]

Add a new page to the dashboard

Parameters:
page: Page

page object

route: str

Route specification to reach the page Will default to the page route if left undefined

header: str

HTML header to insert onto the page

on_event(self, event, handler, namespace='/')[source]

Register an handler for a givent event

run(self)[source]

Run the flask App

olympus.dashboard.dash.bind(id, event, handler, attribute=None, property=None)[source]

Bind an element event to a handler and return a property of an attribute of the element

Parameters:
id: str

id of the DOM element

event: str

Name of the event we are listening too. The full list of supported events can be found here.

handler: call

function to callback when the event is fired

attribute: str

Attribute of the element to return

property: str

Property of the element to return

olympus.dashboard.dash.disconnect_event()[source]

Called when socketIO disconnects from the server

olympus.dashboard.dash.get_element_size(id, callback)[source]

Get the size of an element inside the webpage

Parameters:
id: str

id of the DOM element

callback: Call

Function to call with the size information {width: w, height: h}

olympus.dashboard.dash.handshake_event()[source]

Called when socketIO connects to the server

olympus.dashboard.dash.register_event(event, handler, namespace='/')[source]

Register a socketio event to a python handler

Parameters:
event: str

Name of the event

handler: call

Function to call when the event is fired

olympus.dashboard.dash.set_attribute(id, attribute, value)[source]

Set the attribute of an element on the webpage

Parameters:
id: str

id of the DOM element

attribute: str

name of the attribute to set

value: json

new value of the attribute

olympus.dashboard.dash.socketio()[source]