feat: E1002 右上角天气改「城市天气|图标|F72 大号温度」

- 实时温度改 F72 粗 3(先做过 F84 与时钟同高被嫌大),与时钟同基线、右贴页边
- 「°」不用大字号(F84 下 35px 宽且比数字高 7px),改 F36 粗 2 作上标,顶沿对齐数字顶沿、补回字形右侧空白使墨迹贴页边
- 定位+城市 / 天气·温区两行左缘对齐、底行与时钟同基线,天气图标居中放在两行与温度之间
- 此前为「城市 / F24 温度 / 天气·温区」三行右对齐+图标在左

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
2026-09-14 17:56:27 +08:00
parent 3656d8d933
commit cf9aa3b1bb
2 changed files with 30 additions and 11 deletions

View File

@@ -7,6 +7,7 @@ reTerminal E1002 渲染层 —— 复用 renderer.DashboardRenderer 的组件(
版式k=1点阵字体且**只用整数倍字号 12/24/36/48/84**,不放大;四段,三道横规):
A 顶部090 **大时钟 F84**(墨迹 1679 其右一列三行、左缘对齐:① 电池图标+电量 ② 温度计+温度 水滴+湿度 ③ 星期/日期
右侧:两行(定位+城市 / 天气·温区,底行与时钟同基线)| 天气图标 **实时温度 F72**比时钟小一号、同基线、「°」F36 上标、右贴页边)
F12行距 22日期与时钟数字**基线对齐**;设备数据来自 SenseCraft 遥测 `data.device`2026-09-14 定稿,
此前「状态栏横排在时钟上方+时钟缩 F60」版被否
|天气(右,贴 790——天气组件与三色版同尺寸。
@@ -64,6 +65,7 @@ class E1002Renderer(DashboardRenderer):
self.F16 = self.F13
self.FPACE = self.F13
self.F84 = ImageFont.truetype(font_path, 84)
self.F72 = ImageFont.truetype(font_path, 72) # 6 倍整数缩放右上角实时温度比时钟小一号2026-09-14 用户要求)
# ---------- 配色钩子(三档,顺序固定 绿 → 黑 → 红;用量与 pace 各自独立计算)----------
_ok, _pace_tol = _cfg.USAGE_OK, _cfg.PACE_TOL # 由 _usage_block 按数据覆盖
@@ -292,7 +294,8 @@ class E1002Renderer(DashboardRenderer):
dt, wt, mao = data["date"], data["weather"], data["mao"]
usage, gpt = data["usage"], data.get("usage_gpt") or {}
# ---- A. 顶部:大时钟 F84 占满整段(左);其右一列三行、左缘与日期对齐:① 电池 ② 温度+湿度 ③ 星期/日期(与时钟基线对齐)/ 天气(右)----
# ---- A. 顶部:大时钟 F84 占满整段(左);其右一列三行、左缘与日期对齐:① 电池 ② 温度+湿度 ③ 星期/日期(与时钟基线对齐)
# 天气(右):两行(定位+城市 / 天气·温区,底行同基线)| 图标 温度 F72 右贴页边 ----
DIV_Y = 90
TIME_BOLD, INK_TOP = 3, 16 # 伪粗体 3px墨迹顶沿 16底沿 79F84 数字墨迹高 63
_, tt, _, tb = self.F84.getbbox(dt["time"])
@@ -310,18 +313,34 @@ class E1002Renderer(DashboardRenderer):
dev = data.get("device")
self._status_battery(col_x, cy_date - 2 * PITCH, dev)
self._status_env(col_x, cy_date - PITCH, dev)
# 天气2026-09-14 用户要求)从左到右:两行信息(左缘对齐:① 定位水滴+城市 ② 天气·温区,底行与时钟同基线)| 天气图标(竖直居中)
# 实时温度 F72比时钟小一号与时钟同粗、同基线 79数字墨迹 2579右贴页边 R。曾试过 F84 与时钟同高,被嫌大。
loc, temp, cr = wt["loc"], wt["temp"], f'{wt["cond"]} {wt["range"]}'
self.rtext(R, 8, loc, self.F12)
self.rtext(R, 30, temp, self.F24, bold=1)
self.rtext(R, 64, cr, self.F12)
PIN_W, PIN_GAP = 8, 6
loc_pin_x = R - self._tw(loc, self.F12) - PIN_GAP - PIN_W
self._loc_pin(loc_pin_x, 10, PIN_W, fg=RED)
# 度数符号不用大字号F84 下 35px 宽且比数字高 7px「°」F36 粗 2 作上标,墨迹顶沿对齐数字顶沿
FT = self.F72
has_deg = temp.endswith("°")
digits = temp[:-1] if has_deg else temp
DEG_BOLD, DEG_GAP = 2, 2
deg_w = self._tw_b("°", self.F36, DEG_BOLD) + DEG_GAP if has_deg else 0
_, tdt, _, tdb = FT.getbbox(digits)
temp_x = R - deg_w - self._tw_b(digits, FT, TIME_BOLD)
temp_y = base_y - tdb # 数字底沿与时钟基线对齐
self.text(temp_x, temp_y, digits, FT, bold=TIME_BOLD)
if has_deg:
rb = self.F36.getlength("°") - self.F36.getmask("°").getbbox()[2] # 字形右侧空白 3px补回使墨迹右缘贴 R
self.rtext(R + rb, temp_y + tdt - self.F36.getbbox("°")[1], "°", self.F36, bold=DEG_BOLD)
s = 1.5
iw, ih = 36 * s, 38 * s
text_left = min(loc_pin_x, R - self._tw(temp, self.F24) - 1, R - self._tw(cr, self.F12))
self._weather_icon(text_left - 12 - iw, (DIV_Y - ih) / 2,
icon_x = temp_x - 14 - iw
self._weather_icon(icon_x, (DIV_Y - ih) / 2,
self._weather_category(wt.get("icon")), s=s, accent=RED, wet=BLUE)
PIN_W, PIN_GAP = 8, 6
col_w = max(PIN_W + PIN_GAP + self._tw(loc, self.F12), self._tw(cr, self.F12))
col_x = icon_x - 12 - col_w
self.text(col_x, date_y, cr, self.F12) # 底行:天气·温区,与日期同基线
loc_y = date_y - PITCH
self._loc_pin(col_x, loc_y + 2, PIN_W, fg=RED)
self.text(col_x + PIN_W + PIN_GAP, loc_y, loc, self.F12)
self.hdash(8, self.W - 8, DIV_Y)
# ---- B. 用量:左 Claude 右 Codex紧凑单行与三色版同款----