MaaFw 3.0.3__py3-none-win_arm64.whl → 4.0.0b3__py3-none-win_arm64.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.
Potentially problematic release.
This version of MaaFw might be problematic. Click here for more details.
- maa/__init__.py +1 -1
- maa/agent/__init__.py +12 -0
- maa/agent/agent_server.py +132 -0
- maa/agent_client.py +91 -0
- maa/bin/DirectML.dll +0 -0
- maa/bin/MaaAdbControlUnit.dll +0 -0
- maa/bin/MaaAgentClient.dll +0 -0
- maa/bin/MaaAgentServer.dll +0 -0
- maa/bin/MaaDbgControlUnit.dll +0 -0
- maa/bin/MaaFramework.dll +0 -0
- maa/bin/MaaToolkit.dll +0 -0
- maa/bin/MaaUtils.dll +0 -0
- maa/bin/MaaWin32ControlUnit.dll +0 -0
- maa/bin/fastdeploy_ppocr_maa.dll +0 -0
- maa/bin/onnxruntime_maa.dll +0 -0
- maa/bin/opencv_world4_maa.dll +0 -0
- maa/buffer.py +129 -131
- maa/context.py +24 -24
- maa/controller.py +70 -70
- maa/define.py +15 -12
- maa/library.py +103 -15
- maa/notification_handler.py +3 -3
- maa/resource.py +47 -47
- maa/tasker.py +63 -61
- maa/toolkit.py +82 -78
- {MaaFw-3.0.3.dist-info → maafw-4.0.0b3.dist-info}/METADATA +20 -3
- maafw-4.0.0b3.dist-info/RECORD +33 -0
- maafw-4.0.0b3.dist-info/WHEEL +4 -0
- MaaFw-3.0.3.dist-info/RECORD +0 -28
- MaaFw-3.0.3.dist-info/WHEEL +0 -4
- {MaaFw-3.0.3.dist-info → maafw-4.0.0b3.dist-info}/LICENSE.md +0 -0
- {MaaFw-3.0.3.dist-info → maafw-4.0.0b3.dist-info}/top_level.txt +0 -0
maa/buffer.py
CHANGED
|
@@ -19,7 +19,7 @@ class StringBuffer:
|
|
|
19
19
|
self._handle = handle
|
|
20
20
|
self._own = False
|
|
21
21
|
else:
|
|
22
|
-
self._handle = Library.framework.MaaStringBufferCreate()
|
|
22
|
+
self._handle = Library.framework().MaaStringBufferCreate()
|
|
23
23
|
self._own = True
|
|
24
24
|
|
|
25
25
|
if not self._handle:
|
|
@@ -27,26 +27,26 @@ class StringBuffer:
|
|
|
27
27
|
|
|
28
28
|
def __del__(self):
|
|
29
29
|
if self._handle and self._own:
|
|
30
|
-
Library.framework.MaaStringBufferDestroy(self._handle)
|
|
30
|
+
Library.framework().MaaStringBufferDestroy(self._handle)
|
|
31
31
|
|
|
32
32
|
def get(self) -> str:
|
|
33
|
-
buff = Library.framework.MaaStringBufferGet(self._handle)
|
|
34
|
-
sz = Library.framework.MaaStringBufferSize(self._handle)
|
|
33
|
+
buff = Library.framework().MaaStringBufferGet(self._handle)
|
|
34
|
+
sz = Library.framework().MaaStringBufferSize(self._handle)
|
|
35
35
|
return ctypes.string_at(buff, sz).decode()
|
|
36
36
|
|
|
37
37
|
def set(self, value: Union[str, bytes]) -> bool:
|
|
38
38
|
if isinstance(value, str):
|
|
39
39
|
value = value.encode()
|
|
40
40
|
return bool(
|
|
41
|
-
Library.framework.MaaStringBufferSetEx(self._handle, value, len(value))
|
|
41
|
+
Library.framework().MaaStringBufferSetEx(self._handle, value, len(value))
|
|
42
42
|
)
|
|
43
43
|
|
|
44
44
|
@property
|
|
45
45
|
def empty(self) -> bool:
|
|
46
|
-
return bool(Library.framework.MaaStringBufferIsEmpty(self._handle))
|
|
46
|
+
return bool(Library.framework().MaaStringBufferIsEmpty(self._handle))
|
|
47
47
|
|
|
48
48
|
def clear(self) -> bool:
|
|
49
|
-
return bool(Library.framework.MaaStringBufferClear(self._handle))
|
|
49
|
+
return bool(Library.framework().MaaStringBufferClear(self._handle))
|
|
50
50
|
|
|
51
51
|
_api_properties_initialized: bool = False
|
|
52
52
|
|
|
@@ -56,32 +56,32 @@ class StringBuffer:
|
|
|
56
56
|
return
|
|
57
57
|
StringBuffer._api_properties_initialized = True
|
|
58
58
|
|
|
59
|
-
Library.framework.MaaStringBufferCreate.restype = MaaStringBufferHandle
|
|
60
|
-
Library.framework.MaaStringBufferCreate.argtypes = []
|
|
59
|
+
Library.framework().MaaStringBufferCreate.restype = MaaStringBufferHandle
|
|
60
|
+
Library.framework().MaaStringBufferCreate.argtypes = []
|
|
61
61
|
|
|
62
|
-
Library.framework.MaaStringBufferDestroy.restype = None
|
|
63
|
-
Library.framework.MaaStringBufferDestroy.argtypes = [MaaStringBufferHandle]
|
|
62
|
+
Library.framework().MaaStringBufferDestroy.restype = None
|
|
63
|
+
Library.framework().MaaStringBufferDestroy.argtypes = [MaaStringBufferHandle]
|
|
64
64
|
|
|
65
|
-
Library.framework.MaaStringBufferIsEmpty.restype = MaaBool
|
|
66
|
-
Library.framework.MaaStringBufferIsEmpty.argtypes = [MaaStringBufferHandle]
|
|
65
|
+
Library.framework().MaaStringBufferIsEmpty.restype = MaaBool
|
|
66
|
+
Library.framework().MaaStringBufferIsEmpty.argtypes = [MaaStringBufferHandle]
|
|
67
67
|
|
|
68
|
-
Library.framework.MaaStringBufferClear.restype = MaaBool
|
|
69
|
-
Library.framework.MaaStringBufferClear.argtypes = [MaaStringBufferHandle]
|
|
68
|
+
Library.framework().MaaStringBufferClear.restype = MaaBool
|
|
69
|
+
Library.framework().MaaStringBufferClear.argtypes = [MaaStringBufferHandle]
|
|
70
70
|
|
|
71
|
-
Library.framework.MaaStringBufferGet.restype = ctypes.c_char_p
|
|
72
|
-
Library.framework.MaaStringBufferGet.argtypes = [MaaStringBufferHandle]
|
|
71
|
+
Library.framework().MaaStringBufferGet.restype = ctypes.c_char_p
|
|
72
|
+
Library.framework().MaaStringBufferGet.argtypes = [MaaStringBufferHandle]
|
|
73
73
|
|
|
74
|
-
Library.framework.MaaStringBufferSize.restype = MaaSize
|
|
75
|
-
Library.framework.MaaStringBufferSize.argtypes = [MaaStringBufferHandle]
|
|
74
|
+
Library.framework().MaaStringBufferSize.restype = MaaSize
|
|
75
|
+
Library.framework().MaaStringBufferSize.argtypes = [MaaStringBufferHandle]
|
|
76
76
|
|
|
77
|
-
Library.framework.MaaStringBufferSet.restype = MaaBool
|
|
78
|
-
Library.framework.MaaStringBufferSet.argtypes = [
|
|
77
|
+
Library.framework().MaaStringBufferSet.restype = MaaBool
|
|
78
|
+
Library.framework().MaaStringBufferSet.argtypes = [
|
|
79
79
|
MaaStringBufferHandle,
|
|
80
80
|
ctypes.c_char_p,
|
|
81
81
|
]
|
|
82
82
|
|
|
83
|
-
Library.framework.MaaStringBufferSetEx.restype = MaaBool
|
|
84
|
-
Library.framework.MaaStringBufferSetEx.argtypes = [
|
|
83
|
+
Library.framework().MaaStringBufferSetEx.restype = MaaBool
|
|
84
|
+
Library.framework().MaaStringBufferSetEx.argtypes = [
|
|
85
85
|
MaaStringBufferHandle,
|
|
86
86
|
ctypes.c_char_p,
|
|
87
87
|
MaaSize,
|
|
@@ -99,7 +99,7 @@ class StringListBuffer:
|
|
|
99
99
|
self._handle = handle
|
|
100
100
|
self._own = False
|
|
101
101
|
else:
|
|
102
|
-
self._handle = Library.framework.MaaStringListBufferCreate()
|
|
102
|
+
self._handle = Library.framework().MaaStringListBufferCreate()
|
|
103
103
|
self._own = True
|
|
104
104
|
|
|
105
105
|
if not self._handle:
|
|
@@ -107,25 +107,21 @@ class StringListBuffer:
|
|
|
107
107
|
|
|
108
108
|
def __del__(self):
|
|
109
109
|
if self._handle and self._own:
|
|
110
|
-
Library.framework.MaaStringListBufferDestroy(self._handle)
|
|
110
|
+
Library.framework().MaaStringListBufferDestroy(self._handle)
|
|
111
111
|
|
|
112
112
|
def get(self) -> List[str]:
|
|
113
|
-
count = Library.framework.MaaStringListBufferSize(self._handle)
|
|
113
|
+
count = Library.framework().MaaStringListBufferSize(self._handle)
|
|
114
114
|
result = []
|
|
115
115
|
for i in range(count):
|
|
116
|
-
buff = Library.framework.MaaStringListBufferAt(self._handle, i)
|
|
116
|
+
buff = Library.framework().MaaStringListBufferAt(self._handle, i)
|
|
117
117
|
s = StringBuffer(buff).get()
|
|
118
118
|
result.append(s)
|
|
119
119
|
return result
|
|
120
120
|
|
|
121
121
|
def set(self, value: List[str]) -> bool:
|
|
122
|
-
|
|
122
|
+
self.clear()
|
|
123
123
|
for s in value:
|
|
124
|
-
|
|
125
|
-
buff.set(s)
|
|
126
|
-
if not Library.framework.MaaStringListBufferAppend(
|
|
127
|
-
self._handle, buff._handle
|
|
128
|
-
):
|
|
124
|
+
if not self.append(s):
|
|
129
125
|
return False
|
|
130
126
|
return True
|
|
131
127
|
|
|
@@ -133,14 +129,14 @@ class StringListBuffer:
|
|
|
133
129
|
buff = StringBuffer()
|
|
134
130
|
buff.set(value)
|
|
135
131
|
return bool(
|
|
136
|
-
Library.framework.MaaStringListBufferAppend(self._handle, buff._handle)
|
|
132
|
+
Library.framework().MaaStringListBufferAppend(self._handle, buff._handle)
|
|
137
133
|
)
|
|
138
134
|
|
|
139
135
|
def remove(self, index: int) -> bool:
|
|
140
|
-
return bool(Library.framework.MaaStringListBufferRemove(self._handle, index))
|
|
136
|
+
return bool(Library.framework().MaaStringListBufferRemove(self._handle, index))
|
|
141
137
|
|
|
142
138
|
def clear(self) -> bool:
|
|
143
|
-
return bool(Library.framework.MaaStringListBufferClear(self._handle))
|
|
139
|
+
return bool(Library.framework().MaaStringListBufferClear(self._handle))
|
|
144
140
|
|
|
145
141
|
_api_properties_initialized: bool = False
|
|
146
142
|
|
|
@@ -150,41 +146,45 @@ class StringListBuffer:
|
|
|
150
146
|
return
|
|
151
147
|
StringListBuffer._api_properties_initialized = True
|
|
152
148
|
|
|
153
|
-
Library.framework.MaaStringListBufferCreate.restype =
|
|
154
|
-
|
|
149
|
+
Library.framework().MaaStringListBufferCreate.restype = (
|
|
150
|
+
MaaStringListBufferHandle
|
|
151
|
+
)
|
|
152
|
+
Library.framework().MaaStringListBufferCreate.argtypes = []
|
|
155
153
|
|
|
156
|
-
Library.framework.MaaStringListBufferDestroy.restype = None
|
|
157
|
-
Library.framework.MaaStringListBufferDestroy.argtypes = [
|
|
154
|
+
Library.framework().MaaStringListBufferDestroy.restype = None
|
|
155
|
+
Library.framework().MaaStringListBufferDestroy.argtypes = [
|
|
158
156
|
MaaStringListBufferHandle
|
|
159
157
|
]
|
|
160
158
|
|
|
161
|
-
Library.framework.MaaStringListBufferIsEmpty.restype = MaaBool
|
|
162
|
-
Library.framework.MaaStringListBufferIsEmpty.argtypes = [
|
|
159
|
+
Library.framework().MaaStringListBufferIsEmpty.restype = MaaBool
|
|
160
|
+
Library.framework().MaaStringListBufferIsEmpty.argtypes = [
|
|
163
161
|
MaaStringListBufferHandle
|
|
164
162
|
]
|
|
165
163
|
|
|
166
|
-
Library.framework.MaaStringListBufferClear.restype = MaaBool
|
|
167
|
-
Library.framework.MaaStringListBufferClear.argtypes = [
|
|
164
|
+
Library.framework().MaaStringListBufferClear.restype = MaaBool
|
|
165
|
+
Library.framework().MaaStringListBufferClear.argtypes = [
|
|
168
166
|
MaaStringListBufferHandle
|
|
169
167
|
]
|
|
170
168
|
|
|
171
|
-
Library.framework.MaaStringListBufferSize.restype = MaaSize
|
|
172
|
-
Library.framework.MaaStringListBufferSize.argtypes = [
|
|
169
|
+
Library.framework().MaaStringListBufferSize.restype = MaaSize
|
|
170
|
+
Library.framework().MaaStringListBufferSize.argtypes = [
|
|
171
|
+
MaaStringListBufferHandle
|
|
172
|
+
]
|
|
173
173
|
|
|
174
|
-
Library.framework.
|
|
175
|
-
Library.framework.
|
|
174
|
+
Library.framework().MaaStringListBufferAt.restype = MaaStringBufferHandle
|
|
175
|
+
Library.framework().MaaStringListBufferAt.argtypes = [
|
|
176
176
|
MaaStringListBufferHandle,
|
|
177
177
|
MaaSize,
|
|
178
178
|
]
|
|
179
179
|
|
|
180
|
-
Library.framework.MaaStringListBufferAppend.restype = MaaBool
|
|
181
|
-
Library.framework.MaaStringListBufferAppend.argtypes = [
|
|
180
|
+
Library.framework().MaaStringListBufferAppend.restype = MaaBool
|
|
181
|
+
Library.framework().MaaStringListBufferAppend.argtypes = [
|
|
182
182
|
MaaStringListBufferHandle,
|
|
183
183
|
MaaStringBufferHandle,
|
|
184
184
|
]
|
|
185
185
|
|
|
186
|
-
Library.framework.MaaStringListBufferRemove.restype = MaaBool
|
|
187
|
-
Library.framework.MaaStringListBufferRemove.argtypes = [
|
|
186
|
+
Library.framework().MaaStringListBufferRemove.restype = MaaBool
|
|
187
|
+
Library.framework().MaaStringListBufferRemove.argtypes = [
|
|
188
188
|
MaaStringListBufferHandle,
|
|
189
189
|
MaaSize,
|
|
190
190
|
]
|
|
@@ -201,7 +201,7 @@ class ImageBuffer:
|
|
|
201
201
|
self._handle = c_handle
|
|
202
202
|
self._own = False
|
|
203
203
|
else:
|
|
204
|
-
self._handle = Library.framework.MaaImageBufferCreate()
|
|
204
|
+
self._handle = Library.framework().MaaImageBufferCreate()
|
|
205
205
|
self._own = True
|
|
206
206
|
|
|
207
207
|
if not self._handle:
|
|
@@ -209,16 +209,16 @@ class ImageBuffer:
|
|
|
209
209
|
|
|
210
210
|
def __del__(self):
|
|
211
211
|
if self._handle and self._own:
|
|
212
|
-
Library.framework.MaaImageBufferDestroy(self._handle)
|
|
212
|
+
Library.framework().MaaImageBufferDestroy(self._handle)
|
|
213
213
|
|
|
214
214
|
def get(self) -> numpy.ndarray:
|
|
215
|
-
buff = Library.framework.MaaImageBufferGetRawData(self._handle)
|
|
215
|
+
buff = Library.framework().MaaImageBufferGetRawData(self._handle)
|
|
216
216
|
if not buff:
|
|
217
217
|
return numpy.ndarray((0, 0, 3), dtype=numpy.uint8)
|
|
218
218
|
|
|
219
|
-
w = Library.framework.MaaImageBufferWidth(self._handle)
|
|
220
|
-
h = Library.framework.MaaImageBufferHeight(self._handle)
|
|
221
|
-
c = Library.framework.MaaImageBufferChannels(self._handle)
|
|
219
|
+
w = Library.framework().MaaImageBufferWidth(self._handle)
|
|
220
|
+
h = Library.framework().MaaImageBufferHeight(self._handle)
|
|
221
|
+
c = Library.framework().MaaImageBufferChannels(self._handle)
|
|
222
222
|
return copy.deepcopy(
|
|
223
223
|
numpy.ctypeslib.as_array(
|
|
224
224
|
ctypes.cast(buff, ctypes.POINTER(ctypes.c_uint8)), shape=(h, w, c)
|
|
@@ -230,7 +230,7 @@ class ImageBuffer:
|
|
|
230
230
|
raise TypeError("value must be a numpy.ndarray")
|
|
231
231
|
|
|
232
232
|
return bool(
|
|
233
|
-
Library.framework.MaaImageBufferSetRawData(
|
|
233
|
+
Library.framework().MaaImageBufferSetRawData(
|
|
234
234
|
self._handle,
|
|
235
235
|
value.ctypes.data,
|
|
236
236
|
value.shape[1],
|
|
@@ -241,10 +241,10 @@ class ImageBuffer:
|
|
|
241
241
|
|
|
242
242
|
@property
|
|
243
243
|
def empty(self) -> bool:
|
|
244
|
-
return bool(Library.framework.MaaImageBufferIsEmpty(self._handle))
|
|
244
|
+
return bool(Library.framework().MaaImageBufferIsEmpty(self._handle))
|
|
245
245
|
|
|
246
246
|
def clear(self) -> bool:
|
|
247
|
-
return bool(Library.framework.MaaImageBufferClear(self._handle))
|
|
247
|
+
return bool(Library.framework().MaaImageBufferClear(self._handle))
|
|
248
248
|
|
|
249
249
|
_api_properties_initialized: bool = False
|
|
250
250
|
|
|
@@ -254,29 +254,29 @@ class ImageBuffer:
|
|
|
254
254
|
return
|
|
255
255
|
ImageBuffer._api_properties_initialized = True
|
|
256
256
|
|
|
257
|
-
Library.framework.MaaImageBufferCreate.restype = MaaImageBufferHandle
|
|
258
|
-
Library.framework.MaaImageBufferCreate.argtypes = []
|
|
257
|
+
Library.framework().MaaImageBufferCreate.restype = MaaImageBufferHandle
|
|
258
|
+
Library.framework().MaaImageBufferCreate.argtypes = []
|
|
259
259
|
|
|
260
|
-
Library.framework.MaaImageBufferDestroy.restype = None
|
|
261
|
-
Library.framework.MaaImageBufferDestroy.argtypes = [MaaImageBufferHandle]
|
|
260
|
+
Library.framework().MaaImageBufferDestroy.restype = None
|
|
261
|
+
Library.framework().MaaImageBufferDestroy.argtypes = [MaaImageBufferHandle]
|
|
262
262
|
|
|
263
|
-
Library.framework.MaaImageBufferGetRawData.restype = ctypes.c_void_p
|
|
264
|
-
Library.framework.MaaImageBufferGetRawData.argtypes = [MaaImageBufferHandle]
|
|
263
|
+
Library.framework().MaaImageBufferGetRawData.restype = ctypes.c_void_p
|
|
264
|
+
Library.framework().MaaImageBufferGetRawData.argtypes = [MaaImageBufferHandle]
|
|
265
265
|
|
|
266
|
-
Library.framework.MaaImageBufferWidth.restype = ctypes.c_int32
|
|
267
|
-
Library.framework.MaaImageBufferWidth.argtypes = [MaaImageBufferHandle]
|
|
266
|
+
Library.framework().MaaImageBufferWidth.restype = ctypes.c_int32
|
|
267
|
+
Library.framework().MaaImageBufferWidth.argtypes = [MaaImageBufferHandle]
|
|
268
268
|
|
|
269
|
-
Library.framework.MaaImageBufferHeight.restype = ctypes.c_int32
|
|
270
|
-
Library.framework.MaaImageBufferHeight.argtypes = [MaaImageBufferHandle]
|
|
269
|
+
Library.framework().MaaImageBufferHeight.restype = ctypes.c_int32
|
|
270
|
+
Library.framework().MaaImageBufferHeight.argtypes = [MaaImageBufferHandle]
|
|
271
271
|
|
|
272
|
-
Library.framework.MaaImageBufferChannels.restype = ctypes.c_int32
|
|
273
|
-
Library.framework.MaaImageBufferChannels.argtypes = [MaaImageBufferHandle]
|
|
272
|
+
Library.framework().MaaImageBufferChannels.restype = ctypes.c_int32
|
|
273
|
+
Library.framework().MaaImageBufferChannels.argtypes = [MaaImageBufferHandle]
|
|
274
274
|
|
|
275
|
-
Library.framework.MaaImageBufferType.restype = ctypes.c_int32
|
|
276
|
-
Library.framework.MaaImageBufferType.argtypes = [MaaImageBufferHandle]
|
|
275
|
+
Library.framework().MaaImageBufferType.restype = ctypes.c_int32
|
|
276
|
+
Library.framework().MaaImageBufferType.argtypes = [MaaImageBufferHandle]
|
|
277
277
|
|
|
278
|
-
Library.framework.MaaImageBufferSetRawData.restype = MaaBool
|
|
279
|
-
Library.framework.MaaImageBufferSetRawData.argtypes = [
|
|
278
|
+
Library.framework().MaaImageBufferSetRawData.restype = MaaBool
|
|
279
|
+
Library.framework().MaaImageBufferSetRawData.argtypes = [
|
|
280
280
|
MaaImageBufferHandle,
|
|
281
281
|
ctypes.c_void_p,
|
|
282
282
|
ctypes.c_int32,
|
|
@@ -284,11 +284,11 @@ class ImageBuffer:
|
|
|
284
284
|
ctypes.c_int32,
|
|
285
285
|
]
|
|
286
286
|
|
|
287
|
-
Library.framework.MaaImageBufferIsEmpty.restype = MaaBool
|
|
288
|
-
Library.framework.MaaImageBufferIsEmpty.argtypes = [MaaImageBufferHandle]
|
|
287
|
+
Library.framework().MaaImageBufferIsEmpty.restype = MaaBool
|
|
288
|
+
Library.framework().MaaImageBufferIsEmpty.argtypes = [MaaImageBufferHandle]
|
|
289
289
|
|
|
290
|
-
Library.framework.MaaImageBufferClear.restype = MaaBool
|
|
291
|
-
Library.framework.MaaImageBufferClear.argtypes = [MaaImageBufferHandle]
|
|
290
|
+
Library.framework().MaaImageBufferClear.restype = MaaBool
|
|
291
|
+
Library.framework().MaaImageBufferClear.argtypes = [MaaImageBufferHandle]
|
|
292
292
|
|
|
293
293
|
|
|
294
294
|
class ImageListBuffer:
|
|
@@ -302,7 +302,7 @@ class ImageListBuffer:
|
|
|
302
302
|
self._handle = c_handle
|
|
303
303
|
self._own = False
|
|
304
304
|
else:
|
|
305
|
-
self._handle = Library.framework.MaaImageListBufferCreate()
|
|
305
|
+
self._handle = Library.framework().MaaImageListBufferCreate()
|
|
306
306
|
self._own = True
|
|
307
307
|
|
|
308
308
|
if not self._handle:
|
|
@@ -310,25 +310,21 @@ class ImageListBuffer:
|
|
|
310
310
|
|
|
311
311
|
def __del__(self):
|
|
312
312
|
if self._handle and self._own:
|
|
313
|
-
Library.framework.MaaImageListBufferDestroy(self._handle)
|
|
313
|
+
Library.framework().MaaImageListBufferDestroy(self._handle)
|
|
314
314
|
|
|
315
315
|
def get(self) -> List[numpy.ndarray]:
|
|
316
|
-
count = Library.framework.MaaImageListBufferSize(self._handle)
|
|
316
|
+
count = Library.framework().MaaImageListBufferSize(self._handle)
|
|
317
317
|
result = []
|
|
318
318
|
for i in range(count):
|
|
319
|
-
buff = Library.framework.MaaImageListBufferAt(self._handle, i)
|
|
319
|
+
buff = Library.framework().MaaImageListBufferAt(self._handle, i)
|
|
320
320
|
img = ImageBuffer(buff).get()
|
|
321
321
|
result.append(img)
|
|
322
322
|
return result
|
|
323
323
|
|
|
324
324
|
def set(self, value: List[numpy.ndarray]) -> bool:
|
|
325
|
-
|
|
325
|
+
self.clear()
|
|
326
326
|
for img in value:
|
|
327
|
-
|
|
328
|
-
buff.set(img)
|
|
329
|
-
if not Library.framework.MaaImageListBufferAppend(
|
|
330
|
-
self._handle, buff._handle
|
|
331
|
-
):
|
|
327
|
+
if not self.append(img):
|
|
332
328
|
return False
|
|
333
329
|
return True
|
|
334
330
|
|
|
@@ -336,14 +332,14 @@ class ImageListBuffer:
|
|
|
336
332
|
buff = ImageBuffer()
|
|
337
333
|
buff.set(value)
|
|
338
334
|
return bool(
|
|
339
|
-
Library.framework.MaaImageListBufferAppend(self._handle, buff._handle)
|
|
335
|
+
Library.framework().MaaImageListBufferAppend(self._handle, buff._handle)
|
|
340
336
|
)
|
|
341
337
|
|
|
342
338
|
def remove(self, index: int) -> bool:
|
|
343
|
-
return bool(Library.framework.MaaImageListBufferRemove(self._handle, index))
|
|
339
|
+
return bool(Library.framework().MaaImageListBufferRemove(self._handle, index))
|
|
344
340
|
|
|
345
341
|
def clear(self) -> bool:
|
|
346
|
-
return bool(Library.framework.MaaImageListBufferClear(self._handle))
|
|
342
|
+
return bool(Library.framework().MaaImageListBufferClear(self._handle))
|
|
347
343
|
|
|
348
344
|
_api_properties_initialized: bool = False
|
|
349
345
|
|
|
@@ -353,39 +349,41 @@ class ImageListBuffer:
|
|
|
353
349
|
return
|
|
354
350
|
ImageListBuffer._api_properties_initialized = True
|
|
355
351
|
|
|
356
|
-
Library.framework.MaaImageListBufferCreate.restype = MaaImageListBufferHandle
|
|
357
|
-
Library.framework.MaaImageListBufferCreate.argtypes = []
|
|
352
|
+
Library.framework().MaaImageListBufferCreate.restype = MaaImageListBufferHandle
|
|
353
|
+
Library.framework().MaaImageListBufferCreate.argtypes = []
|
|
358
354
|
|
|
359
|
-
Library.framework.MaaImageListBufferDestroy.restype = None
|
|
360
|
-
Library.framework.MaaImageListBufferDestroy.argtypes = [
|
|
355
|
+
Library.framework().MaaImageListBufferDestroy.restype = None
|
|
356
|
+
Library.framework().MaaImageListBufferDestroy.argtypes = [
|
|
361
357
|
MaaImageListBufferHandle
|
|
362
358
|
]
|
|
363
359
|
|
|
364
|
-
Library.framework.MaaImageListBufferIsEmpty.restype = MaaBool
|
|
365
|
-
Library.framework.MaaImageListBufferIsEmpty.argtypes = [
|
|
360
|
+
Library.framework().MaaImageListBufferIsEmpty.restype = MaaBool
|
|
361
|
+
Library.framework().MaaImageListBufferIsEmpty.argtypes = [
|
|
366
362
|
MaaImageListBufferHandle
|
|
367
363
|
]
|
|
368
364
|
|
|
369
|
-
Library.framework.MaaImageListBufferClear.restype = MaaBool
|
|
370
|
-
Library.framework.MaaImageListBufferClear.argtypes = [
|
|
365
|
+
Library.framework().MaaImageListBufferClear.restype = MaaBool
|
|
366
|
+
Library.framework().MaaImageListBufferClear.argtypes = [
|
|
367
|
+
MaaImageListBufferHandle
|
|
368
|
+
]
|
|
371
369
|
|
|
372
|
-
Library.framework.MaaImageListBufferSize.restype = MaaSize
|
|
373
|
-
Library.framework.MaaImageListBufferSize.argtypes = [MaaImageListBufferHandle]
|
|
370
|
+
Library.framework().MaaImageListBufferSize.restype = MaaSize
|
|
371
|
+
Library.framework().MaaImageListBufferSize.argtypes = [MaaImageListBufferHandle]
|
|
374
372
|
|
|
375
|
-
Library.framework.MaaImageListBufferAt.restype = MaaImageBufferHandle
|
|
376
|
-
Library.framework.MaaImageListBufferAt.argtypes = [
|
|
373
|
+
Library.framework().MaaImageListBufferAt.restype = MaaImageBufferHandle
|
|
374
|
+
Library.framework().MaaImageListBufferAt.argtypes = [
|
|
377
375
|
MaaImageListBufferHandle,
|
|
378
376
|
MaaSize,
|
|
379
377
|
]
|
|
380
378
|
|
|
381
|
-
Library.framework.MaaImageListBufferAppend.restype = MaaBool
|
|
382
|
-
Library.framework.MaaImageListBufferAppend.argtypes = [
|
|
379
|
+
Library.framework().MaaImageListBufferAppend.restype = MaaBool
|
|
380
|
+
Library.framework().MaaImageListBufferAppend.argtypes = [
|
|
383
381
|
MaaImageListBufferHandle,
|
|
384
382
|
MaaImageBufferHandle,
|
|
385
383
|
]
|
|
386
384
|
|
|
387
|
-
Library.framework.MaaImageListBufferRemove.restype = MaaBool
|
|
388
|
-
Library.framework.MaaImageListBufferRemove.argtypes = [
|
|
385
|
+
Library.framework().MaaImageListBufferRemove.restype = MaaBool
|
|
386
|
+
Library.framework().MaaImageListBufferRemove.argtypes = [
|
|
389
387
|
MaaImageListBufferHandle,
|
|
390
388
|
MaaSize,
|
|
391
389
|
]
|
|
@@ -402,7 +400,7 @@ class RectBuffer:
|
|
|
402
400
|
self._handle = c_handle
|
|
403
401
|
self._own = False
|
|
404
402
|
else:
|
|
405
|
-
self._handle = Library.framework.MaaRectCreate()
|
|
403
|
+
self._handle = Library.framework().MaaRectCreate()
|
|
406
404
|
self._own = True
|
|
407
405
|
|
|
408
406
|
if not self._handle:
|
|
@@ -410,13 +408,13 @@ class RectBuffer:
|
|
|
410
408
|
|
|
411
409
|
def __del__(self):
|
|
412
410
|
if self._handle and self._own:
|
|
413
|
-
Library.framework.MaaRectDestroy(self._handle)
|
|
411
|
+
Library.framework().MaaRectDestroy(self._handle)
|
|
414
412
|
|
|
415
413
|
def get(self) -> Rect:
|
|
416
|
-
x = Library.framework.MaaRectGetX(self._handle)
|
|
417
|
-
y = Library.framework.MaaRectGetY(self._handle)
|
|
418
|
-
w = Library.framework.MaaRectGetW(self._handle)
|
|
419
|
-
h = Library.framework.MaaRectGetH(self._handle)
|
|
414
|
+
x = Library.framework().MaaRectGetX(self._handle)
|
|
415
|
+
y = Library.framework().MaaRectGetY(self._handle)
|
|
416
|
+
w = Library.framework().MaaRectGetW(self._handle)
|
|
417
|
+
h = Library.framework().MaaRectGetH(self._handle)
|
|
420
418
|
|
|
421
419
|
return Rect(x, y, w, h)
|
|
422
420
|
|
|
@@ -438,7 +436,7 @@ class RectBuffer:
|
|
|
438
436
|
raise TypeError("value must be a Rect, numpy.ndarray, tuple or list")
|
|
439
437
|
|
|
440
438
|
return bool(
|
|
441
|
-
Library.framework.MaaRectSet(
|
|
439
|
+
Library.framework().MaaRectSet(
|
|
442
440
|
self._handle, value[0], value[1], value[2], value[3]
|
|
443
441
|
)
|
|
444
442
|
)
|
|
@@ -451,26 +449,26 @@ class RectBuffer:
|
|
|
451
449
|
return
|
|
452
450
|
RectBuffer._api_properties_initialized = True
|
|
453
451
|
|
|
454
|
-
Library.framework.MaaRectCreate.restype = MaaRectHandle
|
|
455
|
-
Library.framework.MaaRectCreate.argtypes = []
|
|
452
|
+
Library.framework().MaaRectCreate.restype = MaaRectHandle
|
|
453
|
+
Library.framework().MaaRectCreate.argtypes = []
|
|
456
454
|
|
|
457
|
-
Library.framework.MaaRectDestroy.restype = None
|
|
458
|
-
Library.framework.MaaRectDestroy.argtypes = [MaaRectHandle]
|
|
455
|
+
Library.framework().MaaRectDestroy.restype = None
|
|
456
|
+
Library.framework().MaaRectDestroy.argtypes = [MaaRectHandle]
|
|
459
457
|
|
|
460
|
-
Library.framework.MaaRectGetX.restype = ctypes.c_int32
|
|
461
|
-
Library.framework.MaaRectGetX.argtypes = [MaaRectHandle]
|
|
458
|
+
Library.framework().MaaRectGetX.restype = ctypes.c_int32
|
|
459
|
+
Library.framework().MaaRectGetX.argtypes = [MaaRectHandle]
|
|
462
460
|
|
|
463
|
-
Library.framework.MaaRectGetY.restype = ctypes.c_int32
|
|
464
|
-
Library.framework.MaaRectGetY.argtypes = [MaaRectHandle]
|
|
461
|
+
Library.framework().MaaRectGetY.restype = ctypes.c_int32
|
|
462
|
+
Library.framework().MaaRectGetY.argtypes = [MaaRectHandle]
|
|
465
463
|
|
|
466
|
-
Library.framework.MaaRectGetW.restype = ctypes.c_int32
|
|
467
|
-
Library.framework.MaaRectGetW.argtypes = [MaaRectHandle]
|
|
464
|
+
Library.framework().MaaRectGetW.restype = ctypes.c_int32
|
|
465
|
+
Library.framework().MaaRectGetW.argtypes = [MaaRectHandle]
|
|
468
466
|
|
|
469
|
-
Library.framework.MaaRectGetH.restype = ctypes.c_int32
|
|
470
|
-
Library.framework.MaaRectGetH.argtypes = [MaaRectHandle]
|
|
467
|
+
Library.framework().MaaRectGetH.restype = ctypes.c_int32
|
|
468
|
+
Library.framework().MaaRectGetH.argtypes = [MaaRectHandle]
|
|
471
469
|
|
|
472
|
-
Library.framework.MaaRectSet.restype = MaaBool
|
|
473
|
-
Library.framework.MaaRectSet.argtypes = [
|
|
470
|
+
Library.framework().MaaRectSet.restype = MaaBool
|
|
471
|
+
Library.framework().MaaRectSet.argtypes = [
|
|
474
472
|
MaaRectHandle,
|
|
475
473
|
ctypes.c_int32,
|
|
476
474
|
ctypes.c_int32,
|
maa/context.py
CHANGED
|
@@ -33,7 +33,7 @@ class Context:
|
|
|
33
33
|
self, entry: str, pipeline_override: Dict = {}
|
|
34
34
|
) -> Optional[TaskDetail]:
|
|
35
35
|
task_id = int(
|
|
36
|
-
Library.framework.MaaContextRunTask(
|
|
36
|
+
Library.framework().MaaContextRunTask(
|
|
37
37
|
self._handle, *Context._gen_post_param(entry, pipeline_override)
|
|
38
38
|
)
|
|
39
39
|
)
|
|
@@ -48,7 +48,7 @@ class Context:
|
|
|
48
48
|
image_buffer = ImageBuffer()
|
|
49
49
|
image_buffer.set(image)
|
|
50
50
|
reco_id = int(
|
|
51
|
-
Library.framework.MaaContextRunRecognition(
|
|
51
|
+
Library.framework().MaaContextRunRecognition(
|
|
52
52
|
self._handle,
|
|
53
53
|
*Context._gen_post_param(entry, pipeline_override),
|
|
54
54
|
image_buffer._handle
|
|
@@ -70,7 +70,7 @@ class Context:
|
|
|
70
70
|
rect.set(box)
|
|
71
71
|
|
|
72
72
|
node_id = int(
|
|
73
|
-
Library.framework.MaaContextRunAction(
|
|
73
|
+
Library.framework().MaaContextRunAction(
|
|
74
74
|
self._handle,
|
|
75
75
|
*Context._gen_post_param(entry, pipeline_override),
|
|
76
76
|
rect._handle,
|
|
@@ -85,7 +85,7 @@ class Context:
|
|
|
85
85
|
|
|
86
86
|
def override_pipeline(self, pipeline_override: Dict) -> bool:
|
|
87
87
|
return bool(
|
|
88
|
-
Library.framework.MaaContextOverridePipeline(
|
|
88
|
+
Library.framework().MaaContextOverridePipeline(
|
|
89
89
|
self._handle,
|
|
90
90
|
json.dumps(pipeline_override, ensure_ascii=False).encode(),
|
|
91
91
|
)
|
|
@@ -96,7 +96,7 @@ class Context:
|
|
|
96
96
|
list_buffer.set(next_list)
|
|
97
97
|
|
|
98
98
|
return bool(
|
|
99
|
-
Library.framework.MaaContextOverrideNext(
|
|
99
|
+
Library.framework().MaaContextOverrideNext(
|
|
100
100
|
self._handle, name.encode(), list_buffer._handle
|
|
101
101
|
)
|
|
102
102
|
)
|
|
@@ -106,14 +106,14 @@ class Context:
|
|
|
106
106
|
return self._tasker
|
|
107
107
|
|
|
108
108
|
def get_task_job(self) -> JobWithResult:
|
|
109
|
-
task_id = Library.framework.MaaContextGetTaskId(self._handle)
|
|
109
|
+
task_id = Library.framework().MaaContextGetTaskId(self._handle)
|
|
110
110
|
if not task_id:
|
|
111
111
|
raise ValueError("task_id is None")
|
|
112
112
|
|
|
113
113
|
return self.tasker._gen_task_job(task_id)
|
|
114
114
|
|
|
115
115
|
def clone(self) -> "Context":
|
|
116
|
-
cloned_handle = Library.framework.MaaContextClone(self._handle)
|
|
116
|
+
cloned_handle = Library.framework().MaaContextClone(self._handle)
|
|
117
117
|
if not cloned_handle:
|
|
118
118
|
raise ValueError("cloned_handle is None")
|
|
119
119
|
|
|
@@ -122,7 +122,7 @@ class Context:
|
|
|
122
122
|
### private ###
|
|
123
123
|
|
|
124
124
|
def _init_tasker(self):
|
|
125
|
-
tasker_handle = Library.framework.MaaContextGetTasker(self._handle)
|
|
125
|
+
tasker_handle = Library.framework().MaaContextGetTasker(self._handle)
|
|
126
126
|
if not tasker_handle:
|
|
127
127
|
raise ValueError("tasker_handle is None")
|
|
128
128
|
self._tasker = Tasker(handle=tasker_handle)
|
|
@@ -143,23 +143,23 @@ class Context:
|
|
|
143
143
|
|
|
144
144
|
Context._api_properties_initialized = True
|
|
145
145
|
|
|
146
|
-
Library.framework.MaaContextRunTask.restype = MaaTaskId
|
|
147
|
-
Library.framework.MaaContextRunTask.argtypes = [
|
|
146
|
+
Library.framework().MaaContextRunTask.restype = MaaTaskId
|
|
147
|
+
Library.framework().MaaContextRunTask.argtypes = [
|
|
148
148
|
MaaContextHandle,
|
|
149
149
|
ctypes.c_char_p,
|
|
150
150
|
ctypes.c_char_p,
|
|
151
151
|
]
|
|
152
152
|
|
|
153
|
-
Library.framework.MaaContextRunRecognition.restype = MaaRecoId
|
|
154
|
-
Library.framework.MaaContextRunRecognition.argtypes = [
|
|
153
|
+
Library.framework().MaaContextRunRecognition.restype = MaaRecoId
|
|
154
|
+
Library.framework().MaaContextRunRecognition.argtypes = [
|
|
155
155
|
MaaContextHandle,
|
|
156
156
|
ctypes.c_char_p,
|
|
157
157
|
ctypes.c_char_p,
|
|
158
158
|
MaaImageBufferHandle,
|
|
159
159
|
]
|
|
160
160
|
|
|
161
|
-
Library.framework.MaaContextRunAction.restype = MaaNodeId
|
|
162
|
-
Library.framework.MaaContextRunAction.argtypes = [
|
|
161
|
+
Library.framework().MaaContextRunAction.restype = MaaNodeId
|
|
162
|
+
Library.framework().MaaContextRunAction.argtypes = [
|
|
163
163
|
MaaContextHandle,
|
|
164
164
|
ctypes.c_char_p,
|
|
165
165
|
ctypes.c_char_p,
|
|
@@ -167,30 +167,30 @@ class Context:
|
|
|
167
167
|
MaaStringBufferHandle,
|
|
168
168
|
]
|
|
169
169
|
|
|
170
|
-
Library.framework.MaaContextOverridePipeline.restype = MaaBool
|
|
171
|
-
Library.framework.MaaContextOverridePipeline.argtypes = [
|
|
170
|
+
Library.framework().MaaContextOverridePipeline.restype = MaaBool
|
|
171
|
+
Library.framework().MaaContextOverridePipeline.argtypes = [
|
|
172
172
|
MaaContextHandle,
|
|
173
173
|
ctypes.c_char_p,
|
|
174
174
|
]
|
|
175
175
|
|
|
176
|
-
Library.framework.MaaContextOverrideNext.restype = MaaBool
|
|
177
|
-
Library.framework.MaaContextOverrideNext.argtypes = [
|
|
176
|
+
Library.framework().MaaContextOverrideNext.restype = MaaBool
|
|
177
|
+
Library.framework().MaaContextOverrideNext.argtypes = [
|
|
178
178
|
MaaContextHandle,
|
|
179
179
|
ctypes.c_char_p,
|
|
180
180
|
MaaStringBufferHandle,
|
|
181
181
|
]
|
|
182
182
|
|
|
183
|
-
Library.framework.MaaContextGetTaskId.restype = MaaTaskId
|
|
184
|
-
Library.framework.MaaContextGetTaskId.argtypes = [
|
|
183
|
+
Library.framework().MaaContextGetTaskId.restype = MaaTaskId
|
|
184
|
+
Library.framework().MaaContextGetTaskId.argtypes = [
|
|
185
185
|
MaaContextHandle,
|
|
186
186
|
]
|
|
187
187
|
|
|
188
|
-
Library.framework.MaaContextGetTasker.restype = MaaTaskerHandle
|
|
189
|
-
Library.framework.MaaContextGetTasker.argtypes = [
|
|
188
|
+
Library.framework().MaaContextGetTasker.restype = MaaTaskerHandle
|
|
189
|
+
Library.framework().MaaContextGetTasker.argtypes = [
|
|
190
190
|
MaaContextHandle,
|
|
191
191
|
]
|
|
192
192
|
|
|
193
|
-
Library.framework.MaaContextClone.restype = MaaContextHandle
|
|
194
|
-
Library.framework.MaaContextClone.argtypes = [
|
|
193
|
+
Library.framework().MaaContextClone.restype = MaaContextHandle
|
|
194
|
+
Library.framework().MaaContextClone.argtypes = [
|
|
195
195
|
MaaContextHandle,
|
|
196
196
|
]
|