mirror of
https://github.com/ChuckBuilds/LEDMatrix.git
synced 2026-10-14 02:56:36 +00:00
merge: bring the element-style work onto main's api_v3 package split
main moved 16 commits while this branch was open, and one of them split api_v3.py into a package. A rebase would have conflicted on that file in each of the 15 commits that touch it; merging resolves it once. Reapplied into the package, unchanged in substance: - _schema_type_is / _schema_allows_null and the nullable-field handling (api_v3/__init__.py, where the form parser now lives) - the indexed-array recombiner's union-type fix and its all-blank-means-null case (api_v3/plugins.py) - scalable / native_size on the font catalog, and the removal of the three font-override stubs (api_v3/fonts.py) Two places took main's version rather than mine, deliberately: - pages_v3 now reads the schema through SchemaManager *and* keeps resolve_under for the raw-read fallback, so the containment guard main added in the CodeQL triage survives. - serve_plugin_widget moves off os.path.basename onto safe_path_component and resolve_under. main dropped `import os` from pages_v3 in favour of those helpers, and they reject a bad component rather than mangling it into a valid-looking one. The url-map snapshot loses exactly the three font-override routes. Edited rather than regenerated: that test exists to catch a route lost by accident during a move, and regenerating it wholesale is how such a loss would be papered over. Verified against a fresh run of current main: same failure set, 4692 passing. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -684,6 +684,38 @@ class BasePlugin(ABC):
|
||||
"""
|
||||
return
|
||||
|
||||
def get_update_interval(self) -> Optional[float]:
|
||||
"""
|
||||
How often this plugin wants update() called, right now, in seconds.
|
||||
|
||||
The manifest's ``update_interval`` is a single static number, which
|
||||
cannot say "poll me every 15 seconds while a game is in progress and
|
||||
every 15 minutes when nothing is on". Only the plugin knows which is
|
||||
true at any moment, so override this to say so.
|
||||
|
||||
Return None (the default) to accept the manifest/config value.
|
||||
|
||||
Two constraints, both because the scheduler calls this on every tick of
|
||||
the render loop:
|
||||
|
||||
- It must be cheap. Attribute reads only -- no config lookups, no I/O,
|
||||
no locks that a fetch might be holding.
|
||||
- It must not raise. A raising hook is ignored and the static interval
|
||||
used, but a hook that raises every tick also logs every tick.
|
||||
|
||||
Values below PluginManager.MIN_DYNAMIC_UPDATE_INTERVAL are clamped up:
|
||||
a plugin asking for 0 would otherwise busy-wait against its own API.
|
||||
|
||||
Example::
|
||||
|
||||
def get_update_interval(self):
|
||||
# Fast while something is actually live, manifest default otherwise.
|
||||
if any(m.live_games for m in self._live_managers):
|
||||
return self.config.get("live_update_interval", 15)
|
||||
return None
|
||||
"""
|
||||
return None
|
||||
|
||||
def has_live_priority(self) -> bool:
|
||||
"""
|
||||
Check if this plugin has live priority enabled.
|
||||
|
||||
Reference in New Issue
Block a user