feat(project): PC tray notifier for mentions and assignments
Windows tray app (desktop/notifier, C# .NET Framework 4.8 WinForms, single exe, no installer/admin) that shows the same big alert popup as the web even when the browser is in the background: layered topmost window that does not steal focus, blinking border, open/close actions, sound, autostart toggle, DPAPI-encrypted token. Server side (project_db migration 023): - notifier_links / notifier_tokens (SHA-256 hashes only) - device link flow: link/start -> browser approve at /project/notifier -> link/poll issues token once - Bearer API for alerts/read/logout reusing _alerts_payload; token re-checks current user record and project permission each call - /project/notifier page (approve, connected PCs, revoke, download) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,68 @@
|
||||
"""app.ico 생성 — 보라(#7b68ee) 둥근 사각형 위 흰 종(울리는 표시). 크기별로 따로 그려 작은 트레이 크기도 또렷하게.
|
||||
|
||||
사용: python desktop/notifier/tools/make_icon.py (Pillow 필요) → desktop/notifier/app.ico
|
||||
"""
|
||||
from pathlib import Path
|
||||
|
||||
from PIL import Image, ImageDraw
|
||||
|
||||
SIZES = [16, 20, 24, 32, 40, 48, 64, 128, 256]
|
||||
SS = 8 # 슈퍼샘플링 배율
|
||||
|
||||
|
||||
def bezier(p0, p1, p2, p3, n=24):
|
||||
out = []
|
||||
for i in range(n + 1):
|
||||
t = i / n
|
||||
a = (1 - t) ** 3
|
||||
b = 3 * (1 - t) ** 2 * t
|
||||
c = 3 * (1 - t) * t ** 2
|
||||
d = t ** 3
|
||||
out.append((a * p0[0] + b * p1[0] + c * p2[0] + d * p3[0], a * p0[1] + b * p1[1] + c * p2[1] + d * p3[1]))
|
||||
return out
|
||||
|
||||
|
||||
def draw(size: int) -> Image.Image:
|
||||
big = size * SS
|
||||
k = big / 24.0 # 24 단위 격자
|
||||
img = Image.new("RGBA", (big, big), (0, 0, 0, 0))
|
||||
g = ImageDraw.Draw(img)
|
||||
g.rounded_rectangle([0, 0, big - 1, big - 1], radius=int(5.5 * k), fill=(123, 104, 238, 255))
|
||||
white = (255, 255, 255, 255)
|
||||
small = size <= 20 # 아주 작은 크기는 종을 크게, 울림 표시는 생략
|
||||
|
||||
def P(x, y):
|
||||
# 종 중심을 (12, 12.5) 기준으로 확대
|
||||
s = 1.12 if small else 0.92
|
||||
return ((12 + (x - 12) * s) * k, (12.6 + (y - 12) * s) * k)
|
||||
|
||||
body = [P(5, 17), P(6.6, 15.2), P(6.6, 10.6)]
|
||||
body += [P(*q) for q in bezier((6.6, 10.6), (6.6, 7.2), (9.0, 4.9), (12, 4.9))[1:]]
|
||||
body += [P(*q) for q in bezier((12, 4.9), (15.0, 4.9), (17.4, 7.2), (17.4, 10.6))[1:]]
|
||||
body += [P(17.4, 15.2), P(19, 17)]
|
||||
g.polygon(body, fill=white)
|
||||
cx, cy = P(12, 18.6)
|
||||
r = 1.9 * k * (1.12 if small else 0.92)
|
||||
g.ellipse([cx - r, cy - r, cx + r, cy + r], fill=white)
|
||||
kx, ky = P(12, 4.4)
|
||||
r2 = 1.1 * k * (1.12 if small else 0.92)
|
||||
g.ellipse([kx - r2, ky - r2, kx + r2, ky + r2], fill=white)
|
||||
if not small:
|
||||
w = max(1, int(1.5 * k))
|
||||
c = P(12, 10.6)
|
||||
rr = 9.6 * 0.92 * k
|
||||
box = [c[0] - rr, c[1] - rr, c[0] + rr, c[1] + rr]
|
||||
g.arc(box, 198, 238, fill=white, width=w)
|
||||
g.arc(box, 302, 342, fill=white, width=w)
|
||||
return img.resize((size, size), Image.LANCZOS)
|
||||
|
||||
|
||||
def main() -> None:
|
||||
out = Path(__file__).resolve().parents[1] / "app.ico"
|
||||
imgs = [draw(s) for s in SIZES]
|
||||
imgs[-1].save(out, format="ICO", sizes=[(s, s) for s in SIZES], append_images=imgs[:-1])
|
||||
print(out)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user