Initial commit: epaper-dashboard for 7.3" ACeP 7-Color display
- 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
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
"""Test alle Widgets in verschiedenen Groessen, um Layout-Probleme zu finden."""
|
||||
import sys; sys.path.insert(0, ".")
|
||||
from PIL import Image, ImageDraw, ImageFont
|
||||
from layout import Item
|
||||
from plugins.clock import Widget as ClockW
|
||||
from plugins.weather import Widget as WeatherW
|
||||
from plugins.system import Widget as SystemW
|
||||
from plugins.minimax import Widget as MiniMaxW
|
||||
from plugins.hello import Widget as HelloW
|
||||
import json
|
||||
|
||||
def font(size):
|
||||
return ImageFont.truetype("fnt/Aldrich-Regular.ttc", size)
|
||||
fonts = {
|
||||
"16": font(16), "20": font(20), "24": font(24),
|
||||
"28": font(28), "32": font(32), "48": font(48),
|
||||
"60": font(60), "80": font(80),
|
||||
"clock": ImageFont.truetype("fnt/advanced_led_board-7.ttc", 100),
|
||||
}
|
||||
|
||||
plugins_cfg = json.load(open("config.json")).get("plugin_configs", {})
|
||||
|
||||
# Layout test grid: 4x4
|
||||
# (0,0)-(3,0): system 4x1 wide
|
||||
# (0,1)-(1,1): weather 2x1
|
||||
# (2,1)-(3,1): minimax 2x1
|
||||
# (0,2)-(1,3): hello 2x2
|
||||
# (2,2)-(3,3): mix
|
||||
img = Image.new("RGB", (800, 480), (255,255,255))
|
||||
draw = ImageDraw.Draw(img)
|
||||
|
||||
# system 4x1 (full width strip)
|
||||
w = SystemW(plugins_cfg.get("system", {}))
|
||||
w.fetch()
|
||||
w.render(draw, fonts, 0, 0, 800, 120)
|
||||
|
||||
# weather 2x1
|
||||
w = WeatherW(plugins_cfg.get("weather", {"location": "52.52,13.41"}))
|
||||
w.fetch()
|
||||
w.render(draw, fonts, 0, 120, 400, 120)
|
||||
|
||||
# minimax 2x1
|
||||
w = MiniMaxW(plugins_cfg.get("minimax", {}))
|
||||
w.fetch()
|
||||
w.render(draw, fonts, 400, 120, 400, 120)
|
||||
|
||||
# hello 2x2
|
||||
w = HelloW({"text": "Layout Test", "color": "accent"})
|
||||
w.render(draw, fonts, 0, 240, 400, 240)
|
||||
|
||||
# clock 2x2
|
||||
w = ClockW({"show_date": True})
|
||||
w.fetch()
|
||||
w.render(draw, fonts, 400, 240, 400, 240)
|
||||
|
||||
img.save("/tmp/sizes_mix.png")
|
||||
print("saved /tmp/sizes_mix.png")
|
||||
Reference in New Issue
Block a user