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

Class MacOSController

source/binding/Python/maa/controller.py:899–936  ·  view source on GitHub ↗

MacOS 控制器 / MacOS controller

Source from the content-addressed store, hash-verified

897
898
899class MacOSController(Controller):
900 """MacOS 控制器 / MacOS controller"""
901
902 def __init__(
903 self,
904 window_id: int,
905 screencap_method: int = MaaMacOSScreencapMethodEnum.ScreenCaptureKit,
906 input_method: int = MaaMacOSInputMethodEnum.GlobalEvent,
907 ):
908 """创建 MacOS 控制器 / Create MacOS controller
909
910 Args:
911 window_id: 窗口 ID / window ID
912 screencap_method: 使用的截图方式 / screenshot method used
913 input_method: 使用的输入方式 / input method used
914
915 Raises:
916 RuntimeError: 如果创建失败
917 """
918 super().__init__()
919 self._set_macos_api_properties()
920
921 self._handle = Library.framework().MaaMacOSControllerCreate(
922 window_id,
923 MaaMacOSScreencapMethod(screencap_method),
924 MaaMacOSInputMethod(input_method),
925 )
926
927 if not self._handle:
928 raise RuntimeError("Failed to create MacOS controller.")
929
930 def _set_macos_api_properties(self):
931 Library.framework().MaaMacOSControllerCreate.restype = MaaControllerHandle
932 Library.framework().MaaMacOSControllerCreate.argtypes = [
933 ctypes.c_uint32,
934 MaaMacOSScreencapMethod,
935 MaaMacOSInputMethod,
936 ]
937
938
939class AndroidNativeController(Controller):

Callers 1

parse_argsFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected