feat: 今日实时 0% 画等号+金额小号 ¥/万,数值与状态栏数字加粗
- 环比/同比增长率恰为 0 时方向记 flat,三角位画等号(与用量行 pace 持平一致) - 金额拆为「¥ / 主数字 / 万」三段,¥ 与 万 用 F12 小号伪粗体、与 F24 主数字基线对齐;单量列不变 - 环比/同比数值、BTC 涨跌幅、顶部电量/温度/湿度数字改 F12 伪粗体(字号不变),占位 -- 不加粗 - 等号绘制抽为基类 _eq 供 pace 与环比/同比共用;网页版 flat 同样输出等号 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
@@ -96,7 +96,7 @@ class E1002Renderer(DashboardRenderer):
|
||||
|
||||
# ---------- 组件 ----------
|
||||
def _status_battery(self, x, cy, dev):
|
||||
"""状态项·电池(F12,墨迹中心 cy):外框 16×9 + 正极 2×4,内部按电量实心填充——充电中 GREEN、≤20% RED、其余 BLACK;
|
||||
"""状态项·电池(F12,数字伪粗体,墨迹中心 cy):外框 16×9 + 正极 2×4,内部按电量实心填充——充电中 GREEN、≤20% RED、其余 BLACK;
|
||||
右侧电量数字,缺失 "--"。返回末端 x。"""
|
||||
F, GAP_I = self.F12, 5
|
||||
lvl, chg = (dev or {}).get("battery"), (dev or {}).get("charging")
|
||||
@@ -109,11 +109,12 @@ class E1002Renderer(DashboardRenderer):
|
||||
self.d.rectangle([x + 2, cy - 2, x + 2 + fw, cy + 2], fill=fill)
|
||||
x += 18 + GAP_I
|
||||
txt = f"{lvl}%" if lvl is not None else "--"
|
||||
self._mid(x, cy, txt, F)
|
||||
return x + self._tw(txt, F)
|
||||
b = 1 if lvl is not None else 0 # 数字伪粗体、字号不变(2026-09-14 用户要求);占位不加粗
|
||||
self._mid(x, cy, txt, F, bold=b)
|
||||
return x + self._tw(txt, F) + b
|
||||
|
||||
def _status_env(self, x, cy, dev):
|
||||
"""状态项·环境(F12,墨迹中心 cy):温度计(细管 3×8 + 底部球 7×7,管内水银线)+温度 | 蓝色水滴(上尖下圆)+湿度,
|
||||
"""状态项·环境(F12,数字伪粗体,墨迹中心 cy):温度计(细管 3×8 + 底部球 7×7,管内水银线)+温度 | 蓝色水滴(上尖下圆)+湿度,
|
||||
项间距 16、图标↔数字 5;缺失 "--"。返回末端 x。"""
|
||||
F, GAP_I, GAP = self.F12, 5, 16
|
||||
dev = dev or {}
|
||||
@@ -123,14 +124,16 @@ class E1002Renderer(DashboardRenderer):
|
||||
x += 7 + GAP_I
|
||||
t = dev.get("temp")
|
||||
txt = f"{t:.1f}℃" if t is not None else "--"
|
||||
self._mid(x, cy, txt, F); x += self._tw(txt, F) + GAP
|
||||
b = 1 if t is not None else 0 # 数字伪粗体、字号不变(2026-09-14 用户要求);占位不加粗
|
||||
self._mid(x, cy, txt, F, bold=b); x += self._tw(txt, F) + b + GAP
|
||||
self.d.polygon([(x + 4, cy - 6), (x, cy + 2), (x + 8, cy + 2)], fill=BLUE)
|
||||
self.d.ellipse([x, cy - 1, x + 8, cy + 6], fill=BLUE)
|
||||
x += 9 + GAP_I
|
||||
h = dev.get("humidity")
|
||||
txt = f"{h:.0f}%" if h is not None else "--"
|
||||
self._mid(x, cy, txt, F)
|
||||
return x + self._tw(txt, F)
|
||||
b = 1 if h is not None else 0
|
||||
self._mid(x, cy, txt, F, bold=b)
|
||||
return x + self._tw(txt, F) + b
|
||||
|
||||
def _color_strip(self, y0, y1, x0=None, x1=None):
|
||||
"""六色测试色条:六块等宽实心色块,白块加 1px 黑框以便可见。真机校准用。"""
|
||||
@@ -210,7 +213,7 @@ class E1002Renderer(DashboardRenderer):
|
||||
for i, c in enumerate(cols):
|
||||
cx = x0 + cw * (i + 0.5)
|
||||
self.ctext(cx, TAG_Y, c["k"], self.F12)
|
||||
self.ctext(cx, VAL_Y, c["v"], self.F24, bold=1)
|
||||
self._value(cx, VAL_Y, c, bold=1) # F24 粗主数字 + 小号 ¥ / 万
|
||||
self._cmp_line(cx, HB_Y, "环比", c["hb"])
|
||||
self._cmp_line(cx, TB_Y, "同比", c["tb"])
|
||||
return y0 + 104
|
||||
@@ -236,7 +239,7 @@ class E1002Renderer(DashboardRenderer):
|
||||
col = GREEN if chg >= 0 else RED
|
||||
xr = x1
|
||||
pct_txt = f"{abs(chg):.2f}%"
|
||||
self.rtext(xr, y0, pct_txt, self.F12, fill=col); xr -= self._tw(pct_txt, self.F12) + 4
|
||||
self.rtext(xr, y0, pct_txt, self.F12, fill=col, bold=1); xr -= self._tw(pct_txt, self.F12) + 1 + 4 # 涨跌幅伪粗体(+1 为粗体偏移)
|
||||
self.tri(xr - 4, y0 + 8.5, 7, up=chg >= 0, fill=col); xr -= 8 + 6
|
||||
if btc.get("chg_label"): # 涨跌幅口径(24h / 1d)
|
||||
self.rtext(xr, y0, btc["chg_label"], self.F12); xr -= self._tw(btc["chg_label"], self.F12) + 10
|
||||
|
||||
Reference in New Issue
Block a user