kuaijs-ios 0.2.11__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- kuaijs/__init__.py +25 -0
- kuaijs/action.pyi +239 -0
- kuaijs/appleocr.pyi +84 -0
- kuaijs/config.pyi +43 -0
- kuaijs/device.pyi +80 -0
- kuaijs/file.pyi +103 -0
- kuaijs/g.pyi +24 -0
- kuaijs/hid.pyi +218 -0
- kuaijs/hotupdate.pyi +45 -0
- kuaijs/image.pyi +177 -0
- kuaijs/ime.pyi +49 -0
- kuaijs/logger.pyi +47 -0
- kuaijs/media.pyi +32 -0
- kuaijs/mysql.pyi +51 -0
- kuaijs/netcard.pyi +30 -0
- kuaijs/node.pyi +91 -0
- kuaijs/paddleocr.pyi +41 -0
- kuaijs/pip.pyi +28 -0
- kuaijs/system.pyi +146 -0
- kuaijs/tomatoocr.pyi +80 -0
- kuaijs/tts.pyi +51 -0
- kuaijs/ui.pyi +68 -0
- kuaijs/utils.pyi +16 -0
- kuaijs/yolo.pyi +44 -0
- kuaijs_ios-0.2.11.dist-info/METADATA +26 -0
- kuaijs_ios-0.2.11.dist-info/RECORD +28 -0
- kuaijs_ios-0.2.11.dist-info/WHEEL +5 -0
- kuaijs_ios-0.2.11.dist-info/top_level.txt +1 -0
kuaijs/hid.pyi
ADDED
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
from typing import Any, List, Optional, Literal, Protocol
|
|
2
|
+
|
|
3
|
+
class AppInfo(Protocol):
|
|
4
|
+
name: str
|
|
5
|
+
bundleId: str
|
|
6
|
+
|
|
7
|
+
class HIDKey(Protocol):
|
|
8
|
+
COMMAND: int
|
|
9
|
+
LEFT_CTRL: int
|
|
10
|
+
LEFT_SHIFT: int
|
|
11
|
+
LEFT_ALT: int
|
|
12
|
+
RIGHT_CTRL: int
|
|
13
|
+
RIGHT_SHIFT: int
|
|
14
|
+
RIGHT_ALT: int
|
|
15
|
+
UP_ARROW: int
|
|
16
|
+
DOWN_ARROW: int
|
|
17
|
+
LEFT_ARROW: int
|
|
18
|
+
RIGHT_ARROW: int
|
|
19
|
+
SPACE: int
|
|
20
|
+
BACKSPACE: int
|
|
21
|
+
TAB: int
|
|
22
|
+
RETURN: int
|
|
23
|
+
ESC: int
|
|
24
|
+
INSERT: int
|
|
25
|
+
DELETE: int
|
|
26
|
+
PAGE_UP: int
|
|
27
|
+
PAGE_DOWN: int
|
|
28
|
+
HOME: int
|
|
29
|
+
END: int
|
|
30
|
+
CAPS_LOCK: int
|
|
31
|
+
F1: int
|
|
32
|
+
F2: int
|
|
33
|
+
F3: int
|
|
34
|
+
F4: int
|
|
35
|
+
F5: int
|
|
36
|
+
F6: int
|
|
37
|
+
F7: int
|
|
38
|
+
F8: int
|
|
39
|
+
F9: int
|
|
40
|
+
F10: int
|
|
41
|
+
F11: int
|
|
42
|
+
F12: int
|
|
43
|
+
|
|
44
|
+
hidKey: HIDKey
|
|
45
|
+
"""HID 按键常量映射。
|
|
46
|
+
|
|
47
|
+
用于组合键发送:可通过 hidKey.COMMAND、hidKey.LEFT_CTRL 等取得修饰键代码,
|
|
48
|
+
也支持字典访问 hidKey["COMMAND"] 与直接传入字符串名称(如 "COMMAND")。
|
|
49
|
+
示例:
|
|
50
|
+
from kuaijs import hid
|
|
51
|
+
hid.send_key([hid.hidKey.COMMAND, "c"]) # 复制(点属性)
|
|
52
|
+
hid.send_key([hid.hidKey["COMMAND"], "c"]) # 复制(字典)
|
|
53
|
+
hid.send_key(["COMMAND", "v"]) # 粘贴(字符串键名)
|
|
54
|
+
"""
|
|
55
|
+
|
|
56
|
+
# 设置动作抖动值(像素,随屏幕 scale 适配)
|
|
57
|
+
def set_jitter_value(value: int) -> None: ...
|
|
58
|
+
|
|
59
|
+
# 重置坐标系方向(如 "portrait" | "landscape")
|
|
60
|
+
def reset_position(orientation: Literal["PORTRAIT", "LANDSCAPE"] = ...) -> None:
|
|
61
|
+
"""重置坐标系方向
|
|
62
|
+
|
|
63
|
+
参数:
|
|
64
|
+
orientation: 屏幕方向(PORTRAIT/LANDSCAPE)
|
|
65
|
+
"""
|
|
66
|
+
...
|
|
67
|
+
|
|
68
|
+
# 点击
|
|
69
|
+
# 参数:x/y 坐标;duration 持续时间(ms);jitter 是否启用抖动
|
|
70
|
+
def click(x: int, y: int, duration: int = ..., jitter: bool = ...) -> bool:
|
|
71
|
+
"""点击指定坐标
|
|
72
|
+
|
|
73
|
+
参数:
|
|
74
|
+
x/y: 坐标
|
|
75
|
+
duration: 按下时长(毫秒,默认 10ms)
|
|
76
|
+
jitter: 是否启用抖动(默认 False)
|
|
77
|
+
返回:
|
|
78
|
+
bool: 是否成功
|
|
79
|
+
"""
|
|
80
|
+
...
|
|
81
|
+
|
|
82
|
+
# 随机点击指定矩形区域
|
|
83
|
+
def click_random(x1: int, y1: int, x2: int, y2: int, duration: int = ...) -> bool:
|
|
84
|
+
"""随机点击指定矩形区域
|
|
85
|
+
|
|
86
|
+
参数:
|
|
87
|
+
x1/y1/x2/y2: 矩形区域坐标
|
|
88
|
+
duration: 按下时长(毫秒,默认 20ms)
|
|
89
|
+
返回:
|
|
90
|
+
bool: 是否成功
|
|
91
|
+
"""
|
|
92
|
+
...
|
|
93
|
+
|
|
94
|
+
# 双击
|
|
95
|
+
# 参数:duration 持续时间;interval 间隔时间(ms);jitter 是否抖动
|
|
96
|
+
def double_click(
|
|
97
|
+
x: int, y: int, duration: int = ..., interval: int = ..., jitter: bool = ...
|
|
98
|
+
) -> bool:
|
|
99
|
+
"""双击指定坐标
|
|
100
|
+
|
|
101
|
+
参数:
|
|
102
|
+
duration: 每次按下时长(毫秒,默认 20ms)
|
|
103
|
+
interval: 两次点击间隔(毫秒,默认 20ms)
|
|
104
|
+
jitter: 是否启用抖动(默认 False)
|
|
105
|
+
"""
|
|
106
|
+
...
|
|
107
|
+
|
|
108
|
+
# 随机双击指定区域
|
|
109
|
+
def double_click_random(
|
|
110
|
+
x1: int, y1: int, x2: int, y2: int, duration: int = ..., interval: int = ...
|
|
111
|
+
) -> bool:
|
|
112
|
+
"""随机双击矩形区域"""
|
|
113
|
+
...
|
|
114
|
+
|
|
115
|
+
# 直线滑动
|
|
116
|
+
# 参数:起点 x/y;终点 ex/ey;jitter 抖动;steps 轨迹点数
|
|
117
|
+
def swipe(
|
|
118
|
+
x: int, y: int, ex: int, ey: int, jitter: bool = ..., steps: int = ...
|
|
119
|
+
) -> bool:
|
|
120
|
+
"""直线滑动
|
|
121
|
+
|
|
122
|
+
参数:
|
|
123
|
+
jitter: 是否启用抖动(默认 False)
|
|
124
|
+
steps: 轨迹点数量(默认 6)
|
|
125
|
+
"""
|
|
126
|
+
...
|
|
127
|
+
|
|
128
|
+
# 3 点曲线滑动(先快后慢)
|
|
129
|
+
def swipe_curve(
|
|
130
|
+
startX: int, startY: int, midX: int, midY: int, endX: int, endY: int
|
|
131
|
+
) -> bool:
|
|
132
|
+
"""3 点曲线滑动"""
|
|
133
|
+
...
|
|
134
|
+
|
|
135
|
+
# 回主页(Command+H)
|
|
136
|
+
def home_screen() -> bool:
|
|
137
|
+
"""回主页(Command+H)"""
|
|
138
|
+
...
|
|
139
|
+
|
|
140
|
+
# 输入简单键盘数据(仅英文与可输入键;不支持中文)
|
|
141
|
+
def input_simple(data: str) -> bool:
|
|
142
|
+
"""输入简单文本(英文及可输入键)"""
|
|
143
|
+
...
|
|
144
|
+
|
|
145
|
+
# 空格/删除/回车
|
|
146
|
+
def space() -> bool:
|
|
147
|
+
"""空格键"""
|
|
148
|
+
...
|
|
149
|
+
|
|
150
|
+
def backspace() -> bool:
|
|
151
|
+
"""删除键"""
|
|
152
|
+
...
|
|
153
|
+
|
|
154
|
+
def enter() -> bool:
|
|
155
|
+
"""回车键"""
|
|
156
|
+
...
|
|
157
|
+
|
|
158
|
+
# 发送组合按键(支持 Int 或字符)
|
|
159
|
+
def send_key(keys: List[Any]) -> bool:
|
|
160
|
+
"""发送组合按键(支持数字或字符)"""
|
|
161
|
+
...
|
|
162
|
+
|
|
163
|
+
# 复制/粘贴/返回/最近应用/锁屏/解锁
|
|
164
|
+
def copy_text() -> bool:
|
|
165
|
+
"""复制文本(Command+C)"""
|
|
166
|
+
...
|
|
167
|
+
|
|
168
|
+
def paste_text() -> bool:
|
|
169
|
+
"""粘贴文本(Command+V)"""
|
|
170
|
+
...
|
|
171
|
+
|
|
172
|
+
def back() -> bool:
|
|
173
|
+
"""返回(Tab+B)"""
|
|
174
|
+
...
|
|
175
|
+
|
|
176
|
+
def recent() -> bool:
|
|
177
|
+
"""APP 切换器"""
|
|
178
|
+
...
|
|
179
|
+
|
|
180
|
+
def lock() -> bool:
|
|
181
|
+
"""锁屏"""
|
|
182
|
+
...
|
|
183
|
+
|
|
184
|
+
def unlock() -> bool:
|
|
185
|
+
"""解锁"""
|
|
186
|
+
...
|
|
187
|
+
|
|
188
|
+
# 打开 URL / App;切到前台
|
|
189
|
+
def open_url(url: str) -> bool:
|
|
190
|
+
"""打开 URL"""
|
|
191
|
+
...
|
|
192
|
+
|
|
193
|
+
def open_app(name: str) -> bool:
|
|
194
|
+
"""打开 App"""
|
|
195
|
+
...
|
|
196
|
+
|
|
197
|
+
def take_me_to_front() -> bool:
|
|
198
|
+
"""切到前台"""
|
|
199
|
+
...
|
|
200
|
+
|
|
201
|
+
# 当前应用信息(仅 IOS18+)
|
|
202
|
+
def current_app_info() -> Optional[AppInfo]:
|
|
203
|
+
"""当前应用信息(仅 iOS18+)"""
|
|
204
|
+
...
|
|
205
|
+
|
|
206
|
+
# 剪切板读写
|
|
207
|
+
def set_clipboard(text: str) -> bool:
|
|
208
|
+
"""设置剪贴板"""
|
|
209
|
+
...
|
|
210
|
+
|
|
211
|
+
def get_clipboard() -> str:
|
|
212
|
+
"""获取剪贴板"""
|
|
213
|
+
...
|
|
214
|
+
|
|
215
|
+
# 执行自定义按钮(1-11)
|
|
216
|
+
def custom_button(button: int) -> bool:
|
|
217
|
+
"""执行自定义按钮(1-11)"""
|
|
218
|
+
...
|
kuaijs/hotupdate.pyi
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
from typing import Optional, Protocol
|
|
2
|
+
|
|
3
|
+
# 检查更新(options: url/timeout/version),返回 {needUpdate,data?,error?}
|
|
4
|
+
class HotUpdateResponse(Protocol):
|
|
5
|
+
download_url: str
|
|
6
|
+
version: int
|
|
7
|
+
download_timeout: int
|
|
8
|
+
dialog: bool
|
|
9
|
+
msg: str
|
|
10
|
+
force: bool
|
|
11
|
+
md5: Optional[str]
|
|
12
|
+
|
|
13
|
+
class HotUpdateResult(Protocol):
|
|
14
|
+
need_update: bool
|
|
15
|
+
error: Optional[str]
|
|
16
|
+
data: Optional[HotUpdateResponse]
|
|
17
|
+
|
|
18
|
+
class HotUpdateOptions(Protocol):
|
|
19
|
+
url: Optional[str]
|
|
20
|
+
version: Optional[int]
|
|
21
|
+
timeout: Optional[int]
|
|
22
|
+
|
|
23
|
+
# 下载并安装(返回 {updated,error?})
|
|
24
|
+
class InstallResult(Protocol):
|
|
25
|
+
updated: bool
|
|
26
|
+
error: Optional[str]
|
|
27
|
+
|
|
28
|
+
def check_update(options: Optional[HotUpdateOptions] = ...) -> HotUpdateResult:
|
|
29
|
+
"""检查更新
|
|
30
|
+
|
|
31
|
+
参数:
|
|
32
|
+
options: 检查参数(url/version/timeout)
|
|
33
|
+
返回:
|
|
34
|
+
HotUpdateResult: needUpdate/data/error
|
|
35
|
+
"""
|
|
36
|
+
...
|
|
37
|
+
|
|
38
|
+
def download_and_install() -> InstallResult:
|
|
39
|
+
"""下载并安装更新(执行成功会自动重启脚本)"""
|
|
40
|
+
...
|
|
41
|
+
|
|
42
|
+
# 获取当前应用版本号(整数)
|
|
43
|
+
def get_current_version() -> int:
|
|
44
|
+
"""获取当前应用版本号(数字)"""
|
|
45
|
+
...
|
kuaijs/image.pyi
ADDED
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
from typing import List, Optional, Protocol
|
|
2
|
+
|
|
3
|
+
class Size(Protocol):
|
|
4
|
+
width: int
|
|
5
|
+
height: int
|
|
6
|
+
|
|
7
|
+
# 单点找色(返回点坐标列表)
|
|
8
|
+
class Point(Protocol):
|
|
9
|
+
x: int
|
|
10
|
+
y: int
|
|
11
|
+
|
|
12
|
+
# 找图(返回矩形列表)
|
|
13
|
+
class Rect(Protocol):
|
|
14
|
+
x: int
|
|
15
|
+
y: int
|
|
16
|
+
width: int
|
|
17
|
+
height: int
|
|
18
|
+
confidence: float
|
|
19
|
+
centerX: int
|
|
20
|
+
centerY: int
|
|
21
|
+
ex: int
|
|
22
|
+
ey: int
|
|
23
|
+
|
|
24
|
+
# 截取全屏并返回图片ID
|
|
25
|
+
def capture_full_screen() -> Optional[str]:
|
|
26
|
+
"""截取全屏并返回图片ID(失败返回 None)"""
|
|
27
|
+
...
|
|
28
|
+
|
|
29
|
+
# 截取屏幕区域并返回图片ID
|
|
30
|
+
# 参数:x/y 左上角;ex/ey 右下角
|
|
31
|
+
def capture_rect(x: int, y: int, ex: int, ey: int) -> Optional[str]:
|
|
32
|
+
"""截取屏幕区域并返回图片ID(x/y 左上角;ex/ey 右下角)"""
|
|
33
|
+
...
|
|
34
|
+
|
|
35
|
+
# 读取图片文件为图片ID
|
|
36
|
+
def read_image(path: str) -> Optional[str]:
|
|
37
|
+
"""读取图片文件为图片ID"""
|
|
38
|
+
...
|
|
39
|
+
|
|
40
|
+
# 裁剪图片并返回新的图片ID
|
|
41
|
+
def clip(id: str, x: int, y: int, ex: int, ey: int) -> Optional[str]:
|
|
42
|
+
"""裁剪图片并返回新的图片ID"""
|
|
43
|
+
...
|
|
44
|
+
|
|
45
|
+
# 获取图片尺寸信息 {width,height}
|
|
46
|
+
def get_size(id: str) -> Optional[Size]:
|
|
47
|
+
"""获取图片尺寸信息 {width,height}"""
|
|
48
|
+
...
|
|
49
|
+
|
|
50
|
+
# 图片转 base64(format: jpg|png;q: 质量1-100,仅jpg)
|
|
51
|
+
def to_base64_format(id: str, format: str, q: int) -> Optional[str]:
|
|
52
|
+
"""图片转 base64(format: jpg|png;q: 质量1-100,仅jpg)"""
|
|
53
|
+
...
|
|
54
|
+
|
|
55
|
+
# base64 转图片ID
|
|
56
|
+
def base64_to_image(base64data: str) -> Optional[str]:
|
|
57
|
+
"""base64 转图片ID"""
|
|
58
|
+
...
|
|
59
|
+
|
|
60
|
+
# 图片是否被释放
|
|
61
|
+
def is_release(id: str) -> bool:
|
|
62
|
+
"""图片是否已被释放"""
|
|
63
|
+
...
|
|
64
|
+
|
|
65
|
+
# 释放图片/全部图片
|
|
66
|
+
def release(id: str) -> None:
|
|
67
|
+
"""释放图片"""
|
|
68
|
+
...
|
|
69
|
+
|
|
70
|
+
def release_all() -> None:
|
|
71
|
+
"""释放全部图片"""
|
|
72
|
+
...
|
|
73
|
+
|
|
74
|
+
# 保存图片到路径
|
|
75
|
+
def save_to(id: str, path: str) -> bool:
|
|
76
|
+
"""保存图片到路径"""
|
|
77
|
+
...
|
|
78
|
+
|
|
79
|
+
# 旋转图片(degree: 90 | -90 | 180)返回新ID
|
|
80
|
+
def rotate_image(id: str, degree: int) -> Optional[str]:
|
|
81
|
+
"""旋转图片(degree: 90 | -90 | 180),返回新ID"""
|
|
82
|
+
...
|
|
83
|
+
|
|
84
|
+
# 多点比色(points: "x|y|主色-偏色,...";threshold: 0.0-1.0;区域 x/y/ex/ey)
|
|
85
|
+
def cmp_color(
|
|
86
|
+
id: str, points: str, threshold: float, x: int, y: int, ex: int, ey: int
|
|
87
|
+
) -> bool:
|
|
88
|
+
"""多点比色
|
|
89
|
+
|
|
90
|
+
参数:
|
|
91
|
+
points: "x|y|主色-偏色,..."
|
|
92
|
+
threshold: 0.0-1.0
|
|
93
|
+
x/y/ex/ey: 区域坐标
|
|
94
|
+
返回:
|
|
95
|
+
bool: 是否相同
|
|
96
|
+
"""
|
|
97
|
+
...
|
|
98
|
+
|
|
99
|
+
def find_color(
|
|
100
|
+
id: str,
|
|
101
|
+
color: str,
|
|
102
|
+
threshold: float,
|
|
103
|
+
x: int,
|
|
104
|
+
y: int,
|
|
105
|
+
ex: int,
|
|
106
|
+
ey: int,
|
|
107
|
+
limit: int,
|
|
108
|
+
orz: int,
|
|
109
|
+
) -> List[Point]:
|
|
110
|
+
"""单点找色(返回点坐标列表)"""
|
|
111
|
+
...
|
|
112
|
+
|
|
113
|
+
# 多点找色(返回点坐标列表)
|
|
114
|
+
def find_multi_color(
|
|
115
|
+
id: str,
|
|
116
|
+
firstColor: str,
|
|
117
|
+
threshold: float,
|
|
118
|
+
points: str,
|
|
119
|
+
x: int,
|
|
120
|
+
y: int,
|
|
121
|
+
ex: int,
|
|
122
|
+
ey: int,
|
|
123
|
+
limit: int,
|
|
124
|
+
orz: int,
|
|
125
|
+
) -> List[Point]:
|
|
126
|
+
"""多点找色(返回点坐标列表)"""
|
|
127
|
+
...
|
|
128
|
+
|
|
129
|
+
def find_image(
|
|
130
|
+
id: str,
|
|
131
|
+
templateImageId: str,
|
|
132
|
+
x: int,
|
|
133
|
+
y: int,
|
|
134
|
+
ex: int,
|
|
135
|
+
ey: int,
|
|
136
|
+
threshold: float,
|
|
137
|
+
limit: int,
|
|
138
|
+
method: int,
|
|
139
|
+
rgb: bool = ...,
|
|
140
|
+
) -> List[Rect]:
|
|
141
|
+
"""找图(返回矩形列表)
|
|
142
|
+
|
|
143
|
+
参数默认值:
|
|
144
|
+
rgb: False
|
|
145
|
+
"""
|
|
146
|
+
...
|
|
147
|
+
|
|
148
|
+
# 获取像素颜色(返回整数RGB)
|
|
149
|
+
def pixel(id: str, x: int, y: int) -> int:
|
|
150
|
+
"""获取像素颜色(整数 RGB)"""
|
|
151
|
+
...
|
|
152
|
+
|
|
153
|
+
# 颜色值转16进制字符串(#RRGGBB)
|
|
154
|
+
def argb(color: int) -> str:
|
|
155
|
+
"""颜色值转 16 进制字符串(#RRGGBB)"""
|
|
156
|
+
...
|
|
157
|
+
|
|
158
|
+
# 二值化/灰度化图片(返回新ID)
|
|
159
|
+
def binaryzation(id: str, threshold: float) -> Optional[str]:
|
|
160
|
+
"""二值化图片(返回新ID)"""
|
|
161
|
+
...
|
|
162
|
+
|
|
163
|
+
def gray(id: str) -> Optional[str]:
|
|
164
|
+
"""灰度化图片(返回新ID)"""
|
|
165
|
+
...
|
|
166
|
+
|
|
167
|
+
# 扫描条码/二维码(返回识别文本)
|
|
168
|
+
def scan_code(id: str) -> Optional[str]:
|
|
169
|
+
"""扫描条码/二维码(返回识别文本)"""
|
|
170
|
+
...
|
|
171
|
+
|
|
172
|
+
# 在图片上绘制矩形(直接修改原图)
|
|
173
|
+
def draw_rect(
|
|
174
|
+
id: str, x: int, y: int, ex: int, ey: int, color: str, thickness: int
|
|
175
|
+
) -> bool:
|
|
176
|
+
"""在图片上绘制矩形(直接修改原图)"""
|
|
177
|
+
...
|
kuaijs/ime.pyi
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# 输入法是否可用
|
|
2
|
+
def is_ok() -> bool:
|
|
3
|
+
"""输入法是否可用(键盘是否已弹出)"""
|
|
4
|
+
...
|
|
5
|
+
|
|
6
|
+
# 获取/清空输入框文本
|
|
7
|
+
def get_text() -> str:
|
|
8
|
+
"""获取当前输入框文本"""
|
|
9
|
+
...
|
|
10
|
+
|
|
11
|
+
def clear_text() -> bool:
|
|
12
|
+
"""清空输入框文本"""
|
|
13
|
+
...
|
|
14
|
+
|
|
15
|
+
# 输入/粘贴文本(content为空时使用剪切板)
|
|
16
|
+
def input(content: str) -> str:
|
|
17
|
+
"""输入文本(content 为空时使用剪贴板)"""
|
|
18
|
+
...
|
|
19
|
+
|
|
20
|
+
def paste(content: str = ...) -> str:
|
|
21
|
+
"""粘贴文本(content 为空时使用剪贴板)"""
|
|
22
|
+
...
|
|
23
|
+
|
|
24
|
+
# 删除一个字符/回车/隐藏键盘
|
|
25
|
+
def press_del() -> str:
|
|
26
|
+
"""删除一个字符(返回剩余文本;空表示无数据)"""
|
|
27
|
+
...
|
|
28
|
+
|
|
29
|
+
def press_enter() -> bool:
|
|
30
|
+
"""回车键"""
|
|
31
|
+
...
|
|
32
|
+
|
|
33
|
+
def dismiss() -> bool:
|
|
34
|
+
"""隐藏键盘"""
|
|
35
|
+
...
|
|
36
|
+
|
|
37
|
+
# 剪切板读写
|
|
38
|
+
def get_clipboard() -> str:
|
|
39
|
+
"""获取剪贴板"""
|
|
40
|
+
...
|
|
41
|
+
|
|
42
|
+
def set_clipboard(content: str) -> bool:
|
|
43
|
+
"""设置剪贴板(键盘显示时)"""
|
|
44
|
+
...
|
|
45
|
+
|
|
46
|
+
# 切换输入法
|
|
47
|
+
def switch_keyboard() -> bool:
|
|
48
|
+
"""切换输入法"""
|
|
49
|
+
...
|
kuaijs/logger.pyi
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
def set_logger_level(level: str) -> bool:
|
|
2
|
+
"""设置日志级别
|
|
3
|
+
|
|
4
|
+
参数:
|
|
5
|
+
level: 日志级别(error|warn|info|debug|off)
|
|
6
|
+
返回:
|
|
7
|
+
bool: 是否设置成功
|
|
8
|
+
"""
|
|
9
|
+
...
|
|
10
|
+
|
|
11
|
+
def set_log_to_file(enabled: bool) -> bool:
|
|
12
|
+
"""设置是否输出到日志文件
|
|
13
|
+
|
|
14
|
+
参数:
|
|
15
|
+
enabled: True 启用文件输出;False 关闭文件输出
|
|
16
|
+
返回:
|
|
17
|
+
bool: 是否设置成功
|
|
18
|
+
"""
|
|
19
|
+
...
|
|
20
|
+
|
|
21
|
+
def set_max_log_file_count(count: int) -> bool:
|
|
22
|
+
"""设置最大日志文件数量(默认 10 个)"""
|
|
23
|
+
...
|
|
24
|
+
|
|
25
|
+
def set_max_log_file_size(size: int) -> bool:
|
|
26
|
+
"""设置最大日志文件大小(单位 MB,默认 10MB)"""
|
|
27
|
+
...
|
|
28
|
+
|
|
29
|
+
def reset_log_file() -> bool:
|
|
30
|
+
"""重置日志文件(创建新文件并开始写入)"""
|
|
31
|
+
...
|
|
32
|
+
|
|
33
|
+
def debug(*args: object) -> bool:
|
|
34
|
+
"""输出调试日志(将参数按空格拼接为字符串)"""
|
|
35
|
+
...
|
|
36
|
+
|
|
37
|
+
def info(*args: object) -> bool:
|
|
38
|
+
"""输出信息日志(将参数按空格拼接为字符串)"""
|
|
39
|
+
...
|
|
40
|
+
|
|
41
|
+
def warn(*args: object) -> bool:
|
|
42
|
+
"""输出警告日志(将参数按空格拼接为字符串)"""
|
|
43
|
+
...
|
|
44
|
+
|
|
45
|
+
def error(*args: object) -> bool:
|
|
46
|
+
"""输出错误日志(将参数按空格拼接为字符串)"""
|
|
47
|
+
...
|
kuaijs/media.pyi
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"""媒体管理:相册与音频"""
|
|
2
|
+
|
|
3
|
+
# 保存图片/视频到相册
|
|
4
|
+
def save_image_to_album(imageId: str) -> bool:
|
|
5
|
+
"""保存图像到相册"""
|
|
6
|
+
...
|
|
7
|
+
|
|
8
|
+
def save_video_to_album_path(path: str) -> bool:
|
|
9
|
+
"""保存视频路径到相册"""
|
|
10
|
+
...
|
|
11
|
+
|
|
12
|
+
# 清空相册图片/视频
|
|
13
|
+
def delete_all_photos() -> bool:
|
|
14
|
+
"""清空相册中的图片"""
|
|
15
|
+
...
|
|
16
|
+
|
|
17
|
+
def delete_all_videos() -> bool:
|
|
18
|
+
"""清空相册中的视频"""
|
|
19
|
+
...
|
|
20
|
+
|
|
21
|
+
# 播放/停止MP3;同步播放(等待结束)
|
|
22
|
+
def play_mp3(path: str, loop: bool) -> bool:
|
|
23
|
+
"""播放 MP3(异步)"""
|
|
24
|
+
...
|
|
25
|
+
|
|
26
|
+
def stop_mp3() -> bool:
|
|
27
|
+
"""停止播放 MP3"""
|
|
28
|
+
...
|
|
29
|
+
|
|
30
|
+
def play_mp3_wait_end(path: str, loop: bool) -> bool:
|
|
31
|
+
"""同步播放 MP3(等待结束)"""
|
|
32
|
+
...
|
kuaijs/mysql.pyi
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
from typing import Any, List, Dict, Optional, Protocol
|
|
2
|
+
|
|
3
|
+
# 连接配置:host/port/username/password/database/charset
|
|
4
|
+
class MySQLConfig(Protocol):
|
|
5
|
+
host: str
|
|
6
|
+
port: Optional[int]
|
|
7
|
+
username: str
|
|
8
|
+
password: str
|
|
9
|
+
database: str
|
|
10
|
+
charset: Optional[str]
|
|
11
|
+
|
|
12
|
+
# 查询/执行,返回对象:rows/affectedRows/insertId/success/error
|
|
13
|
+
class MySQLResult(Protocol):
|
|
14
|
+
rows: List[Dict[str, Any]]
|
|
15
|
+
affectedRows: int
|
|
16
|
+
success: bool
|
|
17
|
+
insertId: Optional[int]
|
|
18
|
+
error: Optional[str]
|
|
19
|
+
|
|
20
|
+
def connect(config: MySQLConfig) -> bool:
|
|
21
|
+
"""连接到数据库"""
|
|
22
|
+
...
|
|
23
|
+
|
|
24
|
+
def disconnect() -> None:
|
|
25
|
+
"""断开数据库连接"""
|
|
26
|
+
...
|
|
27
|
+
|
|
28
|
+
def is_connected() -> bool:
|
|
29
|
+
"""检查连接状态"""
|
|
30
|
+
...
|
|
31
|
+
|
|
32
|
+
def query(sql: str, params: List[Any] = ...) -> MySQLResult:
|
|
33
|
+
"""执行查询(SELECT)"""
|
|
34
|
+
...
|
|
35
|
+
|
|
36
|
+
def execute(sql: str, params: List[Any] = ...) -> MySQLResult:
|
|
37
|
+
"""执行更新(INSERT/UPDATE/DELETE)"""
|
|
38
|
+
...
|
|
39
|
+
|
|
40
|
+
# 事务控制
|
|
41
|
+
def begin_transaction() -> bool:
|
|
42
|
+
"""开始事务"""
|
|
43
|
+
...
|
|
44
|
+
|
|
45
|
+
def commit() -> bool:
|
|
46
|
+
"""提交事务"""
|
|
47
|
+
...
|
|
48
|
+
|
|
49
|
+
def rollback() -> bool:
|
|
50
|
+
"""回滚事务"""
|
|
51
|
+
...
|
kuaijs/netcard.pyi
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
from typing import Optional, Protocol
|
|
2
|
+
|
|
3
|
+
class CardInfo(Protocol):
|
|
4
|
+
cardNo: str
|
|
5
|
+
batchCard: str
|
|
6
|
+
remark: str
|
|
7
|
+
activeTime: str
|
|
8
|
+
expireTime: str
|
|
9
|
+
|
|
10
|
+
# 验证卡密;获取卡密信息;设置备注
|
|
11
|
+
def verify(cardNo: str) -> bool:
|
|
12
|
+
"""验证卡密"""
|
|
13
|
+
...
|
|
14
|
+
|
|
15
|
+
def get_card_info() -> Optional[CardInfo]:
|
|
16
|
+
"""获取卡密信息(验证通过后可用)"""
|
|
17
|
+
...
|
|
18
|
+
|
|
19
|
+
def set_card_remark(remark: str) -> bool:
|
|
20
|
+
"""设置卡密备注"""
|
|
21
|
+
...
|
|
22
|
+
|
|
23
|
+
# KV 存取
|
|
24
|
+
def set_value(key: str, value: str) -> str:
|
|
25
|
+
"""设置值(成功返回设置的 value)"""
|
|
26
|
+
...
|
|
27
|
+
|
|
28
|
+
def get_value(key: str) -> str:
|
|
29
|
+
"""获取值(失败返回空字符串)"""
|
|
30
|
+
...
|