MCPcopy Create free account
hub / github.com/MaaXYZ/MaaFramework / run

Method run

test/python/binding_test.py:200–234  ·  view source on GitHub ↗
(
        self,
        context: Context,
        argv: CustomAction.RunArg,
    )

Source from the content-addressed store, hash-verified

198
199class MyAction(CustomAction):
200 def run(
201 self,
202 context: Context,
203 argv: CustomAction.RunArg,
204 ) -> CustomAction.RunResult:
205 print(f"on MyAction.run, context: {context}, box: {argv.box}")
206 controller = context.tasker.controller
207 new_image = controller.post_screencap().wait().get()
208 print(f" new_image: {new_image.shape}")
209 controller.post_click(191, 98).wait()
210 controller.post_swipe(100, 200, 300, 400, 100).wait()
211 controller.post_input_text("Hello World!").wait()
212 controller.post_click_key(32).wait()
213 controller.post_touch_down(1, 100, 100, 0).wait()
214 controller.post_touch_move(1, 200, 200, 0).wait()
215 controller.post_touch_up(1).wait()
216 controller.post_key_down(65).wait()
217 controller.post_key_up(65).wait()
218 controller.post_start_app("aaa")
219 controller.post_stop_app("bbb")
220 controller.post_inactive().wait()
221
222 cached_image = controller.cached_image
223 connected = controller.connected
224 uuid = controller.uuid
225 resolution = controller.resolution
226 info = controller.info
227 print(
228 f" connected: {connected}, uuid: {uuid}, resolution: {resolution}, info type: {info.get('type')}"
229 )
230
231 global runned
232 runned = True
233
234 return CustomAction.RunResult(success=True)
235
236
237# ============================================================================

Callers 5

format_fileFunction · 0.45
gen_base_whlFunction · 0.45
unpack_base_whlFunction · 0.45
pack_whlFunction · 0.45
guiFunction · 0.45

Calls 15

waitMethod · 0.65
getMethod · 0.45
post_screencapMethod · 0.45
post_clickMethod · 0.45
post_swipeMethod · 0.45
post_input_textMethod · 0.45
post_click_keyMethod · 0.45
post_touch_downMethod · 0.45
post_touch_moveMethod · 0.45
post_touch_upMethod · 0.45
post_key_downMethod · 0.45
post_key_upMethod · 0.45

Tested by

no test coverage detected