32 lines
853 B
Python
32 lines
853 B
Python
|
|
#!/usr/bin/env python3
|
||
|
|
"""Erzeugt das Windows-Installer-Icon aus dem App-Icon.
|
||
|
|
|
||
|
|
Aufruf:
|
||
|
|
python3 tools/make_windows_icon.py
|
||
|
|
|
||
|
|
Quelle: rinkplanner/assets/icons/app_icon.png
|
||
|
|
Ziel: build/windows/rinkplanner.ico
|
||
|
|
"""
|
||
|
|
|
||
|
|
from pathlib import Path
|
||
|
|
|
||
|
|
from PIL import Image
|
||
|
|
|
||
|
|
REPO = Path(__file__).resolve().parent.parent
|
||
|
|
SOURCE = REPO / "rinkplanner" / "assets" / "icons" / "app_icon.png"
|
||
|
|
TARGET = REPO / "build" / "windows" / "rinkplanner.ico"
|
||
|
|
SIZES = [(16, 16), (24, 24), (32, 32), (48, 48), (64, 64), (128, 128), (256, 256)]
|
||
|
|
|
||
|
|
|
||
|
|
def main() -> None:
|
||
|
|
if not SOURCE.exists():
|
||
|
|
raise SystemExit(f"App-Icon nicht gefunden: {SOURCE}")
|
||
|
|
image = Image.open(SOURCE).convert("RGBA")
|
||
|
|
TARGET.parent.mkdir(parents=True, exist_ok=True)
|
||
|
|
image.save(TARGET, format="ICO", sizes=SIZES)
|
||
|
|
print(f"Icon: {TARGET}")
|
||
|
|
|
||
|
|
|
||
|
|
if __name__ == "__main__":
|
||
|
|
main()
|