Skip to content

Commit 0edf7ab

Browse files
Merge pull request #35 from jinwandalaohu66/submission/script_mmyzioeo
2 parents ca218d2 + 6d5f5dc commit 0edf7ab

2 files changed

Lines changed: 110 additions & 2 deletions

File tree

script_library/index.json

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"format_version": 1,
3-
"data_version": 13,
4-
"updated": "2026-03-20T13:43:04.881Z",
3+
"data_version": 14,
4+
"updated": "2026-03-20T14:18:52.520Z",
55
"announcement": null,
66
"categories": [
77
{
@@ -495,6 +495,29 @@
495495
"updated": null,
496496
"status": "active",
497497
"lines": 222
498+
},
499+
{
500+
"id": "script_mmyzioeo",
501+
"name": "这就是节假日",
502+
"name_en": "这就是节假日",
503+
"desc": "节假日小组件",
504+
"desc_en": "节假日小组件",
505+
"category": "widgets",
506+
"file": "scripts/widgets/script_mmyzioeo.py",
507+
"thumbnail": null,
508+
"version": 1,
509+
"file_type": "py",
510+
"author": "Silence",
511+
"author_en": "Silence",
512+
"tags": [
513+
"community"
514+
],
515+
"requires": [],
516+
"min_app_version": "1.5.0",
517+
"added": "2026-03-20",
518+
"updated": null,
519+
"status": "active",
520+
"lines": 85
498521
}
499522
]
500523
}
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
# 欢迎使用 PythonIDE!如果觉得好用,请给个好评哦~
2+
3+
# 欢迎使用 PythonIDE!如果觉得好用,请给个好评哦~
4+
from widget import Widget
5+
from datetime import datetime, date
6+
7+
w = Widget() # 原生背景,系统自动深浅模式
8+
9+
now = datetime.now()
10+
today = date.today()
11+
current_year = today.year
12+
13+
14+
year_start = date(current_year, 1, 1)
15+
days_in_year = (date(current_year + 1, 1, 1) - year_start).days
16+
days_passed = (today - year_start).days
17+
progress = days_passed / days_in_year if days_in_year > 0 else 0
18+
19+
festivals = [
20+
(1, 1, "元旦", "新年快乐!今年继续摆烂吗?"),
21+
(2, 14, "情人节", "单身狗别哭,晚上要深深惹哦~"),
22+
(4, 5, "清明节", "扫完墓记得踏青啊,别只顾着emo"),
23+
(5, 1, "劳动节", "放假了!该卷的卷,该摸的摸"),
24+
(6, 10, "端午节", "粽子管够!赛龙舟我在岸上吃瓜"),
25+
(8, 20, "七夕", "中国版情人节,脱单的冲!单身的养神兽"),
26+
(9, 25, "中秋节", "月饼别吃太多,赏月许愿发财"),
27+
(10, 1, "国庆节", "黄金周!堵高速上思考人生?"),
28+
(10, 15, "重阳节", "老人节!爬山?我家喝茶敬老"),
29+
(2, 10, "春节", "过年好!红包拿来!今年发大财!")
30+
]
31+
32+
next_fests = []
33+
for month, day, name, egg in festivals:
34+
fest_date = datetime(today.year, month, day)
35+
if fest_date < now:
36+
fest_date = datetime(today.year + 1, month, day)
37+
next_fests.append((fest_date, name, egg))
38+
39+
next_fest = min(next_fests, key=lambda x: x[0])
40+
days_to_fest = (next_fest[0] - now).days
41+
name = next_fest[1]
42+
egg = next_fest[2]
43+
fest_date_str = f"{next_fest[0].month}{next_fest[0].day}日"
44+
45+
46+
quotes = [
47+
"生活不止眼前的苟且,还有诗和远方.--海子",
48+
"天行健,君子以自强不息.«周易»",
49+
"路漫漫其修远兮,吾将上下而求索.--屈原",
50+
"不积跬步,无以至千里.--荀子",
51+
"静以修身,俭以养德.--诸葛亮",
52+
"三人行,必有我师焉.--孔子",
53+
"欲速则不达.--«论语»",
54+
"长风破浪会有时,直挂云帆济沧海.--李白",
55+
"海阔凭鱼跃,天高任鸟飞.--«增广贤文»",
56+
"胜不骄,败不馁.--俗语",
57+
"天生我材必有用.--李白",
58+
"莫愁前路无知己,天下谁人不识君.--高适",
59+
"千里之行,始于足下.--老子",
60+
"知足者常乐.--老子",
61+
"宠辱不惊,看庭前花开花落.--«菜根谭»",
62+
"是非成败转头空.--罗贯中",
63+
"人生得意须尽欢,莫使金樽空对月.--李白",
64+
"不以物喜,不以己悲.--范仲淹"
65+
]
66+
quote = quotes[(today.month * 31 + today.day) % len(quotes)]
67+
68+
with w.vstack(spacing=6, padding=10, align="leading"):
69+
w.icon("escape", size=22, color="#ff9500")
70+
71+
w.text(f"下个节日:{fest_date_str} {name}", size=17, weight="bold", color="#1f2937")
72+
73+
with w.hstack(spacing=15, align="top"):
74+
with w.vstack(spacing=15.5, align="leading"):
75+
w.text(f"倒计时 {days_to_fest} 天", size=28, weight="heavy", color="#e63946")
76+
w.text(egg, size=13.5, color="#4b5563")
77+
w.text(quote, size=13.5, weight="bold", color="#666666")
78+
79+
80+
with w.vstack(spacing=2, align="center"):
81+
w.gauge(progress, size=60, color="#10b981", track_color="#e5e7eb")
82+
w.text(f"{int(progress*100)}%", size=20, weight="bold", color="#10b981")
83+
w.text(f"{current_year} 已过", size=12, color="#4b5563")
84+
85+
w.render()

0 commit comments

Comments
 (0)