bootstrap
Adom Hydrogen (platform base)
Public Made by Adomby adom
Layer Hydrogen's workspace onto a standard Adom workstation.
master
John Lauer
Publish 0.5.54
746de2e
#!/usr/bin/env python3
"""The smallest possible Hydrogen widget: a clock. Shows the minimum a widget binary needs:
serve one page on $HYDROGEN_WIDGET_PORT."""
import os, sys
from importlib.machinery import SourceFileLoader
lib = SourceFileLoader('hwlib', os.path.join(os.path.dirname(os.path.realpath(__file__)), 'hydrogen-widget-lib.py')).load_module()
import datetime
def data():
now = datetime.datetime.now()
return {'time': now.strftime('%H:%M'), 'date': now.strftime('%a %d %b')}
RENDER = r"""(`<span class="big">${d.time}</span><span class="lbl">${d.date}</span>`)"""
lib.serve('Clock', data, RENDER, 60000, align_ms=60000)