Repository navigation
Preview button on the plugin settings page (M5 part 3b-1) - #258
Merged
Merged
Conversation
Draws the plugin with the settings in the form, before saving, in its own process with a time limit (real data at most 45 s, then the sample data, saying why). One preview at a time; the picture is sent inside the page. Part of #238. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Draw the block at its own line (not the first with the same ID) and list only its own problems; no new drawing while PaperPi stops; a message for unexpected errors; an ended log-in opens the log-in page (HX-Redirect); clearer texts; docs: sample data in previews, secrets with changeable addresses (for later plugins); more tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
txoof
approved these changes
Oct 10, 2026
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.
Part of #238 (M5 part 3b-1).
What changed
A Preview button on each plugin's settings page. It draws the plugin with the settings in the form, before you save them, at your screen's size and for your screen's type. The real screen is not touched and nothing is saved.
runner.run_update). Each preview gets a new, empty storage folder that is deleted afterwards.data:address), so it is never saved as a file. The pages' security header now allows such pictures:img-src 'self' data:.docs/decisions/web-interface.md(update for 3b-1),docs/writing-plugins.md(sample data is also used by previews).New files:
src/paperpi/web/preview.py,src/paperpi/web/templates/preview.html,tests/test_web_preview.py. New limits:PREVIEW_LIVE(45 s) andPREVIEW_SAMPLE(10 s) inlimits.py.Choices I made without asking
For later (noted in the design note)
runner.py; the preview is the first page that shows it.Area
web (
src/paperpi/web/), core (limits.py, one line incli.py), docs,CLAUDE.md,README.md.Tests
tests/test_web_preview.py: real data at the screen's size and type (also a rotated gray4 screen), the 45 s cap, unsaved form values used and nothing saved, sample fallback with its reason (timeout, error, nothing to show, missing setting), sample failing too, form errors, a block changed meanwhile, two blocks with the same ID, problems of other blocks not listed, a saved secret kept and never shown, one preview at a time, the lock freed after an error, unexpected errors, stopping, expired log-in with htmx, the security header, and one real end-to-end preview ofbasic_clock(about 1 s).uv run pytestpasses: 1445 passed (with-n auto)uv run ruff check .passesImages
No browser on the Pi, so no screenshot of the page. The preview of
basic_clockwas checked by eye: the real current time at 1200 x 825 pixels. To try it: open a plugin's Settings, change a value, press Preview.Review
Only txoof approves and merges this PR.
🤖 Generated with Claude Code