feat: E1002 六色版改版为 AI 用量看板+Claude 用量新增 Fable 7d 行与重置时刻
- 版面重排:主体左 Claude Usage(5h/7d/Fable 7d 三行),右 ChatGPT Usage(目前 mock,标「示例数据」);每行为一张用量卡:标签+F24 百分比+pace/全宽进度条/「重置 HH:MM」+「已过 NN%」 - 移除上一版的橘喵今日实时与 30 天趋势图及 trend totals 合计(业务数据留给 400×300 小屏),绿色暂不再使用 - data 用量结构新增 scoped(按模型限定额度)、reset(重置时刻文本)、updated(快照落盘时刻),新增 _usage_gpt mock 数据源,接入真实数据时保持结构替换即可 - usage_local 读取 statusline 新增的 seven_day_fable 与 updated_at;400×300 小屏 render 跳过 scoped 行 - 同步更新 CLAUDE.md 分支说明 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
10
renderer.py
10
renderer.py
@@ -150,16 +150,18 @@ class DashboardRenderer:
|
||||
self.tri(xr - tw - TRI_GAP - TRI / 2, cy, TRI, up=up, fill=color)
|
||||
return tw + TRI_GAP + TRI
|
||||
|
||||
def _usage_row(self, x0, x1, y, bar, warn):
|
||||
def _usage_row(self, x0, x1, y, bar, warn, label_w=None):
|
||||
"""一条用量(单行):左标签(5h/7d, F13) + 进度条 + 百分比(F16, 主数字) + 时间维度对比 pace(F13)。
|
||||
右侧从右往左排布,显式控制两处横向间距:G1 进度条↔百分比、G2 百分比↔pace;全部竖直居中 cy。
|
||||
pct ≥ warn → 进度条(含整条边框)与百分比转红;边框随条色,红条即红框,无黑白错位。"""
|
||||
pct ≥ warn → 进度条(含整条边框)与百分比转红;边框随条色,红条即红框,无黑白错位。
|
||||
label_w:标签列宽,默认 26*k(够放 5h/7d);宽版有 "Fable 7d" 这类长标签时由调用方按最长标签算好传入。"""
|
||||
raw = bar.get("pct")
|
||||
ok = isinstance(raw, (int, float)) # None/缺失 → 显示 "--"
|
||||
pct = max(0, min(100, int(raw))) if ok else 0
|
||||
fill, outline, color = self._usage_colors(ok, pct, warn, bar)
|
||||
k = self.k
|
||||
LABEL_W, G1, G2, H = 26 * k, 13 * k, 8 * k, 15 * k # G1 进度条↔百分比、G2 百分比↔pace(视觉约 12/11)
|
||||
LABEL_W = 26 * k if label_w is None else label_w
|
||||
G1, G2, H = 13 * k, 8 * k, 15 * k # G1 进度条↔百分比、G2 百分比↔pace(视觉约 12/11)
|
||||
PCT_TRACK = 2 * k # F16(16/12x 非整数倍缩放)数字墨迹无侧边距、紧贴,手动加字符间距
|
||||
cy = y + 10 * k # 行竖直中心
|
||||
self._mid(x0, cy, bar["k"], self.F13, bold=k) # 左标签 F13
|
||||
@@ -419,6 +421,8 @@ class DashboardRenderer:
|
||||
warn = usage.get("warn", 80)
|
||||
ry = 123
|
||||
for b in usage.get("bars", []):
|
||||
if b.get("scoped"): # 按模型限定的额度(Fable 7d)只在 800x480 宽版展示,小屏放不下第三行
|
||||
continue
|
||||
self._usage_row(10, 390, ry, b, warn)
|
||||
ry += 31 # 略压缩两条间距,给底部让出下边距
|
||||
|
||||
|
||||
Reference in New Issue
Block a user