- 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
27 lines
1.0 KiB
Python
27 lines
1.0 KiB
Python
import sys; sys.path.insert(0, ".")
|
|
from PIL import Image, ImageDraw, ImageFont
|
|
from plugins.minimax import Widget
|
|
|
|
class FakeWidget(Widget):
|
|
def fetch(self):
|
|
return {
|
|
"windows": [
|
|
{"label": "5-Hour", "used_pct": 47.0, "remaining_pct": 53.0, "reset_seconds": 1820, "raw": {}},
|
|
{"label": "Weekly", "used_pct": 23.0, "remaining_pct": 77.0, "reset_seconds": 124800, "raw": {}},
|
|
],
|
|
"credits": {"points": 12345.0},
|
|
}
|
|
|
|
img = Image.new("RGB", (400, 240), (255, 255, 255))
|
|
draw = ImageDraw.Draw(img)
|
|
fonts = {
|
|
"16": ImageFont.truetype("fnt/Aldrich-Regular.ttc", 16),
|
|
"20": ImageFont.truetype("fnt/Aldrich-Regular.ttc", 20),
|
|
"24": ImageFont.truetype("fnt/Aldrich-Regular.ttc", 24),
|
|
"28": ImageFont.truetype("fnt/Aldrich-Regular.ttc", 28),
|
|
}
|
|
w = FakeWidget({"show_credits": True, "label_5h": "5-Hour", "label_weekly": "Weekly"})
|
|
w.render(draw, fonts, 0, 0, 400, 240)
|
|
img.save("/tmp/minimax_fake.png")
|
|
print("saved /tmp/minimax_fake.png")
|