- dashboard.py: plugin-based renderer with 4x4 grid layout - admin.py: web UI with layout editor + plugin configs - layout.py: pack algorithm, item placement, grid system - plugins/: clock, weather, system, spotify, strava, gmail, minimax, hello - network_watchdog.py: WiFi AP/client mode management - waveshare_epd_init.py: vendor driver stub
33 lines
985 B
Python
33 lines
985 B
Python
import sys; sys.path.insert(0, ".")
|
|
import json
|
|
from layout import Item
|
|
from dashboard import render_full, load_fonts
|
|
|
|
cfg = json.load(open("config.json"))
|
|
items = [Item.from_dict(d) for d in cfg["layout"]["items"]]
|
|
plugins = cfg.get("plugin_configs", {})
|
|
|
|
from plugins.base import all_widget_classes
|
|
classes = {c.name: c for c in all_widget_classes()}
|
|
widgets = []
|
|
for it in items:
|
|
cls = classes.get(it.plugin)
|
|
if cls:
|
|
try:
|
|
w = cls(plugins.get(it.plugin, {}))
|
|
w.fetch()
|
|
widgets.append(w)
|
|
except Exception as e:
|
|
print(f"widget {it.plugin} failed: {e}")
|
|
widgets.append(None)
|
|
else:
|
|
widgets.append(None)
|
|
|
|
fonts = load_fonts()
|
|
print("items:", [(i.id, i.plugin, i.x, i.y, i.w, i.h) for i in items])
|
|
print("widgets:", [w.name if w else None for w in widgets])
|
|
|
|
img = render_full(items, widgets, fonts)
|
|
img.save("/tmp/render_grid_v2.png")
|
|
print(f"saved /tmp/render_grid_v2.png size={img.size}")
|