kotonebot 0.3.1__py3-none-any.whl → 0.5.0__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.
Files changed (66) hide show
  1. kotonebot/__init__.py +39 -39
  2. kotonebot/backend/bot.py +312 -302
  3. kotonebot/backend/color.py +525 -525
  4. kotonebot/backend/context/__init__.py +3 -3
  5. kotonebot/backend/context/context.py +49 -56
  6. kotonebot/backend/context/task_action.py +183 -175
  7. kotonebot/backend/core.py +129 -126
  8. kotonebot/backend/debug/entry.py +89 -89
  9. kotonebot/backend/debug/mock.py +78 -78
  10. kotonebot/backend/debug/server.py +222 -222
  11. kotonebot/backend/debug/vars.py +351 -351
  12. kotonebot/backend/dispatch.py +227 -227
  13. kotonebot/backend/flow_controller.py +196 -196
  14. kotonebot/backend/loop.py +12 -88
  15. kotonebot/backend/ocr.py +535 -529
  16. kotonebot/backend/preprocessor.py +103 -103
  17. kotonebot/client/__init__.py +9 -9
  18. kotonebot/client/device.py +528 -502
  19. kotonebot/client/fast_screenshot.py +377 -377
  20. kotonebot/client/host/__init__.py +43 -12
  21. kotonebot/client/host/adb_common.py +107 -94
  22. kotonebot/client/host/custom.py +118 -114
  23. kotonebot/client/host/leidian_host.py +196 -201
  24. kotonebot/client/host/mumu12_host.py +353 -358
  25. kotonebot/client/host/protocol.py +214 -213
  26. kotonebot/client/host/windows_common.py +58 -55
  27. kotonebot/client/implements/__init__.py +71 -7
  28. kotonebot/client/implements/adb.py +89 -85
  29. kotonebot/client/implements/adb_raw.py +162 -158
  30. kotonebot/client/implements/nemu_ipc/__init__.py +11 -7
  31. kotonebot/client/implements/nemu_ipc/external_renderer_ipc.py +284 -284
  32. kotonebot/client/implements/nemu_ipc/nemu_ipc.py +327 -327
  33. kotonebot/client/implements/remote_windows.py +188 -192
  34. kotonebot/client/implements/uiautomator2.py +85 -81
  35. kotonebot/client/implements/windows.py +176 -168
  36. kotonebot/client/protocol.py +69 -69
  37. kotonebot/client/registration.py +24 -24
  38. kotonebot/config/base_config.py +96 -96
  39. kotonebot/config/manager.py +36 -36
  40. kotonebot/errors.py +76 -71
  41. kotonebot/interop/win/__init__.py +10 -0
  42. kotonebot/interop/win/_mouse.py +311 -0
  43. kotonebot/interop/win/message_box.py +313 -313
  44. kotonebot/interop/win/reg.py +37 -37
  45. kotonebot/interop/win/shortcut.py +43 -43
  46. kotonebot/interop/win/task_dialog.py +513 -469
  47. kotonebot/logging/__init__.py +2 -2
  48. kotonebot/logging/log.py +17 -17
  49. kotonebot/primitives/__init__.py +17 -17
  50. kotonebot/primitives/geometry.py +862 -290
  51. kotonebot/primitives/visual.py +63 -63
  52. kotonebot/tools/mirror.py +354 -354
  53. kotonebot/ui/file_host/sensio.py +36 -36
  54. kotonebot/ui/file_host/tmp_send.py +54 -54
  55. kotonebot/ui/pushkit/__init__.py +3 -3
  56. kotonebot/ui/pushkit/image_host.py +88 -87
  57. kotonebot/ui/pushkit/protocol.py +13 -13
  58. kotonebot/ui/pushkit/wxpusher.py +54 -53
  59. kotonebot/ui/user.py +148 -143
  60. kotonebot/util.py +436 -409
  61. {kotonebot-0.3.1.dist-info → kotonebot-0.5.0.dist-info}/METADATA +82 -76
  62. kotonebot-0.5.0.dist-info/RECORD +71 -0
  63. {kotonebot-0.3.1.dist-info → kotonebot-0.5.0.dist-info}/licenses/LICENSE +673 -673
  64. kotonebot-0.3.1.dist-info/RECORD +0 -70
  65. {kotonebot-0.3.1.dist-info → kotonebot-0.5.0.dist-info}/WHEEL +0 -0
  66. {kotonebot-0.3.1.dist-info → kotonebot-0.5.0.dist-info}/top_level.txt +0 -0
@@ -1,63 +1,63 @@
1
- import logging
2
-
3
- from cv2.typing import MatLike
4
-
5
- from .geometry import Size
6
- from kotonebot.util import cv2_imread
7
-
8
- logger = logging.getLogger(__name__)
9
-
10
- class Image:
11
- """
12
- 图像类。
13
- """
14
- def __init__(
15
- self,
16
- pixels: MatLike | None = None,
17
- file_path: str | None = None,
18
- lazy_load: bool = False,
19
- name: str | None = None,
20
- description: str | None = None
21
- ):
22
- """
23
- 从内存数据或图像文件创建图像类。
24
-
25
- :param pixels: 图像数据。格式必须为 BGR。
26
- :param file_path: 图像文件路径。
27
- :param lazy_load: 是否延迟加载图像数据。
28
- 若为 False,立即载入,否则仅当访问图像数据时才载入。仅当从文件创建图像类时生效。
29
- :param name: 图像名称。
30
- :param description: 图像描述。
31
- """
32
- self.name: str | None = name
33
- """图像名称。"""
34
- self.description: str | None = description
35
- """图像描述。"""
36
- self.file_path: str | None = file_path
37
- """图像的文件路径。"""
38
- self.__pixels: MatLike | None = None
39
- # 立即加载
40
- if not lazy_load and self.file_path:
41
- _ = self.pixels
42
- # 传入像素数据而不是文件
43
- if pixels is not None:
44
- self.__pixels = pixels
45
-
46
- @property
47
- def pixels(self) -> MatLike:
48
- """图像的像素数据。"""
49
- if self.__pixels is None:
50
- if not self.file_path:
51
- raise ValueError('Either pixels or file_path must be provided.')
52
- logger.debug('Loading image "%s" from %s...', self.name or '(unnamed)', self.file_path)
53
- self.__pixels = cv2_imread(self.file_path)
54
- return self.__pixels
55
-
56
- @property
57
- def size(self) -> Size:
58
- return Size(self.pixels.shape[1], self.pixels.shape[0])
59
-
60
- class Template(Image):
61
- """
62
- 模板图像类。
63
- """
1
+ import logging
2
+
3
+ from cv2.typing import MatLike
4
+
5
+ from .geometry import Size
6
+ from kotonebot.util import cv2_imread
7
+
8
+ logger = logging.getLogger(__name__)
9
+
10
+ class Image:
11
+ """
12
+ 图像类。
13
+ """
14
+ def __init__(
15
+ self,
16
+ pixels: MatLike | None = None,
17
+ file_path: str | None = None,
18
+ lazy_load: bool = False,
19
+ name: str | None = None,
20
+ description: str | None = None
21
+ ):
22
+ """
23
+ 从内存数据或图像文件创建图像类。
24
+
25
+ :param pixels: 图像数据。格式必须为 BGR。
26
+ :param file_path: 图像文件路径。
27
+ :param lazy_load: 是否延迟加载图像数据。
28
+ 若为 False,立即载入,否则仅当访问图像数据时才载入。仅当从文件创建图像类时生效。
29
+ :param name: 图像名称。
30
+ :param description: 图像描述。
31
+ """
32
+ self.name: str | None = name
33
+ """图像名称。"""
34
+ self.description: str | None = description
35
+ """图像描述。"""
36
+ self.file_path: str | None = file_path
37
+ """图像的文件路径。"""
38
+ self.__pixels: MatLike | None = None
39
+ # 立即加载
40
+ if not lazy_load and self.file_path:
41
+ _ = self.pixels
42
+ # 传入像素数据而不是文件
43
+ if pixels is not None:
44
+ self.__pixels = pixels
45
+
46
+ @property
47
+ def pixels(self) -> MatLike:
48
+ """图像的像素数据。"""
49
+ if self.__pixels is None:
50
+ if not self.file_path:
51
+ raise ValueError('Either pixels or file_path must be provided.')
52
+ logger.debug('Loading image "%s" from %s...', self.name or '(unnamed)', self.file_path)
53
+ self.__pixels = cv2_imread(self.file_path)
54
+ return self.__pixels
55
+
56
+ @property
57
+ def size(self) -> Size:
58
+ return Size(self.pixels.shape[1], self.pixels.shape[0])
59
+
60
+ class Template(Image):
61
+ """
62
+ 模板图像类。
63
+ """