Repository navigation
feat: render_alert helper with auto word-wrap - #57
Merged
Merged
Conversation
New PluginHelpers.render_alert() method providing a reusable alert display capability for any plugin: - Blinking colored border (configurable color, width, blink rate) - Auto word-wrap: text is split at word boundaries to fit the available width inside the border - Centered text rendering inside the bordered area - Used by reolink-alert plugin (replaces inline rendering logic) Also: - Add _word_wrap() helper for pixel-width-aware text wrapping - 17 unit tests covering render_alert and word_wrap - CI: restrict image artifact upload to main/tags only (saves GH storage)
ojacques
force-pushed
the
feat/alert-helper
branch
from
July 25, 2026 09:28
b02ac08 to
6417eb5
Compare
New reusable alert system for zeClock:
1. PluginHelpers.render_alert() method:
- Blinking colored border (3px, configurable)
- Auto word-wrap based on font pixel width
- Optional emoji icon (left-aligned, vertically centered)
- Text rendered in MENU font, forced uppercase
- Centered text in the bordered area
2. /api/alert REST endpoint:
POST {"text": "...", "duration": 15, "icon": "person", "color": [255,0,0]}
- Triggers rich alert rendering in the clock main loop
- Takes priority over text overlay and normal plugins
- Auto-expires after duration, resumes normal display
3. Alert icons (from Noto Color Emoji via scripts/emoji_to_icon.py):
beacon 🚨, person 🚶, vehicle 🚗, animal 🐾,
motion 💨, warning ⚠️ , camera 📷, info ℹ️
4. Reolink plugin simplified:
- Now calls /api/alert instead of force-plugin mechanism
- Pure background listener, no render_frame complexity
- cleanup() is a no-op (listener runs independently)
5. CI: restrict image artifact upload to main/tags only
Tests: 23 tests (render_alert, word_wrap, icons)
Tested on Pi: all 7 detection types validated visually
ojacques
force-pushed
the
feat/alert-helper
branch
from
July 25, 2026 10:05
6417eb5 to
d24bf0a
Compare
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.
Summary
New reusable
PluginHelpers.render_alert()method that any plugin can use to display an alert with blinking border and auto-wrapped text.Features
render_alert(text, frame_index, ...)_word_wrap(text, max_width, font_name)Changes
zeclock/plugins/helpers.pyrender_alert()and_word_wrap()methodszeclock/plugins/reolink_alert_plugin.pyrender_alert()instead of inline renderingtests/test_alert_helper.py.github/workflows/build-rpi-image.ymlTests