1- from typing import Dict , List , Optional , Any , Union
1+ from typing import Dict , List , Optional , Any , Union , TypedDict
22from datetime import datetime
33from pathlib import Path
4+ from enum import Enum
45
6+ from .notification import NotificationPayload , NotificationProvider
7+ from .base_model import QObject , Signal
58
6- class QObject : ...
79
10+ class ConfigBaseModel : ...
811
9- class Signal : ...
1012
13+ class RuntimeMetaPayload (TypedDict ):
14+ id : str
15+ version : int
16+ maxWeekCycle : int
17+ startDate : str
1118
12- class ConfigBaseModel : ...
19+
20+ class RuntimeEntryPayload (TypedDict ):
21+ id : str
22+ type : str
23+ startTime : str
24+ endTime : str
25+ subjectId : Optional [str ]
26+ title : Optional [str ]
27+
28+
29+ class RuntimeEntryChangedPayload (TypedDict , total = False ):
30+ id : str
31+ type : str
32+ startTime : str
33+ endTime : str
34+ subjectId : Optional [str ]
35+ title : Optional [str ]
36+
37+
38+ class RuntimeSubjectPayload (TypedDict ):
39+ id : str
40+ name : str
41+ simplifiedName : Optional [str ]
42+ teacher : Optional [str ]
43+ icon : Optional [str ]
44+ color : Optional [str ]
45+ location : Optional [str ]
46+ isLocalClassroom : bool
47+
48+
49+ class RuntimeRemainingTimePayload (TypedDict ):
50+ minute : int
51+ second : int
52+
53+
54+ class SettingsPagePayload (TypedDict ):
55+ id : str
56+ page : str
57+ title : str
58+ icon : str
59+
60+
61+ class EntryType (str , Enum ):
62+ CLASS = "class"
63+ BREAK = "break"
64+ FREE = "free"
65+ ACTIVITY = "activity"
66+ UNKNOWN = "unknown"
1367
1468
1569# WidgetsAPI
@@ -29,7 +83,7 @@ class WidgetsAPI:
2983
3084# NotificationAPI
3185class NotificationAPI (QObject ):
32- pushed : Signal # Signal(str)
86+ pushed : Signal [ NotificationPayload ]
3387
3488 def __init__ (self , app : Any ) -> None : ...
3589
@@ -39,15 +93,15 @@ class NotificationAPI(QObject):
3993 name : Optional [str ] = ...,
4094 icon : Optional [Union [str , Path ]] = ...,
4195 use_system_notify : bool = ...
42- ) -> Any : ...
96+ ) -> NotificationProvider : ...
4397
4498 def register_provider (
4599 self ,
46100 provider_id : str ,
47101 name : Optional [str ] = ...,
48102 icon : Optional [Union [str , Path ]] = ...,
49103 use_system_notify : bool = ...
50- ) -> Any : ...
104+ ) -> NotificationProvider : ...
51105
52106
53107# ScheduleAPI
@@ -61,7 +115,7 @@ class ScheduleAPI:
61115
62116# ThemeAPI
63117class ThemeAPI (QObject ):
64- changed : Signal # Signal( str)
118+ changed : Signal [ str ]
65119
66120 def __init__ (self , app : Any ) -> None : ...
67121
@@ -70,9 +124,9 @@ class ThemeAPI(QObject):
70124
71125# RuntimeAPI
72126class RuntimeAPI (QObject ):
73- updated : Signal # Signal()
74- statusChanged : Signal # Signal( str)
75- entryChanged : Signal # Signal(dict)
127+ updated : Signal
128+ statusChanged : Signal [ str ]
129+ entryChanged : Signal [ RuntimeEntryChangedPayload ]
76130
77131 def __init__ (self , app : Any ) -> None : ...
78132
@@ -94,19 +148,19 @@ class RuntimeAPI(QObject):
94148
95149 # 日程属性
96150 @property
97- def schedule_meta (self ) -> Optional [Dict [ str , Any ] ]: ...
151+ def schedule_meta (self ) -> Optional [RuntimeMetaPayload ]: ...
98152
99153 @property
100- def current_day_entries (self ) -> List [Dict [ str , Any ] ]: ...
154+ def current_day_entries (self ) -> List [RuntimeEntryPayload ]: ...
101155
102156 @property
103- def current_entry (self ) -> Optional [Dict [ str , Any ] ]: ...
157+ def current_entry (self ) -> Optional [RuntimeEntryPayload ]: ...
104158
105159 @property
106- def next_entries (self ) -> List [Dict [ str , Any ] ]: ...
160+ def next_entries (self ) -> List [RuntimeEntryPayload ]: ...
107161
108162 @property
109- def remaining_time (self ) -> Dict [ str , int ] : ...
163+ def remaining_time (self ) -> RuntimeRemainingTimePayload : ...
110164
111165 @property
112166 def progress (self ) -> float : ...
@@ -115,7 +169,7 @@ class RuntimeAPI(QObject):
115169 def current_status (self ) -> str : ...
116170
117171 @property
118- def current_subject (self ) -> Optional [Dict [ str , Any ] ]: ...
172+ def current_subject (self ) -> Optional [RuntimeSubjectPayload ]: ...
119173
120174 @property
121175 def current_title (self ) -> Optional [str ]: ...
@@ -129,7 +183,7 @@ class ConfigAPI:
129183
130184 def get_plugin_model (self , plugin_id : str ) -> Optional [ConfigBaseModel ]: ...
131185
132- def save (self ) -> None : ...
186+ def save (self ) -> Any : ...
133187
134188
135189# AutomationAPI
@@ -141,12 +195,12 @@ class AutomationAPI:
141195
142196# UiAPI
143197class UiAPI (QObject ):
144- settingsPageRegistered : Signal # Signal()
198+ settingsPageRegistered : Signal
145199
146- def __init__ (self ) -> None : ...
200+ def __init__ (self , app : Any ) -> None : ...
147201
148202 @property
149- def pages (self ) -> List [Dict [ str , Any ] ]: ...
203+ def pages (self ) -> List [SettingsPagePayload ]: ...
150204
151205 def unregister_settings_page (self , qml_path : Union [str , Path ]) -> None : ...
152206
@@ -162,6 +216,11 @@ class UiAPI(QObject):
162216class PluginAPI :
163217 def __init__ (self , app : Any ) -> None : ...
164218
219+ def set_current_plugin (self , plugin : Any ) -> None : ...
220+
221+ @property
222+ def current_plugin (self ) -> Any : ...
223+
165224 widgets : WidgetsAPI
166225 notification : NotificationAPI
167226 schedule : ScheduleAPI
@@ -173,6 +232,13 @@ class PluginAPI:
173232
174233
175234__all__ = [
235+ 'RuntimeMetaPayload' ,
236+ 'RuntimeEntryPayload' ,
237+ 'RuntimeEntryChangedPayload' ,
238+ 'RuntimeSubjectPayload' ,
239+ 'RuntimeRemainingTimePayload' ,
240+ 'SettingsPagePayload' ,
241+ 'EntryType' ,
176242 'WidgetsAPI' ,
177243 'NotificationAPI' ,
178244 'ScheduleAPI' ,
0 commit comments