Make the stock/odds tickers pixel-perfect on the LED grid - #258
Conversation
Follows the same three defects fixed in the leaderboard (#255). news already had this -- it is where the fontmode idiom came from -- so it is untouched here. Anti-aliasing. PIL anti-aliases text by default, and on a 1:1 LED matrix a partially-lit pixel is a visibly dim LED rather than a smooth edge. None of these three plugins set fontmode, so all their text carried the fringe. Each now routes every draw surface -- including the scratch canvases used only to measure text, so metrics cannot disagree with what is drawn -- through a _pixel_draw() helper that sets fontmode "1". How much that mattered differed per plugin, measured on the string "AAPL +1.2% Earnings": - stock-news derives its font size from the panel height when one is not configured, and height//3 lands on 10 for a 32px panel. Press Start 2P only rasterises cleanly at multiples of 8, so 57% of the lit pixels were partial. Now 0%. - odds-ticker and ledmatrix-stocks default their element sizes to 8, already on the grid, so their defaults were crisp by luck rather than by construction -- any size a user set in the customization UI was not. At a configured 12: 41% partial before, 0% after. Font grid. stock-news' auto size is now snapped to the font's grid, so the 32px panel gets 8 instead of 10 and glyph pixels map 1:1 rather than alternating 1px and 2px strokes. Only that case changes; 48/64/96px panels already resolved to 16. An explicit font_size is honoured as typed. Logos. odds-ticker sized team logos to int(height * 1.2) and then centred them with (height - logo_size) // 2, which is -3 on a 32px panel -- so the top and bottom of every logo was cropped off the panel, the same bug the leaderboard had. Logos now fit inside the panel. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WexvwNDtWLVymGVqKD7BGk
|
Warning Review limit reached
Next review available in: 41 minutes You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (9)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 5 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
Pull Request
Summary
Applies the same pixel-perfect fixes from #255 to the three other tickers that needed them: anti-aliased text in all three, and the
height * 1.2logo crop in odds-ticker.newsalready had this — it's where thefontmodeidiom came from — so it's untouched.Type of change
Plugin(s) affected
stock-news(2.4.6 → 2.5.0),ledmatrix-stocks(2.6.0 → 2.7.0),odds-ticker(1.1.10 → 1.2.0)Related issues
Follow-up to #255.
What changed, and how much it mattered
PIL anti-aliases text by default, and on a 1:1 LED matrix a partially-lit pixel is a visibly dim LED, not a smooth edge. None of these three set
fontmode. Each now routes every draw surface — including the scratch canvases used only to measure text, so metrics can't disagree with what's drawn — through a_pixel_draw()helper.Measured on the string
AAPL +1.2% Earnings:odds-ticker and ledmatrix-stocks default their element sizes to 8, which is already on Press Start 2P's grid — so their defaults were crisp by luck rather than by construction, and only custom sizes were affected. Their default look is unchanged. stock-news is the one with a visible default-case fix.
Font grid (stock-news only). Its auto size is
max(6, min(16, height // 3)), which lands on 10 for a 32px panel — off Press Start 2P's 8px grid, so strokes alternate 1px and 2px wide even with anti-aliasing off. It's now snapped to the grid. Only the 32px case changes (10 → 8); 48/64/96px panels already resolved to 16. An explicitfont_sizeis honoured as typed.Logos (odds-ticker only).
logo_size = int(height * 1.2)combined withy_pos = (height - logo_size) // 2gives -3 on a 32px panel, so the top and bottom 3px of every team logo was cropped off the panel — the same bug the leaderboard had. Logos now fit inside it.Test plan
Loaded the plugin in LEDMatrix on real hardware
Loaded the plugin in LEDMatrix emulator mode (
EMULATOR=true python3 run.py)Rendered against a core checkout; measured before/after anti-aliasing and logo geometry directly in pixels
Verified the web UI configuration form against the schema (no schema changes in this PR)
N/A — repo-wide / docs-only change
Safety harness: all three plugins PASS at all 8 sizes.
stock-newsandodds-tickerwere re-run after the rebase onto fix(odds-ticker): restore team logos for NCAA basketball and baseball #256.ledmatrix-stockswas slow to verify — it retries blocked Yahoo Finance calls for every symbol at every size — but its run has since completed and passes; its files are byte-identical between that run and the rebased HEAD, so the result covers the code in this PR.check_module_collisions.py: OK across 43 plugins.check_manifest_version_fields.py: OK for all three.news's own 16 tests still pass (it is untouched, but it shares the idiom).Bandit on the changed files: no new findings. Codacy: 0 new issues.
Remaining gap: not verified on real hardware — no panel in this environment, so the crispness claims rest on pixel measurements, not a photo of the matrix.
Required for plugin changes
versioninplugins/<id>/manifest.jsonfor all three, each with aversionschangelog entryclass_namematches the actual class in each entry pointentry_pointmatches the real fileREADME.mdif config keys changed — no config keys changed in this PRconfig_schema.jsonis the source of truth for the web UI form — no schema changes neededplugins.jsonsynced)Checklist
CONTRIBUTING.mdCONTRIBUTING.mdandCODE_OF_CONDUCT.mdNotes for reviewer
plugins.jsoncarries unrelated version bumps.update_registry.pysyncs every plugin, and the registry inmainwas stale for ~15 plugins whose manifests were already ahead. Since CLAUDE.md says the file is generated and must not be hand-edited, I left the script's output as-is rather than surgically reverting those lines. They're the same valuesupdate-registry.ymlwould write on the next push tomain.fontmode(baseball is partially done: 3 of 17 draw surfaces). Separately, they scale logos todisplay_height * 1.5— but unlike the ticker case that reads like an intentional design, a large team logo bleeding off the panel behind the score, so I didn't touch it. Both are worth a follow-up if you want them; say the word and the scoreboardfontmodesweep is mechanical._pixel_drawwas applied by regex across both files; I verified fix(odds-ticker): restore team logos for NCAA basketball and baseball #256'sLEAGUE_LOGO_DIRSand_missing_logo_warnedwork survived the rebase intact and coexists with it.