Skip to content
This repository was archived by the owner on Aug 11, 2025. It is now read-only.

Commit fdfccd3

Browse files
committed
feat:完成
1 parent 105dbea commit fdfccd3

File tree

9 files changed

+60
-973
lines changed

9 files changed

+60
-973
lines changed

README.md

Lines changed: 5 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,17 @@
1-
> [!NOTE]
2-
> 欢迎使用本插件模板,该模板可以帮助你快速创建一个新的 Class Widgets 插件项目。
3-
> 此Readme文件是一个示例,可按需进行修改。
4-
>
5-
> Tip: 若希望下列的徽标正常显示的话可以用替换将"repo-owner/repo-name"替换为你的仓库名。
6-
>
7-
> 可在[此处](https://www.yuque.com/rinlit/cw-docs-dev)查看教程。
8-
91
<div align="center">
102
<img src="icon.png" alt="插件图标" width="18%">
11-
<h1>Class Widgets 插件模板</h1>
12-
13-
14-
[![星标](https://img.shields.io/github/stars/repo-owner/repo-name?style=for-the-badge&color=orange&label=星标)](https://github.com/repo-owner/repo-name)
15-
[![开源许可](https://img.shields.io/badge/license-MIT-darkgreen.svg?label=开源许可证&style=for-the-badge)](https://github.com/repo-owner/repo-name)
16-
[![下载量](https://img.shields.io/github/downloads/repo-owner/repo-name/total.svg?label=下载量&color=green&style=for-the-badge)](https://github.com/repo-owner/repo-name)
17-
3+
<h1>NamePicker x Class Widgets</h1>
184
</div>
195

206
## 介绍
217

22-
本项目是一个 Class Widgets 插件模板,可以帮助你快速创建一个新的 Class Widgets 插件项目。
8+
NamePicker与Class Widgets联动插件
239

24-
### 截图
25-
![截图1](img/img.png)
10+
需要配合[NamePicker](https://github.com/NamePickerOrg/NamePicker)使用
2611

2712
### 特性
2813

29-
- 第一个特性
30-
- 第二个特性
31-
- 第三个特性
14+
- 让抽选结果以通知形式显示
3215

3316
## 许可证
3417
本插件采用了 MIT 许可证,详情请查看 [LICENSE](LICENSE) 文件。
@@ -37,10 +20,5 @@ Copyright © 2025 Your Name.
3720
## 鸣谢
3821

3922
### 贡献者
40-
Thanks goes to these wonderful people:
41-
[![Contributors](http://contrib.nn.ci/api?repo=repo-owner/repo-name)](https://github.com/repo-owner/repo-name/graphs/contributors)
42-
43-
### 使用的资源
23+
[![Contributors](http://contrib.nn.ci/api?repo=NamePickerOrg/NamePicker4CW)](https://github.com/NamePickerOrg/NamePicker4CW/graphs/contributors)
4424

45-
- [资源1](https://example.com)
46-
- [资源2](https://example.com)

__init__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
from .main import Plugin
2-
from .main import Settings # 如果有定义设置类,则需要引入
1+
from .main import Plugin

assets/NamePicker.png

16.2 KB
Loading

assets/您的插件所需要的其他资源……

Whitespace-only changes.

icon.png

-115 KB
Loading

main.py

Lines changed: 22 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,31 @@
1-
"""
2-
这是一个示例插件
3-
Author: 君の名は
4-
5-
Tips:
6-
若要在插件广场推送您的更新,请手动修改"plugin.json"的"version"版本号字段以被插件广场识别
7-
"""
81
from PyQt5 import uic
92
from .ClassWidgets.base import PluginBase, SettingsBase # 导入CW的基类
10-
3+
import tempfile
4+
import os
115

126
class Plugin(PluginBase): # 插件类
137
def __init__(self, cw_contexts, method): # 初始化
148
super().__init__(cw_contexts, method) # 调用父类初始化方法
15-
"""
16-
插件初始化,插件被执行时将会执行此部分的代码
17-
"""
18-
19-
def execute(self): # 自启动执行部分
20-
"""
21-
当 Class Widgets启动时,将会执行此部分的代码
22-
"""
23-
print('Plugin Executed!')
9+
self.plugin_dir = self.cw_contexts['PLUGIN_PATH']
10+
self.temp_dir = tempfile.gettempdir()
2411

25-
def update(self, cw_contexts): # 自动更新部分
26-
"""
27-
Class Widgets 会每1秒更新一次状态,同时也会调用此部分的代码。
28-
可在此部分插入动态更新的内容
29-
"""
30-
super().update(cw_contexts) # 调用父类更新方法
12+
def execute(self):
13+
pass
3114

15+
def listen(self):
16+
if os.path.exists("%s\\unread"%self.temp_dir):
17+
os.remove("%s\\unread"%self.temp_dir)
18+
with open("%s\\res.txt"%self.temp_dir,"r",encoding="utf-8") as f:
19+
msg = f.read()
20+
self.method.send_notification(
21+
state=4,
22+
title='抽选结果',
23+
subtitle = '被抽中的幸运儿',
24+
content = str(msg),
25+
icon = f'{self.plugin_dir}/assets/NamePicker.png',
26+
duration = 3000 # 通知将显示5秒
27+
)
3228

33-
# 设置页(若无此需求,请删除此部分并将"__init__.py"中引用的本模块部分删除,并在"plugins.json"中把"settings"子块设为"false")
34-
class Settings(SettingsBase):
35-
def __init__(self, plugin_path, parent=None):
36-
super().__init__(plugin_path, parent)
37-
uic.loadUi(f'{self.PATH}/settings.ui', self) # 加载设置界面
38-
"""
39-
在这里写设置页面
40-
"""
29+
def update(self, cw_contexts):
30+
super().update(cw_contexts)
31+
self.listen()

plugin.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
{
2-
"name": "Class Widgets 插件模板",
3-
"description": "这里是简介,用简短的语言描述插件的功能。",
2+
"name": "NamePicker x Class Widgets",
3+
"description": "使NamePicker的点名结果在Class Widgets上显示",
44
"version": "1.0.0",
55
"plugin_ver": 1,
6-
"author": "你的名字",
7-
"settings": true,
6+
"author": "LHGS-github",
7+
"settings": false,
88

9-
"url": "https://github.com/{repo-owner}/{repo}",
9+
"url": "https://github.com/NamePickerOrg/NamePicker4CW",
1010
"branch": "main",
1111

12-
"update_date": "yyyy/mm/dd"
12+
"update_date": "2025/3/15"
1313
}

requirements.txt

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
certifi==2024.8.30
2+
charset-normalizer==3.3.2
3+
colorama==0.4.6
4+
configparser~=7.1.0
5+
darkdetect==0.8.0
6+
idna==3.10
7+
loguru~=0.7.2
8+
PyQt5~=5.15.11
9+
PyQt-Fluent-Widgets~=1.7.2
10+
pyqt5-frameless-window==0.4.3
11+
pyqt5-qt5~=5.15.2
12+
pyqt5-sip==12.15.0
13+
pyqt5-stubs==5.15.6.0
14+
pywin32==307; platform_system == "Windows"
15+
psutil==5.9.5
16+
requests==2.32.3
17+
urllib3==2.2.3
18+
win32-setctime==1.1.0
19+
PyQtWebEngine~=5.15.7
20+
Markdown~=3.7
21+
pygame~=2.6.1
22+
packaging~=24.2
23+
PyGetWindow~=0.0.9
24+
edge-tts~=7.0.0
25+
pyttsx3==2.98
26+
git+https://github.com/SmartTeachCN/pycses.git

0 commit comments

Comments
 (0)