docs: README, Abnahmeprotokoll, Brand-Bilder; Gitea statt GitHub/HACS
This commit is contained in:
Executable
+9
@@ -0,0 +1,9 @@
|
||||
#!/usr/bin/env bash
|
||||
# Local replacement for CI: the repo lives in a private Gitea without Actions.
|
||||
set -euo pipefail
|
||||
cd "$(dirname "$0")/.."
|
||||
.venv/bin/ruff check .
|
||||
.venv/bin/ruff format --check .
|
||||
.venv/bin/pytest -q --cov --cov-report=term-missing
|
||||
.venv/bin/python scripts/check_translations.py
|
||||
echo "check.sh: alles gruen"
|
||||
@@ -0,0 +1,35 @@
|
||||
"""strings.json and translations/en.json must be identical; de.json must have the same keys."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
from pathlib import Path
|
||||
import sys
|
||||
|
||||
BASE = Path(__file__).parents[1] / "custom_components" / "ninlight"
|
||||
|
||||
|
||||
def keys(data: dict, prefix: str = "") -> set[str]:
|
||||
out: set[str] = set()
|
||||
for key, value in data.items():
|
||||
out |= keys(value, f"{prefix}{key}.") if isinstance(value, dict) else {f"{prefix}{key}"}
|
||||
return out
|
||||
|
||||
|
||||
def main() -> int:
|
||||
strings = json.loads((BASE / "strings.json").read_text(encoding="utf-8"))
|
||||
en = json.loads((BASE / "translations" / "en.json").read_text(encoding="utf-8"))
|
||||
de = json.loads((BASE / "translations" / "de.json").read_text(encoding="utf-8"))
|
||||
if strings != en:
|
||||
print("translations/en.json weicht von strings.json ab")
|
||||
return 1
|
||||
diff = sorted(keys(strings) ^ keys(de))
|
||||
if diff:
|
||||
print("de.json und strings.json haben unterschiedliche Schluessel:", diff)
|
||||
return 1
|
||||
print("Uebersetzungen vollstaendig")
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
@@ -0,0 +1,39 @@
|
||||
"""Generate the brand images HA serves from custom_components/ninlight/brand/ (HA >= 2026.3)."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
from PIL import Image, ImageDraw
|
||||
|
||||
OUT = Path(__file__).parents[1] / "custom_components" / "ninlight" / "brand"
|
||||
AMBER = (255, 176, 46, 255)
|
||||
DARK = (38, 38, 46, 255)
|
||||
|
||||
|
||||
def bulb(size: int) -> Image.Image:
|
||||
image = Image.new("RGBA", (size, size), (0, 0, 0, 0))
|
||||
draw = ImageDraw.Draw(image)
|
||||
s = size / 256
|
||||
draw.ellipse((56 * s, 24 * s, 200 * s, 168 * s), fill=AMBER)
|
||||
draw.rounded_rectangle((92 * s, 150 * s, 164 * s, 204 * s), radius=10 * s, fill=AMBER)
|
||||
for y in (206, 222):
|
||||
draw.rounded_rectangle((96 * s, y * s, 160 * s, (y + 10) * s), radius=5 * s, fill=DARK)
|
||||
draw.rounded_rectangle((112 * s, 236 * s, 144 * s, 246 * s), radius=5 * s, fill=DARK)
|
||||
return image
|
||||
|
||||
|
||||
def main() -> None:
|
||||
OUT.mkdir(parents=True, exist_ok=True)
|
||||
for name, size in (
|
||||
("icon.png", 256),
|
||||
("icon@2x.png", 512),
|
||||
("logo.png", 256),
|
||||
("logo@2x.png", 512),
|
||||
):
|
||||
bulb(size).save(OUT / name)
|
||||
print(OUT / name)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user