harbour-server 0.1.0: schermata parametri server (schema status/1)
Prima release dell'app Sailfish: schermata unica con CPU, memoria, disco, container, backup, servizi, SSH, aggiornamenti e VPN, letti da un endpoint read-only /v1/status. Soglie giallo/rosso, aggiornamento ogni 60 s, copertina, impostazioni con indirizzo e token.
This commit is contained in:
commit
24e1f3b376
20 files changed
+1112
No files matched your search
@@ -0,0 +1,59 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Genera le icone di harbour-server (86/108/128/172 px).
|
||||
|
||||
Motivo: piastrina scura con una traccia "battito" verde — lo stesso segno
|
||||
che l'app mostra quando tutto è in ordine.
|
||||
"""
|
||||
from pathlib import Path
|
||||
|
||||
from PIL import Image, ImageDraw
|
||||
|
||||
ROOT = Path(__file__).resolve().parent.parent
|
||||
SIZES = (86, 108, 128, 172)
|
||||
BG = (20, 24, 28)
|
||||
TRACE = (67, 160, 71)
|
||||
DIM = (110, 120, 128)
|
||||
|
||||
# Traccia in coordinate 0..100 (x, y): parte piatta, picco, coda piatta.
|
||||
TRACE_POINTS = [
|
||||
(6, 52), (30, 52), (38, 30), (46, 74), (54, 44), (62, 52), (94, 52),
|
||||
]
|
||||
|
||||
|
||||
def draw(size: int) -> Image.Image:
|
||||
scale = 4 # disegno in grande e riduco: linee pulite anche a 86 px
|
||||
S = size * scale
|
||||
img = Image.new("RGBA", (S, S), (0, 0, 0, 0))
|
||||
d = ImageDraw.Draw(img)
|
||||
|
||||
radius = int(S * 0.22)
|
||||
d.rounded_rectangle([0, 0, S - 1, S - 1], radius=radius, fill=BG)
|
||||
|
||||
pts = [(int(x * S / 100), int(y * S / 100)) for x, y in TRACE_POINTS]
|
||||
width = max(2, int(S * 0.045))
|
||||
d.line(pts, fill=TRACE, width=width, joint="curve")
|
||||
|
||||
# Tre tacche in basso: i "parametri" sotto la traccia.
|
||||
for i, x in enumerate((22, 50, 78)):
|
||||
y0 = int(S * 0.78)
|
||||
h = int(S * (0.10 + 0.04 * i))
|
||||
d.rounded_rectangle(
|
||||
[int(x * S / 100) - width, y0 - h, int(x * S / 100) + width, y0],
|
||||
radius=width,
|
||||
fill=DIM,
|
||||
)
|
||||
|
||||
return img.resize((size, size), Image.LANCZOS)
|
||||
|
||||
|
||||
def main() -> None:
|
||||
for size in SIZES:
|
||||
out = ROOT / "icons" / f"{size}x{size}"
|
||||
out.mkdir(parents=True, exist_ok=True)
|
||||
path = out / "harbour-server.png"
|
||||
draw(size).save(path)
|
||||
print("scritto", path)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in new issue
Block a user