Sync to Pi: alle Features die live deployed sind
Aus dem Backup und Live-Pull vom Pi (10.11.3.144): - dashboard.py: Grid-Linien nur im freien Hintergrund (nicht durch Widgets) - templates/index.html: komplett redesigned mit Sidebar + Topbar + Toast + Modal - plugins/clock.py: responsive Layout (1x1 bis 4x4) - plugins/system.py, weather.py, minimax.py: mit Threshold-Bars und Color-Variants - plugins/base.py: NEU — fetch_with_retry Helper (3x retry mit backoff) + render_error_banner für fehlgeschlagene API-Plugins (grosses rotes "!" Icon mit Plugin-Name und Fehler statt Crash) Cleanup: Helfer-Chaos (renderer.py/2/3, design_a/b/c.html, clock_classic.py, 23x clock_*.png, alte test_*.py) wurde bereits im vorherigen Commit entfernt. Co-Authored-By: Hermes <noreply@hermes.local>
This commit is contained in:
co-authored by
Hermes
parent
af9a99a379
commit
1f142f5245
@@ -0,0 +1,27 @@
|
||||
"""Demo-Plugin: konfigurierbarer Text."""
|
||||
import os, sys
|
||||
sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
|
||||
from plugins.base import Widget
|
||||
from palette import fill_for, measure, fit_font, centered_text
|
||||
|
||||
|
||||
class Widget(Widget):
|
||||
name = "hello"
|
||||
label = "Hello / Demo"
|
||||
description = "Zeigt einen konfigurierbaren Text. Responsiv."
|
||||
category = "general"
|
||||
|
||||
config_schema = [
|
||||
{"key": "text", "label": "Text", "type": "string", "default": "Hello!"},
|
||||
{"key": "color", "label": "Farbe", "type": "select",
|
||||
"choices": ["fg", "info", "ok", "warn", "alert", "accent"], "default": "fg"},
|
||||
]
|
||||
default_config = {"text": "Hello!", "color": "fg"}
|
||||
|
||||
def fetch(self):
|
||||
return {}
|
||||
|
||||
def render(self, draw, fonts, x, y, w, h):
|
||||
text = self.cfg("text", "Hello!")
|
||||
font = fit_font(draw, text, fonts, w - 16, h - 16)
|
||||
centered_text(draw, text, x, y, w, h, font, fill_for(self.cfg("color", "fg")))
|
||||
Reference in New Issue
Block a user