layout¶
Dashboard layout: draws readings as a grid of tiles below a header bar.
Knows nothing about where readings come from (see datasource); tiles
say which reading keys to show and how. Draws onto any framebuf-like
object (see text).
Attributes¶
Functions¶
|
Display text for a reading value (German decimal comma). |
|
Large font if value and unit fit into |
|
Name of the icon for a string value, or None to show text. |
|
One tile: label on top, value with unit below, trend arrow top right. |
|
Value in the large (or, if too wide, medium) font with its unit. |
|
The bottom-left tile, which shows the web interface's QR code. |
|
QR code for |
|
Warning symbol with up to two lines of text, e.g. to charge the board. |
|
Draw the warning screen below |
|
Draw the whole screen. |
Module Contents¶
- layout.WIDTH = 400¶
- layout.HEIGHT = 300¶
- layout.COLUMNS = 2¶
- layout.MARGIN = 10¶
- layout.NO_VALUE = '?'¶
- layout.format_value(value, decimals=None, states=None)¶
Display text for a reading value (German decimal comma).
- layout.pick_value_font(value, unit, space)¶
Large font if value and unit fit into
spacepixels, else medium.
- layout.icon_for(value, icons)¶
Name of the icon for a string value, or None to show text.
- layout.TREND_ICONS¶
- layout.draw_tile(fb, tile, reading, x, y, w, h)¶
One tile: label on top, value with unit below, trend arrow top right.
- layout.draw_value(fb, value, unit, left, space, baseline)¶
Value in the large (or, if too wide, medium) font with its unit.
- layout.LINK_CAPTION = ('Kacheln', 'einstellen')¶
- layout.QR_MODULE_PX = 3¶
- layout.link_tile_index(tile_count)¶
The bottom-left tile, which shows the web interface’s QR code.
- layout.draw_link_tile(fb, url, x, y, w, h)¶
QR code for
urlwith a short caption right of it.
- layout.NOTICE_ICON = 'battery-warning'¶
- layout.draw_notice_tile(fb, lines, x, y, w, h)¶
Warning symbol with up to two lines of text, e.g. to charge the board.
- layout.ALERT_ICON = 'warning-circle'¶
- layout.ALERT_TITLE_LINES = 3¶
- layout.draw_alerts(fb, active, top)¶
Draw the warning screen below
top.Shows the first (most severe) alert with icon, title, as much text as fits and a facts line; further alerts are counted.
- layout.render(fb, readings, tiles, header, link=None, notice=None, active_alerts=None)¶
Draw the whole screen.
readingsis what a data source’s read() returns,tilesa list of {“key”, “label”[, “decimals”, “unit”, “states”, “icons”]} dicts in display order,headera header dict (seeheader). Tiles whose key is missing fromreadingsshow no value. “icons” maps string values to icon names in icons_large; values without an icon are shown as text. Withlink(a URL), the bottom-left tile shows it as QR code instead of its reading; otherwisenotice(a list of up to two text lines) shows a warning there.active_alerts(seealerts, most severe first) replace all tiles with a warning screen.