"""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")