Files
o2o-weather/watch/watchface/gen_watchface.py

302 lines
20 KiB
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import json, math, os, sys
HERE = os.path.dirname(os.path.abspath(__file__))
# 각 이름 → 아이콘. 시계 런타임이 점수 링 안의 작은 이미지를 그려 주지 않아, 이름을 보고 스킨에 넣은 아이콘을 고른다
GAK_ICONS = [(d["name"], d["icon"]) for d in json.load(open(os.path.join(HERE, "../../backend/seed/index_definition.json"), encoding="utf-8"))]
W = 450
# 해 구슬을 줄이고 조금 내려, 날짜 밑에 축제 줄 자리를 만든다
CX, CY = 225, 252
ORB = 136
RING, RR = 68, 138
CHIP_Y = 366
ANGLES = [210, 330, 150, 30, 180, 0]
APP = "kr.o2o.nalssigak"
INK, ORANGE, SHADE, CARD = "#FF28304A", "#FFFF7A45", "#FFD9E5F4", "#B8FFFFFF"
AMB0 = '<Variant mode="AMBIENT" target="alpha" value="0"/>'
MODES = { # 웹 .b-hero[data-t] 그라데이션, 시간대는 고정 시각 근사
"morning": ("[HOUR_0_23] &gt;= 5 &amp;&amp; [HOUR_0_23] &lt; 11", "#FFFFD9B8 #FFFFE9D4 #FFDFF0FF", "0 0.4 1", INK),
"day": ("[HOUR_0_23] &gt;= 11 &amp;&amp; [HOUR_0_23] &lt; 16", "#FF9FD3FF #FFCFE9FF #FFF1F8FF", "0 0.55 1", INK),
"evening": ("[HOUR_0_23] &gt;= 16 &amp;&amp; [HOUR_0_23] &lt; 21", "#FF8E7CF0 #FFF28AA0 #FFFFC38A", "0 0.48 1", "#FFFFFFFF"),
}
NIGHT = ("#FF141B3D #FF27306A #FF3D3F86", "0 0.6 1", "#FFFFFFFF")
STARS = [(0.22, 0.20), (0.70, 0.14), (0.84, 0.40), (0.14, 0.52), (0.48, 0.10), (0.30, 0.78), (0.76, 0.70)]
def sky(colors, pos):
return f'''<PartDraw x="0" y="0" width="{W}" height="{W}">{AMB0}
<Rectangle x="0" y="0" width="{W}" height="{W}"><Fill color="#FFFFFFFF"><LinearGradient startX="0" startY="0" endX="0" endY="{W}" colors="{colors}" positions="{pos}"/></Fill></Rectangle>
</PartDraw>'''
def clock(color, ambient_visible=False):
alpha = "0" if ambient_visible else "255"
var = '<Variant mode="AMBIENT" target="alpha" value="255"/>' if ambient_visible else AMB0
return f'''<DigitalClock x="0" y="18" width="{W}" height="84">
<TimeText format="h:mm" hourFormat="SYNC_TO_DEVICE" align="CENTER" x="0" y="0" width="{W}" height="84" alpha="{alpha}">{var}
<Font family="bagel_fat_one" size="68" color="{color}"/>
</TimeText>
</DigitalClock>'''
def stars():
dots = "".join(f'<Ellipse x="{int(W*x)}" y="{int(W*y)}" width="5" height="5"><Fill color="#FFFFFFFF"/></Ellipse>' for x, y in STARS)
return f'<PartDraw x="0" y="0" width="{W}" height="{W}">{AMB0}{dots}</PartDraw>'
def cloud(y, w, h, period, phase, color="#FFFFFFFF"):
# 왼쪽 밖에서 들어와 오른쪽 밖으로 빠지고 다시 왼쪽에서 나온다 (끝없이 흐르는 하늘). period 초에 한 번 가로지른다.
# period 는 60 의 약수여야 분이 바뀔 때 튀지 않는다. 저전력 화면에서는 숨긴다
return f'''<PartDraw x="{-w}" y="{y - h}" width="{w}" height="{h * 2}">{AMB0}
<Ellipse x="{int(w * 0.2)}" y="0" width="{int(h * 1.6)}" height="{int(h * 1.6)}"><Fill color="{color}"/></Ellipse>
<RoundRectangle x="0" y="{h}" width="{w}" height="{h}" cornerRadiusX="{h // 2}" cornerRadiusY="{h // 2}"><Fill color="{color}"/></RoundRectangle>
<Transform target="x" value="{W + w} * fract([SECOND_MILLISECOND] / {period} + {phase}) - {w}"/>
</PartDraw>'''
# 구름 줄: 높이, 크기, 가로지르는 초, 시작 위상. 위상을 엇갈려 한쪽에서 빠질 때 다른 줄에서 새 구름이 들어온다
# 시간·날짜 아래로만 지나가게 (흰 글씨 위로 흰 구름이 지나면 안 보인다).
# 스킨은 시스템이 초당 10장 안팎으로만 그려서, 한 장에 1~2px 만 움직이도록 천천히 (빠른 하늘은 앱 첫 장에서 60장으로)
CLOUDS = [(160, 86, 30, 60, 0.0), (160, 64, 22, 60, 0.5), (345, 100, 32, 30, 0.45), (262, 64, 22, 30, 0.8)]
def orb_fill(colors):
blush = "" if colors == MOON else "".join(
f'<Ellipse x="{int(ORB * x - ORB * .08)}" y="{int(ORB * .62)}" width="{int(ORB * .16)}" height="{int(ORB * .09)}"><Fill color="#73FF7A8A"/></Ellipse>' for x in (0.2, 0.8))
return f'''<PartDraw x="{CX - ORB // 2}" y="{CY - ORB // 2}" width="{ORB}" height="{ORB}">{AMB0}
<Ellipse x="0" y="0" width="{ORB}" height="{ORB}"><Fill color="#FFFF8E4E"><RadialGradient centerX="{int(ORB * .34)}" centerY="{int(ORB * .30)}" radius="{int(ORB * .96)}" colors="{colors}" positions="0 0.3 0.68 1"/></Fill></Ellipse>
<Ellipse x="0" y="0" width="{ORB}" height="{ORB}"><Fill color="#00000000"><LinearGradient startX="{int(ORB * .45)}" startY="{int(ORB * .45)}" endX="{ORB}" endY="{ORB}" colors="#00AA3214 #57AA3214" positions="0 1"/></Fill></Ellipse>
{blush}
</PartDraw>'''
SUN = "#FFFFF5CF #FFFFC86E #FFFF8E4E #FFEE6436"
MOON = "#FFFFFFFF #FFD9D3FF #FFA99FEA #FF7F75CC"
def sun_rays():
"""구슬 둘레의 끝이 둥근 햇살 12개. 1분에 한 바퀴"""
size = int(ORB / 0.72)
c, r1, r2 = size / 2, size * 0.4, size * 0.462
lines = "".join(
f'<Line startX="{c + r1 * math.cos(math.radians(a)):.1f}" startY="{c + r1 * math.sin(math.radians(a)):.1f}" endX="{c + r2 * math.cos(math.radians(a)):.1f}" endY="{c + r2 * math.sin(math.radians(a)):.1f}"><Stroke thickness="{size * 0.044:.1f}" color="#FFFFB347" cap="ROUND"/></Line>'
for a in range(0, 360, 30))
return f'''<PartDraw x="{CX - size // 2}" y="{CY - size // 2}" width="{size}" height="{size}">{AMB0}
{lines}
<Transform target="angle" value="360 * fract([SECOND_MILLISECOND] / 60)"/>
</PartDraw>'''
# 비·눈·천둥 때 해 대신 가운데 구름: 몸통, 아래 그늘. 점수가 흰 글씨라 눈구름도 너무 밝지 않게
CLOUD_ORB = {"rain": ("#FF8796B0", "#4D394A66"), "thunder": ("#FF5F6684", "#66232A45"), "snow": ("#FF9FB2D3", "#40394A66")}
def cloud_orb(kind):
"""해 구슬 자리에 몽실한 구름 하나 (봉우리 셋 + 둥근 바닥). 천둥이면 오른쪽 아래로 번개, 5초에 한 번 화면이 번쩍"""
body, shade = CLOUD_ORB[kind]
k = ORB / 136
puffs = [(10, 34, 60), (36, 8, 80), (80, 44, 52)]
shapes = "".join(f'<Ellipse x="{int(x * k)}" y="{int(y * k)}" width="{int(d * k)}" height="{int(d * k)}"><Fill color="{body}"/></Ellipse>' for x, y, d in puffs)
shapes += f'<RoundRectangle x="{int(4 * k)}" y="{int(64 * k)}" width="{int(128 * k)}" height="{int(56 * k)}" cornerRadiusX="{int(28 * k)}" cornerRadiusY="{int(28 * k)}"><Fill color="{body}"/></RoundRectangle>'
shapes += f'<RoundRectangle x="{int(4 * k)}" y="{int(96 * k)}" width="{int(128 * k)}" height="{int(24 * k)}" cornerRadiusX="{int(12 * k)}" cornerRadiusY="{int(12 * k)}"><Fill color="{shade}"/></RoundRectangle>'
shapes += f'<Ellipse x="{int(48 * k)}" y="{int(16 * k)}" width="{int(34 * k)}" height="{int(22 * k)}"><Fill color="#59FFFFFF"/></Ellipse>'
out = f'<PartDraw x="{CX - ORB // 2}" y="{CY - ORB // 2}" width="{ORB}" height="{ORB}">{AMB0}{shapes}</PartDraw>'
if kind == "thunder":
bolt = [(26, 2), (12, 28), (28, 28), (14, 54)]
lines = "".join(f'<Line startX="{a[0]}" startY="{a[1]}" endX="{b[0]}" endY="{b[1]}"><Stroke thickness="7" color="#FFFFD23F" cap="ROUND"/></Line>' for a, b in zip(bolt, bolt[1:]))
out += f'<PartDraw x="{CX + 20}" y="{CY + ORB // 2 - 26}" width="40" height="56">{AMB0}{lines}</PartDraw>'
out += (f'<PartDraw x="0" y="0" width="{W}" height="{W}" alpha="0">{AMB0}<Rectangle x="0" y="0" width="{W}" height="{W}"><Fill color="#FFFFFFFF"/></Rectangle>'
f'<Transform target="alpha" value="fract([SECOND_MILLISECOND] / 5) &lt; 0.04 ? 110 : 0"/></PartDraw>')
return out
NIGHT_EXPR = "[HOUR_0_23] < 5 || [HOUR_0_23] >= 21"
def sun_or_moon():
"""맑을 때(또는 앱 값이 아직 없을 때) 가운데: 밤엔 달빛 구슬, 낮엔 햇살 두른 해"""
return f'<Compare expression="night">{orb_fill(MOON)}</Compare><Default>{sun_rays()}{orb_fill(SUN)}</Default>'
def mode_block(colors, pos, ink, night=False):
parts = [sky(colors, pos)]
if night:
parts.append(stars())
cc = "#FFC9CDF0" if night else "#FFFFFFFF"
parts += [cloud(*c, color=cc) for c in CLOUDS] + [clock(ink), date_line(ink)]
return "\n ".join(parts)
def text(x, y, w, h, family, size, color, expr, amb=False):
return f'''<PartText x="{x}" y="{y}" width="{w}" height="{h}">{AMB0 if amb else ""}
<Text align="CENTER" ellipsis="TRUE"><Font family="{family}" size="{size}" color="{color}"><Template><![CDATA[%s]]><Parameter expression="{expr}"/></Template></Font></Text>
</PartText>'''
def orb_text():
"""해 구슬 위 1위 점수·이름. 날씨 칸 값: 값 = 날씨 코드 × 1000 + 1위 점수, 제목 = 1위 이름 (1위가 없으면 빈 제목)"""
x, y = CX - ORB // 2, CY - ORB // 2
body = (text(x, y + int(ORB * .19), ORB, int(ORB * .45), "bagel_fat_one", 50, "#FFFFFFFF", f"round({VALUE} % 1000)")
+ text(x + 14, y + int(ORB * .62), ORB - 28, 28, "jua", 19, "#FFFFFFFF", "[COMPLICATION.TITLE]"))
return f'''<Condition>
<Expressions><Expression name="ranked"><![CDATA[[COMPLICATION.TITLE] != ""]]></Expression></Expressions>
<Compare expression="ranked">
{body}
</Compare>
</Condition>'''
VALUE = "[COMPLICATION.RANGED_VALUE_VALUE]"
PROGRESS = "clamp([COMPLICATION.RANGED_VALUE_VALUE], [COMPLICATION.RANGED_VALUE_MIN], [COMPLICATION.RANGED_VALUE_MAX]) / ([COMPLICATION.RANGED_VALUE_MAX] - [COMPLICATION.RANGED_VALUE_MIN]) * 360"
def icon_by_title(x, y, size):
exprs = "".join(f'<Expression name="i{n}"><![CDATA[[COMPLICATION.TITLE] == "{name}"]]></Expression>' for n, (name, _) in enumerate(GAK_ICONS))
cmps = "".join(f'<Compare expression="i{n}"><PartImage x="{x}" y="{y}" width="{size}" height="{size}">{AMB0}<Image resource="e_{icon}"/></PartImage></Compare>'
for n, (_, icon) in enumerate(GAK_ICONS))
return f"<Condition><Expressions>{exprs}</Expressions>{cmps}</Condition>"
def ring_slot(i, angle):
r = math.radians(angle)
x = int(CX + RR * math.cos(r) - RING / 2)
y = int(CY + RR * math.sin(r) - RING / 2)
s, a = RING, RING - 6
return f'''<ComplicationSlot slotId="{i + 1}" x="{x}" y="{y}" width="{s}" height="{s}" displayName="slot_ring" supportedTypes="RANGED_VALUE SHORT_TEXT EMPTY" isCustomizable="TRUE">
<DefaultProviderPolicy defaultSystemProvider="EMPTY" defaultSystemProviderType="EMPTY" primaryProvider="{APP}/{APP}.Rank{i + 2}ComplicationService" primaryProviderType="RANGED_VALUE"/>
<BoundingOval x="0" y="0" width="{s}" height="{s}"/>
<Complication type="RANGED_VALUE">
<PartDraw x="0" y="0" width="{s}" height="{s}">{AMB0}
<Ellipse x="0" y="0" width="{s}" height="{s}"><Fill color="{CARD}"/></Ellipse>
</PartDraw>
<PartDraw x="3" y="3" width="{a}" height="{a}">{AMB0}
<Arc centerX="{a / 2}" centerY="{a / 2}" width="{a}" height="{a}" startAngle="0" endAngle="360"><Stroke thickness="5" color="{SHADE}"/></Arc>
<Arc centerX="{a / 2}" centerY="{a / 2}" width="{a}" height="{a}" startAngle="0" endAngle="360"><Stroke thickness="5" color="{ORANGE}" cap="ROUND"/>
<Transform target="endAngle" value="{PROGRESS}"/>
</Arc>
</PartDraw>
{icon_by_title(s // 2 - 14, 9, 28)}
{text(0, 35, s, 24, "bagel_fat_one", 18, INK, "[COMPLICATION.TEXT]", amb=True)}
</Complication>
<Complication type="SHORT_TEXT">
<PartDraw x="0" y="0" width="{s}" height="{s}">{AMB0}
<Ellipse x="0" y="0" width="{s}" height="{s}"><Fill color="{CARD}"/></Ellipse>
</PartDraw>
{text(0, 22, s, 24, "bagel_fat_one", 18, INK, "[COMPLICATION.TEXT]", amb=True)}
</Complication>
<Complication type="EMPTY"/>
</ComplicationSlot>'''
# 기기 언어와 상관없이 한글 요일 ([DAY_OF_WEEK] 1 = 일요일)
WEEKDAY = " : ".join(f'[DAY_OF_WEEK] == {n + 1} ? &quot;{d}&quot;' for n, d in enumerate("일월화수목금")) + " : &quot;토&quot;"
def chip(x, w, icon, expr):
return f'''<PartDraw x="{x}" y="{CHIP_Y}" width="{w}" height="40">{AMB0}
<RoundRectangle x="0" y="0" width="{w}" height="40" cornerRadiusX="20" cornerRadiusY="20"><Fill color="{CARD}"/></RoundRectangle>
<RoundRectangle x="0" y="35" width="{w}" height="5" cornerRadiusX="2" cornerRadiusY="2"><Fill color="#E6D9E5F4"/></RoundRectangle>
</PartDraw>
<PartImage x="{x + 8}" y="{CHIP_Y + 6}" width="26" height="26">{AMB0}<Image resource="e_{icon}"/></PartImage>
{text(x + 32, CHIP_Y + 5, w - 38, 30, "jua", 21, INK, expr, amb=True)}'''
def precip_slot():
"""화면 전체를 덮는 숨은 칸. WFF 는 칸이 8개까지라 날씨와 1위를 이 칸 하나로 받는다.
날씨각 앱(RainComplicationService)이 값 = 날씨 코드 × 1000 + 1위 점수, 글자 = 기온, 제목 = 1위 이름을 준다.
날씨 코드 1(비·곧 비)이면 빗줄기와 비구름, 2(천둥)면 빗줄기와 번개 구름, 3(눈)이면 눈송이와 눈구름을 가운데 해 자리에 그리고,
그 위에 1위 점수·이름, 아래에 기온 칩을 그린다. 날씨 값은 이 칸 안에서만 읽혀서 맑을 때 해·달 구슬도 여기서 그린다.
터치는 가운데 구슬만 받는다(누르면 앱). 주기는 60 의 약수여야 분이 바뀔 때 튀지 않는다."""
import random
r = random.Random(7)
drops, flakes = [], []
for i in range(34):
x, ph = r.randint(0, W), r.random()
period = r.choice([1, 1.2, 1.5])
ln = r.randint(16, 26)
drops.append(f'''<PartDraw x="{x}" y="0" width="8" height="{ln + 2}">{AMB0}
<Line startX="7" startY="1" endX="2" endY="{ln}"><Stroke thickness="2.5" color="#CCEAF2FF" cap="ROUND"/></Line>
<Transform target="y" value="{W + 40} * fract([SECOND_MILLISECOND] / {period} + {ph:.2f}) - 30"/>
</PartDraw>''')
for i in range(26):
x, ph = r.randint(0, W), r.random()
period = r.choice([6, 10, 12])
d = r.randint(5, 10)
flakes.append(f'''<PartDraw x="{x}" y="0" width="{d}" height="{d}">{AMB0}
<Ellipse x="0" y="0" width="{d}" height="{d}"><Fill color="#E6FFFFFF"/></Ellipse>
<Transform target="y" value="{W + 30} * fract([SECOND_MILLISECOND] / {period} + {ph:.2f}) - 15"/>
<Transform target="x" value="{x} + 9 * sin(rad(360 * fract([SECOND_MILLISECOND] / 3 + {ph:.2f})))"/>
</PartDraw>''')
shade = lambda c: f'<PartDraw x="0" y="0" width="{W}" height="{W}">{AMB0}<Rectangle x="0" y="0" width="{W}" height="{W}"><Fill color="{c}"/></Rectangle></PartDraw>'
mode = f"floor({VALUE} / 1000)"
return f'''<ComplicationSlot slotId="7" x="0" y="0" width="{W}" height="{W}" displayName="slot_precip" supportedTypes="RANGED_VALUE EMPTY" isCustomizable="FALSE">
<DefaultProviderPolicy defaultSystemProvider="EMPTY" defaultSystemProviderType="EMPTY" primaryProvider="{APP}/{APP}.RainComplicationService" primaryProviderType="RANGED_VALUE"/>
<BoundingOval x="0" y="0" width="{W}" height="{W}"/>
<Complication type="RANGED_VALUE">
<Condition>
<Expressions>
<Expression name="thunder"><![CDATA[{mode} == 2]]></Expression>
<Expression name="rain"><![CDATA[{mode} == 1]]></Expression>
<Expression name="snow"><![CDATA[{mode} == 3]]></Expression>
<Expression name="night"><![CDATA[{NIGHT_EXPR}]]></Expression>
</Expressions>
<Compare expression="thunder">
{shade("#80394766")}
{"".join(drops)}
{cloud_orb("thunder")}
</Compare>
<Compare expression="rain">
{shade("#66485A78")}
{"".join(drops)}
{cloud_orb("rain")}
</Compare>
<Compare expression="snow">
{shade("#40A0AEC4")}
{"".join(flakes)}
{cloud_orb("snow")}
</Compare>
{sun_or_moon()}
</Condition>
{chip(CX - 52, 104, "thermo", "[COMPLICATION.TEXT]")}
{orb_text()}
</Complication>
<Complication type="EMPTY">
<Condition>
<Expressions><Expression name="night"><![CDATA[{NIGHT_EXPR}]]></Expression></Expressions>
{sun_or_moon()}
</Condition>
</Complication>
</ComplicationSlot>'''
def event_slot():
"""날짜 밑 축제 한 줄. 날씨각 앱(EventComplicationService)이 글자 = 이름, 제목 = 상태를 준다. 행사가 없으면 빈 칸이라 안 그린다.
무엇인지 바로 알게 "주변 축제" 를 앞에 두고 긴 이름만 말줄임"""
x, y, w, h = 123, 124, 204, 30
return f'''<ComplicationSlot slotId="8" x="{x}" y="{y}" width="{w}" height="{h}" displayName="slot_event" supportedTypes="LONG_TEXT EMPTY" isCustomizable="FALSE">
<DefaultProviderPolicy defaultSystemProvider="EMPTY" defaultSystemProviderType="EMPTY" primaryProvider="{APP}/{APP}.EventComplicationService" primaryProviderType="LONG_TEXT"/>
<BoundingOval x="0" y="0" width="{w}" height="{h}"/>
<Complication type="LONG_TEXT">
<PartDraw x="0" y="0" width="{w}" height="{h}">{AMB0}
<RoundRectangle x="0" y="0" width="{w}" height="{h}" cornerRadiusX="{h // 2}" cornerRadiusY="{h // 2}"><Fill color="{CARD}"/></RoundRectangle>
</PartDraw>
<PartText x="8" y="2" width="{w - 16}" height="{h - 4}">{AMB0}
<Text align="CENTER" ellipsis="TRUE"><Font family="jua" size="17" color="{INK}"><Template><![CDATA[🎉 주변 축제: %s]]><Parameter expression="[COMPLICATION.TEXT]"/></Template></Font></Text>
</PartText>
</Complication>
<Complication type="EMPTY"/>
</ComplicationSlot>'''
def date_line(ink):
return f'''<PartText x="0" y="92" width="{W}" height="30">{AMB0}
<Text align="CENTER"><Font family="jua" size="23" color="{ink}"><Template><![CDATA[%d월 %d일 %s요일]]><Parameter expression="[MONTH]"/><Parameter expression="[DAY]"/><Parameter expression="{WEEKDAY}"/></Template></Font></Text>
</PartText>'''
exprs = "\n ".join(f'<Expression name="{k}"><![CDATA[{v[0].replace("&gt;", ">").replace("&lt;", "<").replace("&amp;", "&")}]]></Expression>' for k, v in MODES.items())
compares = "\n ".join(f'<Compare expression="{k}">\n {mode_block(v[1], v[2], v[3])}\n </Compare>' for k, v in MODES.items())
xml = f'''<?xml version="1.0" encoding="UTF-8"?>
<!-- 날씨각 워치 스킨: 시간대 하늘, 해 구슬(1위, 비·눈·천둥이면 구름), 둘레 링(2~7위), 날짜 밑 근처 축제 한 줄, 아래 기온 칩. 링을 누르면 앱이 그 각 상세로 열린다. 점수는 날씨각 앱의 RankNComplicationService 가 공급한다.
직접 고치지 말고 watch/watchface/gen_watchface.py 를 고친 뒤 다시 만든다: python3 gen_watchface.py src/main/res/raw/watchface.xml -->
<WatchFace width="{W}" height="{W}">
<Metadata key="CLOCK_TYPE" value="DIGITAL"/>
<Metadata key="PREVIEW_TIME" value="11:52:00"/>
<Scene backgroundColor="#FF000000">
<!-- ponytail: 시간대는 고정 시각(5·11·16·21시)으로 근사. 일몰 기준으로 바꾸려면 앱이 공급하는 값으로 -->
<Condition>
<Expressions>
{exprs}
</Expressions>
{compares}
<Default>
{mode_block(NIGHT[0], NIGHT[1], NIGHT[2], night=True)}
</Default>
</Condition>
<!-- 주의: 칸(ComplicationSlot) 순서·slotId 를 바꿔 덮어 설치하면 기존 기기에서 공급원이 한 칸씩 밀린다 (에뮬레이터에서 확인). 새 칸은 맨 뒤에 붙인다 -->
<!-- 가운데 해·달·구름은 날씨 칸 안에서 비 막 위에 그린다 -->
{precip_slot()}
{clock("#FFFFFFFF", ambient_visible=True)}
{"".join(ring_slot(i, a) for i, a in enumerate(ANGLES))}
{event_slot()}
</Scene>
</WatchFace>
'''
open(sys.argv[1], "w").write(xml)