- 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
30 lines
1.1 KiB
Python
30 lines
1.1 KiB
Python
"""Test: System Widget mit verschiedenen Threshold-Konfigurationen."""
|
|
import sys; sys.path.insert(0, ".")
|
|
from PIL import Image, ImageDraw, ImageFont
|
|
from plugins.system import Widget as SystemW
|
|
|
|
def font(s): return ImageFont.truetype("fnt/Aldrich-Regular.ttc", s)
|
|
fonts = {str(s): font(s) for s in [16, 20, 24, 28, 32]}
|
|
|
|
img = Image.new("RGB", (800, 480), (255,255,255))
|
|
draw = ImageDraw.Draw(img)
|
|
|
|
# Drei Konfigurationen nebeneinander
|
|
configs = [
|
|
{"name": "Default (50/80/95, gradient)",
|
|
"cfg": {"bar_thresholds": "ok@50,warn@80,alert@95", "bar_gradient": True}},
|
|
{"name": "Strenger (30/60/85, gradient)",
|
|
"cfg": {"bar_thresholds": "ok@30,warn@60,alert@85", "bar_gradient": True}},
|
|
{"name": "Einfarbig (40/70/95)",
|
|
"cfg": {"bar_thresholds": "ok@40,warn@70,alert@95", "bar_gradient": False}},
|
|
]
|
|
for i, c in enumerate(configs):
|
|
x = i * 267
|
|
draw.text((x + 8, 5), c["name"], font=font(14), fill=(0,0,0))
|
|
w = SystemW({**c["cfg"], "compact": False})
|
|
w.fetch()
|
|
w.render(draw, fonts, x, 30, 260, 200)
|
|
|
|
img.save("/tmp/system_thresholds.png")
|
|
print("saved /tmp/system_thresholds.png")
|