创建 MacOS 控制器 / Create MacOS controller Args: window_id: 窗口 ID / window ID screencap_method: 使用的截图方式 / screenshot method used input_method: 使用的输入方式 / input method used Raises: RuntimeError: 如果创建失败
(
self,
window_id: int,
screencap_method: int = MaaMacOSScreencapMethodEnum.ScreenCaptureKit,
input_method: int = MaaMacOSInputMethodEnum.GlobalEvent,
)
| 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 |
nothing calls this directly
no test coverage detected