Add live preview widget to plugin settings pages#660
Open
florianbachmann wants to merge 5 commits intofatihak:mainfrom
Open
Add live preview widget to plugin settings pages#660florianbachmann wants to merge 5 commits intofatihak:mainfrom
florianbachmann wants to merge 5 commits intofatihak:mainfrom
Conversation
New /preview endpoint generates images in-memory and returns them as base64 without writing temp files or updating the display. PreviewManager.js handles rendering, form listening, and client-side required-field validation before hitting the server. Graceful fallback when Chromium is unavailable. Enabled for: Clock, Countdown, Comic, To-Do List, WPOTD, Year Progress.
florianbachmann
commented
Apr 1, 2026
Contributor
Author
|
if you like it, I can help prepare documentation as well :-) |
There was a problem hiding this comment.
Pull request overview
Adds a live preview widget to plugin settings pages so users can see the rendered output immediately (without triggering an e-ink refresh), by introducing a new server preview endpoint and a client-side preview manager.
Changes:
- Add
/previewPOST endpoint to generate plugin images and return them as base64 data URLs. - Add
preview_manager.jsto render a “Current vs Preview” widget and debounce preview requests on form changes. - Enable the preview widget in selected plugins’
settings.html(Clock, Countdown, Comic, To-Do List, WPOTD, Year Progress).
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| src/templates/plugin.html | Loads the new preview manager script on plugin settings pages. |
| src/static/scripts/preview_manager.js | Implements the preview widget UI, form change listeners, debounced /preview requests, and required-field hints. |
| src/blueprints/plugin.py | Adds /preview endpoint to generate PNG in-memory and return as base64 JSON. |
| src/plugins/year_progress/settings.html | Adds preview widget + init call for Year Progress. |
| src/plugins/wpotd/settings.html | Adds preview widget + init call for WPOTD. |
| src/plugins/todo_list/settings.html | Adds preview widget, required-field hinting, and refresh hooks for dynamic list edits. |
| src/plugins/countdown/settings.html | Adds preview widget + init call with required date field. |
| src/plugins/comic/settings.html | Adds preview widget + init call for Comic. |
| src/plugins/clock/settings.html | Adds preview widget + init call; triggers preview refresh on face selection changes. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Contributor
Author
|
All Copilot review comments addressed :-) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When tweaking plugin settings I found myself hitting "Update Now" and waiting for the e-ink display to refresh just to see if the result looks right. This adds a live preview widget that shows the result instantly — side by side with the
current display image — so you can iterate on settings without touching the hardware.
How it works
/previewendpoint generates the image in-memory and returns it as base64 — no temp files, no display updatePreviewManager.jsrenders the preview widget, listens to form changes, and debounces requestsEnabled for
Clock, Countdown, Comic, To-Do List, WPOTD, Year Progress — these are the ones I use or tested that don't require API keys or external endpoints. The preview endpoint is optional — plugins without it work exactly as before.
Adding preview to another plugin
If you want to enable preview for a different plugin, here's all it takes. Year Progress is the simplest example — just two changes:
1. Add the widget to
settings.html:2. If the plugin has required fields, pass them so the preview shows a hint instead of an error:
That's it — the
/previewendpoint andPreviewManager.jshandle the rest.Screenshots