Skip to content

Commit 1a3fecf

Browse files
feat: 同步当前西大不丢API
1 parent 8166184 commit 1a3fecf

3 files changed

Lines changed: 42 additions & 15 deletions

File tree

ClassWidgets/SDK/__init__.py

Lines changed: 30 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,36 @@
88
__author__ = 'Class Widgets Official'
99

1010

11-
class CW2Plugin:
12-
pass
13-
14-
class ConfigBaseModel:
15-
pass
16-
17-
class PluginAPI:
18-
pass
19-
20-
21-
__all__ = ['CW2Plugin', 'ConfigBaseModel', 'PluginAPI', '__version__', '__author__']
11+
from .api import (
12+
WidgetsAPI,
13+
NotificationAPI,
14+
ScheduleAPI,
15+
ThemeAPI,
16+
RuntimeAPI,
17+
ConfigAPI,
18+
AutomationAPI,
19+
UiAPI,
20+
PluginAPI,
21+
)
22+
23+
from .plugin_base import CW2Plugin
24+
from .config import ConfigBaseModel
25+
26+
__all__ = [
27+
'CW2Plugin',
28+
'ConfigBaseModel',
29+
'PluginAPI',
30+
'WidgetsAPI',
31+
'NotificationAPI',
32+
'ScheduleAPI',
33+
'ThemeAPI',
34+
'RuntimeAPI',
35+
'ConfigAPI',
36+
'AutomationAPI',
37+
'UiAPI',
38+
'__version__',
39+
'__author__'
40+
]
2241

2342

2443
if 'PySide6' not in sys.modules and not TYPE_CHECKING:

ClassWidgets/SDK/api.pyi

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,19 @@ class NotificationAPI(QObject):
3535

3636
def get_provider(
3737
self,
38-
plugin: Any,
3938
provider_id: str,
4039
name: Optional[str] = ...,
4140
icon: Optional[Union[str, Path]] = ...,
4241
use_system_notify: bool = ...
43-
) -> Any: ... # 返回 NotificationProvider
42+
) -> Any: ...
43+
44+
def register_provider(
45+
self,
46+
provider_id: str,
47+
name: Optional[str] = ...,
48+
icon: Optional[Union[str, Path]] = ...,
49+
use_system_notify: bool = ...
50+
) -> Any: ...
4451

4552

4653
# ScheduleAPI
@@ -141,11 +148,10 @@ class UiAPI(QObject):
141148
@property
142149
def pages(self) -> List[Dict[str, Any]]: ...
143150

144-
def unregister_settings_page(self, plugin: Any, qml_path: Union[str, Path]) -> None: ...
151+
def unregister_settings_page(self, qml_path: Union[str, Path]) -> None: ...
145152

146153
def register_settings_page(
147154
self,
148-
plugin: Any,
149155
qml_path: Union[str, Path],
150156
title: Optional[str] = ...,
151157
icon: Optional[str] = ...

ClassWidgets/SDK/tools/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,13 @@
66
from .manifest import PluginManifestModel
77
from .scaffold import PluginScaffold, create_plugin
88
from .packager import PluginPackager, pack_plugin
9+
from .help import show_help
910

1011
__all__ = [
1112
'PluginManifestModel',
1213
'PluginScaffold',
1314
'create_plugin',
1415
'pack_plugin',
1516
'PluginPackager',
17+
'show_help',
1618
]

0 commit comments

Comments
 (0)