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,49 @@
|
||||
"""Test: clock als 4x1-Strip (200x120), minimax als 2x2, weather als 2x2 (lower-right).
|
||||
Zeigt ob Widgets auf verschiedene Groessen reagieren."""
|
||||
import sys; sys.path.insert(0, ".")
|
||||
from PIL import Image, ImageDraw, ImageFont
|
||||
from layout import Item, GRID_COLS, GRID_ROWS, CELL_W, CELL_H, pack
|
||||
from plugins.clock import Widget as ClockW
|
||||
from plugins.minimax import Widget as MiniMaxW
|
||||
from plugins.weather import Widget as WeatherW
|
||||
from plugins.hello import Widget as HelloW
|
||||
|
||||
# Force-load fonts
|
||||
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),
|
||||
}
|
||||
|
||||
# Layout:
|
||||
# clock (4x1) | y=0
|
||||
# minimax (2x1) hello (2x1) | y=1
|
||||
# weather (4x2) | y=2..3
|
||||
items = [
|
||||
Item("a", "clock", 0, 0, 4, 1),
|
||||
Item("b", "clock", 0, 0, 1, 1), # tiny
|
||||
Item("c", "clock", 0, 0, 2, 2), # large
|
||||
Item("d", "clock", 0, 0, 4, 4), # full
|
||||
]
|
||||
|
||||
print("Testing CLOCK widget at different sizes:")
|
||||
print("="*60)
|
||||
img = Image.new("RGB", (800, 480), (255,255,255))
|
||||
draw = ImageDraw.Draw(img)
|
||||
# 4x1 strip top
|
||||
w = ClockW({})
|
||||
w.fetch()
|
||||
w.render(draw, fonts, 0, 0, 800, 120)
|
||||
# 2x2 below
|
||||
w = ClockW({"show_date": True})
|
||||
w.fetch()
|
||||
w.render(draw, fonts, 0, 120, 400, 240)
|
||||
# mini 1x1 bottom-right
|
||||
w = ClockW({})
|
||||
w.fetch()
|
||||
w.render(draw, fonts, 600, 360, 200, 120)
|
||||
img.save("/tmp/sizes_clock.png")
|
||||
print("saved /tmp/sizes_clock.png")
|
||||
Reference in New Issue
Block a user