header ====== .. py:module:: header .. autoapi-nested-parse:: Header bar: data time and next update left, battery right. Kept apart from `layout` so that header-only updates only import the small font (the large fonts take a while to import on the board). A header is described by a dict, which is also what gets stored between wakes to redraw the previous header for partial display updates:: {"data": "HH:MM" or None, "next": "HH:MM" or None, "battery": percent (int), "charging": bool, "online": bool, "reachable": bool} "data" is the time of the last data that reached the board, "next" that of the next planned update. The text reads "Stand 09:12 · neu 09:22"; while the data source is unreachable "Stand 09:02 · offline". A WLAN symbol shows that the board can be reached over the WLAN right now (awake and maintenance mode); a sleeping board is not, even though it was connected while it drew the screen. Attributes ---------- .. autoapisummary:: header.WIDTH header.HEIGHT header.MARGIN header.BLACK header.WHITE header.CHARGING_ICON header.WLAN_ICON header.ICON_GAP header.OFFLINE_TEXT header.SEPARATOR Functions --------- .. autoapisummary:: header.make_header header.status_text header.draw_header Module Contents --------------- .. py:data:: WIDTH :value: 400 .. py:data:: HEIGHT :value: 30 .. py:data:: MARGIN :value: 10 .. py:data:: BLACK :value: 0 .. py:data:: WHITE :value: 1 .. py:data:: CHARGING_ICON :value: 'lightning' .. py:data:: WLAN_ICON :value: 'wifi-high' .. py:data:: ICON_GAP :value: 2 .. py:data:: OFFLINE_TEXT :value: 'offline' .. py:data:: SEPARATOR :value: ' · ' .. py:function:: make_header(data_time, next_time, battery_percent, charging, online, reachable=False) Build a header dict (see the module docstring). :param data_time: Time of the last data, such as "09:12", or None. :param next_time: Time of the next planned update, or None. :param battery_percent: Battery level, rounded for display. :param charging: Whether to show the charging symbol. :param online: Whether the data source was reachable. :param reachable: Whether to show the WLAN symbol. :returns: The header dict. .. py:function:: status_text(header) Return the text on the left: data time and next update, or offline. .. py:function:: draw_header(fb, header) Draw the header bar at the top of `fb` (at least WIDTH x HEIGHT).