feat: 워치에 주변 축제 표시 (앱 축제 장, 스킨 날짜 밑 한 줄)
- /v1/watch/summary 에 events 2개: 진행 중 먼저, 이름 앞 [주최] 괄호 제거, 4초 넘으면 축제만 빼고 응답 - 앱: 내 각 다음에 근처 축제 장 (이름 · 상태 · 장소와 그날 날씨) - 스킨: 날짜 밑 "🎉 주변 축제 · 이름" 한 줄 (EventComplicationService, LONG_TEXT, 행사 없으면 숨김) - 스킨 배치: 해 구슬 162→136, 해·링 묶음 24px 아래로, 기온·비 칩 y 366 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
a6a738ae61
commit
b4d028a91b
10 files changed
+208
-46
No files matched your search
@@ -3,9 +3,11 @@ 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, 235
|
||||
ORB = 162
|
||||
RING, RR = 68, 148
|
||||
# 해 구슬을 줄이고 조금 내려, 날짜 밑에 축제 줄 자리를 만든다
|
||||
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"
|
||||
@@ -90,7 +92,7 @@ def text(x, y, w, h, family, size, color, expr, amb=False):
|
||||
|
||||
def orb_slot():
|
||||
x, y = CX - ORB // 2, CY - ORB // 2
|
||||
body = text(0, 30, ORB, 74, "bagel_fat_one", 58, "#FFFFFFFF", "[COMPLICATION.TEXT]") + text(14, 100, ORB - 28, 30, "jua", 21, "#FFFFFFFF", "[COMPLICATION.TITLE]")
|
||||
body = text(0, int(ORB * .19), ORB, int(ORB * .45), "bagel_fat_one", 50, "#FFFFFFFF", "[COMPLICATION.TEXT]") + text(14, int(ORB * .62), ORB - 28, 28, "jua", 19, "#FFFFFFFF", "[COMPLICATION.TITLE]")
|
||||
return f'''<ComplicationSlot slotId="0" x="{x}" y="{y}" width="{ORB}" height="{ORB}" displayName="slot_rank1" supportedTypes="RANGED_VALUE SHORT_TEXT EMPTY" isCustomizable="TRUE">
|
||||
<DefaultProviderPolicy defaultSystemProvider="EMPTY" defaultSystemProviderType="EMPTY" primaryProvider="{APP}/{APP}.Rank1ComplicationService" primaryProviderType="RANGED_VALUE"/>
|
||||
<BoundingOval x="0" y="0" width="{ORB}" height="{ORB}"/>
|
||||
@@ -145,12 +147,12 @@ def ring_slot(i, angle):
|
||||
WEEKDAY = " : ".join(f'[DAY_OF_WEEK] == {n + 1} ? "{d}"' for n, d in enumerate("일월화수목금")) + " : "토""
|
||||
|
||||
def chip(x, w, icon, expr):
|
||||
return f'''<PartDraw x="{x}" y="364" width="{w}" height="40">{AMB0}
|
||||
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="370" width="26" height="26">{AMB0}<Image resource="e_{icon}"/></PartImage>
|
||||
{text(x + 32, 369, w - 38, 30, "jua", 21, INK, expr, amb=True)}'''
|
||||
<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():
|
||||
"""화면 전체를 덮는 숨은 칸. 날씨각 앱(RainComplicationService)이 글자 = 기온, 제목 = 비 소식을 주면
|
||||
@@ -201,6 +203,24 @@ def precip_slot():
|
||||
<Complication type="EMPTY"/>
|
||||
</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>
|
||||
@@ -210,7 +230,7 @@ exprs = "\n ".join(f'<Expression name="{k}"><![CDATA[{v[0].replace(">
|
||||
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 가 공급한다.
|
||||
<!-- 날씨각 워치 스킨: 시간대 하늘, 해 구슬(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"/>
|
||||
@@ -237,6 +257,7 @@ xml = f'''<?xml version="1.0" encoding="UTF-8"?>
|
||||
{clock("#FFFFFFFF", ambient_visible=True)}
|
||||
{orb_slot()}
|
||||
{"".join(ring_slot(i, a) for i, a in enumerate(ANGLES))}
|
||||
{event_slot()}
|
||||
</Scene>
|
||||
</WatchFace>
|
||||
'''
|
||||
|
||||
Reference in new issue
Block a user