Replace PM3 compile-from-source in pi-gen with pre-built tarball extraction (saves 43-58 min). Merge stagePM3 into stageDangerousPi as 02-pm3-install substage, renumber all subsequent substages. Switch CI PM3 build to native ARM64 runner (ubuntu-24.04-arm64) eliminating QEMU overhead. Add weekly base-image workflow for pre-baking stages 0-2. Support PM3_TARBALL, BASE_IMAGE, and APT_PROXY env vars in build-image.sh. Also includes prior Phase 5 work: theme system, design system integration, component update system, OS updates, CI build pipeline, and test results. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
69 lines
2.3 KiB
Python
69 lines
2.3 KiB
Python
"""VivoKey Supra Theme plugin for Dangerous Pi.
|
|
|
|
Registers the Supra theme (Material Design 3 with VivoKey blue, rounded
|
|
corners, elevation shadows) via the theme_register hook so it appears in
|
|
Settings > Appearance when this plugin is enabled.
|
|
"""
|
|
import shutil
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
_plugin_manager_module = (
|
|
sys.modules.get('app.backend.managers.plugin_manager') or
|
|
sys.modules.get('backend.managers.plugin_manager')
|
|
)
|
|
if _plugin_manager_module:
|
|
PluginBase = _plugin_manager_module.PluginBase
|
|
PluginMetadata = _plugin_manager_module.PluginMetadata
|
|
else:
|
|
from pathlib import Path as _P
|
|
app_path = _P(__file__).parent.parent.parent
|
|
if str(app_path) not in sys.path:
|
|
sys.path.insert(0, str(app_path))
|
|
from backend.managers.plugin_manager import PluginBase, PluginMetadata
|
|
|
|
# Paths
|
|
_PLUGIN_DIR = Path(__file__).parent
|
|
_STATIC_CSS = _PLUGIN_DIR / "static" / "tokens.css"
|
|
|
|
# Where the frontend serves themes from
|
|
_THEMES_DIR = _PLUGIN_DIR.parent.parent / "frontend" / "themes" / "supra"
|
|
|
|
|
|
class SupraThemePlugin(PluginBase):
|
|
"""Provides the VivoKey Supra theme to Dangerous Pi."""
|
|
|
|
async def on_load(self):
|
|
pass
|
|
|
|
async def on_enable(self):
|
|
# Copy CSS to the themes directory so it's served by the /themes mount
|
|
_THEMES_DIR.mkdir(parents=True, exist_ok=True)
|
|
shutil.copy2(_STATIC_CSS, _THEMES_DIR / "tokens.css")
|
|
|
|
# Register the theme via the theme_register hook.
|
|
# MUST be synchronous — the theme scanner skips async callbacks.
|
|
def supra_theme_register():
|
|
return {
|
|
"id": "supra",
|
|
"name": "VivoKey Supra",
|
|
"description": "Material Design 3 with VivoKey blue, rounded corners, elevation shadows",
|
|
"supportsModes": ["dark", "light", "auto"],
|
|
"defaultMode": "dark",
|
|
"author": "Dangerous Things",
|
|
"css_url": "/themes/supra/tokens.css",
|
|
}
|
|
|
|
self.register_hook("theme_register", supra_theme_register)
|
|
|
|
async def on_disable(self):
|
|
# Clean up the copied theme files
|
|
if _THEMES_DIR.exists():
|
|
shutil.rmtree(_THEMES_DIR, ignore_errors=True)
|
|
|
|
async def on_unload(self):
|
|
pass
|
|
|
|
def get_metadata(self) -> PluginMetadata:
|
|
return self.metadata
|