From c4796787451706b3024e58ee14da031aa25d3283 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BB=8A=E6=99=9A=E6=89=93=E8=80=81=E8=99=8E?= Date: Thu, 19 Mar 2026 00:49:16 +0800 Subject: [PATCH 1/2] =?UTF-8?q?[=E6=8A=95=E7=A8=BF]=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E8=84=9A=E6=9C=AC:=20=E4=B9=A0=E6=83=AF=E8=BF=BD=E8=B8=AA?= =?UTF-8?q?=E5=99=A8=20=E2=80=94=20by=20=E4=BB=8A=E6=99=9A=E6=89=93?= =?UTF-8?q?=E8=80=81=E8=99=8E=F0=9F=90=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../scripts/widgets/script_mmwa0ets.py | 94 +++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100644 script_library/scripts/widgets/script_mmwa0ets.py diff --git a/script_library/scripts/widgets/script_mmwa0ets.py b/script_library/scripts/widgets/script_mmwa0ets.py new file mode 100644 index 0000000..ca26ce2 --- /dev/null +++ b/script_library/scripts/widgets/script_mmwa0ets.py @@ -0,0 +1,94 @@ +# -*- coding: utf-8 -*- +"""习惯追踪器 — 7 habits, streak, progress ring.""" + +from widget import Widget, family, SMALL, MEDIUM, LARGE +import time, random + +habits = [ + ("💧", "喝水", True), + ("📖", "阅读", True), + ("🏃", "运动", False), + ("🧘", "冥想", True), + ("🍎", "水果", True), + ("😴", "早睡", False), + ("📝", "日记", True), +] + +done = sum(1 for *_, ok in habits if ok) +total = len(habits) +streak = 12 + +bg = {"gradient": ["#6366F1", "#8B5CF6"], "direction": "diagonal"} +card_bg = ("#FFFFFF", "#1E1B4B") +txt_main = ("#1E1B4B", "#E0E7FF") +txt_sub = ("#6366F1", "#A5B4FC") +done_clr = ("#22C55E", "#4ADE80") +miss_clr = ("#E5E7EB", "#312E81") + +w = Widget(background=bg, padding=12) + +if family in (SMALL, "small"): + with w.vstack(spacing=6): + with w.hstack(spacing=6, align="center"): + w.icon("checkmark.circle.fill", size=16, color="#A5B4FC") + w.text("习惯", size=15, weight="bold", color="#FFFFFF") + w.spacer() + w.text(f"🔥{streak}天", size=12, color="#FDE68A") + w.gauge(done, total, label="", size=54, color="#34D399", + track_color=("#C7D2FE", "#312E81"), line_width=6) + w.text(f"{done}/{total} 已完成", size=12, weight="medium", + color="#E0E7FF", align="center") + +elif family in (MEDIUM, "medium"): + with w.hstack(spacing=10): + with w.vstack(spacing=4, padding=4): + with w.hstack(spacing=4, align="center"): + w.icon("checkmark.circle.fill", size=14, color="#A5B4FC") + w.text("习惯追踪", size=14, weight="bold", color="#FFFFFF") + w.spacer() + w.gauge(done, total, label="", size=56, color="#34D399", + track_color=("#C7D2FE", "#312E81"), line_width=6) + w.text(f"{done}/{total}", size=11, color="#E0E7FF", align="center") + with w.vstack(spacing=3): + with w.hstack(spacing=4, align="center"): + w.text(f"🔥 连续 {streak} 天", size=11, weight="semibold", + color="#FDE68A") + w.spacer() + for emoji, name, ok in habits: + with w.hstack(spacing=4, align="center"): + w.text(emoji, size=12) + w.text(name, size=11, color="#E0E7FF") + w.spacer() + w.icon("checkmark.circle.fill" if ok else "circle", + size=13, + color="#4ADE80" if ok else "#6366F1") + +else: + with w.vstack(spacing=6): + with w.hstack(spacing=6, align="center"): + w.icon("checkmark.circle.fill", size=18, color="#A5B4FC") + w.text("习惯追踪器", size=17, weight="bold", color="#FFFFFF") + w.spacer() + w.text(f"🔥 连续 {streak} 天", size=13, weight="semibold", + color="#FDE68A") + w.divider(color="#818CF8") + with w.hstack(spacing=8, align="center"): + w.gauge(done, total, label="", size=64, color="#34D399", + track_color=("#C7D2FE", "#312E81"), line_width=7) + with w.vstack(spacing=2): + w.text(f"{done}/{total} 已完成", size=13, weight="semibold", + color="#E0E7FF") + pct = int(done / total * 100) + w.progress(done, total, color="#34D399", height=6, + track_color=("#C7D2FE", "#312E81")) + w.text(f"完成率 {pct}%", size=11, color="#A5B4FC") + w.divider(color="#818CF8") + with w.hstack(spacing=6): + for emoji, name, ok in habits: + with w.vstack(spacing=2, align="center"): + w.text(emoji, size=18) + w.icon("checkmark.circle.fill" if ok else "circle", + size=14, + color="#4ADE80" if ok else "#6366F1") + +w.render() From 47d9945c41d1a9732c9d3ab0ad3ea6d5cb5013c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BB=8A=E6=99=9A=E6=89=93=E8=80=81=E8=99=8E?= Date: Thu, 19 Mar 2026 00:49:18 +0800 Subject: [PATCH 2/2] =?UTF-8?q?[=E6=8A=95=E7=A8=BF]=20=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=20index.json:=20=E6=B7=BB=E5=8A=A0=20=E4=B9=A0=E6=83=AF?= =?UTF-8?q?=E8=BF=BD=E8=B8=AA=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- script_library/index.json | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/script_library/index.json b/script_library/index.json index 4d8272f..7bf5d4c 100644 --- a/script_library/index.json +++ b/script_library/index.json @@ -1,7 +1,7 @@ { "format_version": 1, - "data_version": 7, - "updated": "2026-03-18T16:39:32Z", + "data_version": 8, + "updated": "2026-03-18T16:49:17.705Z", "announcement": null, "categories": [ { @@ -357,6 +357,29 @@ "updated": null, "status": "active", "lines": 560 + }, + { + "id": "script_mmwa0ets", + "name": "习惯追踪器", + "name_en": "习惯追踪器", + "desc": "习惯追踪器", + "desc_en": "习惯追踪器", + "category": "widgets", + "file": "scripts/widgets/script_mmwa0ets.py", + "thumbnail": null, + "version": 1, + "file_type": "py", + "author": "今晚打老虎🐯", + "author_en": "今晚打老虎🐯", + "tags": [ + "community" + ], + "requires": [], + "min_app_version": "1.5.0", + "added": "2026-03-18", + "updated": null, + "status": "active", + "lines": 95 } ] }