ok-script 0.0.7__tar.gz → 0.0.9__tar.gz

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 (132) hide show
  1. {ok-script-0.0.7 → ok-script-0.0.9}/PKG-INFO +2 -2
  2. {ok-script-0.0.7 → ok-script-0.0.9}/README.md +1 -1
  3. ok-script-0.0.7/autohelper/AutoHelper.py → ok-script-0.0.9/ok/OK.py +23 -19
  4. {ok-script-0.0.7/autohelper → ok-script-0.0.9/ok}/capture/HwndWindow.py +3 -3
  5. {ok-script-0.0.7/autohelper → ok-script-0.0.9/ok}/capture/adb/ADBCaptureMethod.py +2 -2
  6. {ok-script-0.0.7/autohelper → ok-script-0.0.9/ok}/capture/adb/DeviceManager.py +15 -24
  7. {ok-script-0.0.7/autohelper → ok-script-0.0.9/ok}/capture/adb/vbox.py +3 -3
  8. {ok-script-0.0.7/autohelper → ok-script-0.0.9/ok}/capture/windows/WindowsGraphicsCaptureMethod.py +11 -11
  9. {ok-script-0.0.7/autohelper → ok-script-0.0.9/ok}/capture/windows/d3d11.py +2 -2
  10. {ok-script-0.0.7/autohelper → ok-script-0.0.9/ok}/config/Config.py +2 -2
  11. {ok-script-0.0.7/autohelper → ok-script-0.0.9/ok}/config/InfoDict.py +1 -1
  12. {ok-script-0.0.7/autohelper → ok-script-0.0.9/ok}/feature/Box.py +20 -5
  13. {ok-script-0.0.7/autohelper → ok-script-0.0.9/ok}/feature/FeatureSet.py +4 -4
  14. {ok-script-0.0.7/autohelper → ok-script-0.0.9/ok}/feature/FindFeature.py +1 -1
  15. {ok-script-0.0.7/autohelper → ok-script-0.0.9/ok}/gui/App.py +13 -12
  16. {ok-script-0.0.7/autohelper → ok-script-0.0.9/ok}/gui/MainWindow.py +8 -4
  17. {ok-script-0.0.7/autohelper → ok-script-0.0.9/ok}/gui/__init__.py +1 -1
  18. ok-script-0.0.9/ok/gui/about/AboutTab.py +16 -0
  19. {ok-script-0.0.7/autohelper → ok-script-0.0.9/ok}/gui/debug/DebugTab.py +3 -3
  20. {ok-script-0.0.7/autohelper → ok-script-0.0.9/ok}/gui/debug/FrameWidget.py +2 -2
  21. {ok-script-0.0.7/autohelper → ok-script-0.0.9/ok}/gui/debug/InfoWidget.py +1 -1
  22. {ok-script-0.0.7/autohelper → ok-script-0.0.9/ok}/gui/debug/LoggerWidget.py +1 -1
  23. {ok-script-0.0.7/autohelper → ok-script-0.0.9/ok}/gui/loading/LoadingWindow.py +11 -11
  24. {ok-script-0.0.7/autohelper → ok-script-0.0.9/ok}/gui/overlay/OverlayWindow.py +4 -4
  25. {ok-script-0.0.7/autohelper → ok-script-0.0.9/ok}/gui/tasks/ConfigItemFactory.py +3 -3
  26. {ok-script-0.0.7/autohelper → ok-script-0.0.9/ok}/gui/tasks/StartButton.py +6 -6
  27. {ok-script-0.0.7/autohelper → ok-script-0.0.9/ok}/gui/tasks/TaskOpButton.py +2 -2
  28. {ok-script-0.0.7/autohelper → ok-script-0.0.9/ok}/gui/tasks/TaskTab.py +9 -9
  29. {ok-script-0.0.7/autohelper → ok-script-0.0.9/ok}/gui/util/Alert.py +2 -2
  30. {ok-script-0.0.7/autohelper → ok-script-0.0.9/ok}/gui/util/InitWorker.py +2 -2
  31. {ok-script-0.0.7/autohelper → ok-script-0.0.9/ok}/gui/widget/ListTableWidgetItem.py +1 -1
  32. {ok-script-0.0.7/autohelper → ok-script-0.0.9/ok}/gui/widget/NumericTableWidgetItem.py +1 -1
  33. {ok-script-0.0.7/autohelper → ok-script-0.0.9/ok}/gui/widget/YesNonWidgetItem.py +1 -1
  34. {ok-script-0.0.7/autohelper → ok-script-0.0.9/ok}/interaction/ADBInteraction.py +2 -2
  35. {ok-script-0.0.7/autohelper → ok-script-0.0.9/ok}/interaction/BaseInteraction.py +3 -3
  36. {ok-script-0.0.7/autohelper → ok-script-0.0.9/ok}/interaction/Win32Interaction.py +3 -3
  37. {ok-script-0.0.7/autohelper → ok-script-0.0.9/ok}/logging/Logger.py +3 -3
  38. {ok-script-0.0.7/autohelper → ok-script-0.0.9/ok}/ocr/OCR.py +3 -3
  39. {ok-script-0.0.7/autohelper → ok-script-0.0.9/ok}/rotypes/Windows/Foundation/Collections.py +2 -2
  40. {ok-script-0.0.7/autohelper → ok-script-0.0.9/ok}/rotypes/Windows/Foundation/__init__.py +3 -3
  41. {ok-script-0.0.7/autohelper → ok-script-0.0.9/ok}/rotypes/Windows/Globalization/__init__.py +3 -3
  42. {ok-script-0.0.7/autohelper → ok-script-0.0.9/ok}/rotypes/Windows/Graphics/Capture/__init__.py +7 -7
  43. {ok-script-0.0.7/autohelper → ok-script-0.0.9/ok}/rotypes/Windows/Graphics/DirectX/Direct3D11/__init__.py +4 -4
  44. {ok-script-0.0.7/autohelper → ok-script-0.0.9/ok}/rotypes/Windows/Graphics/DirectX/__init__.py +1 -1
  45. {ok-script-0.0.7/autohelper → ok-script-0.0.9/ok}/rotypes/Windows/Graphics/Imaging/__init__.py +5 -5
  46. {ok-script-0.0.7/autohelper → ok-script-0.0.9/ok}/rotypes/Windows/Media/Ocr/__init__.py +7 -7
  47. {ok-script-0.0.7/autohelper → ok-script-0.0.9/ok}/rotypes/Windows/Security/Cryptography/__init__.py +2 -2
  48. {ok-script-0.0.7/autohelper → ok-script-0.0.9/ok}/rotypes/Windows/Storage/Streams/__init__.py +2 -2
  49. {ok-script-0.0.7/autohelper → ok-script-0.0.9/ok}/save/BlackBarProcessor.py +1 -1
  50. {ok-script-0.0.7/autohelper → ok-script-0.0.9/ok}/save/SaveByInterval.py +1 -1
  51. {ok-script-0.0.7/autohelper → ok-script-0.0.9/ok}/save/SaveByKeyPress.py +3 -3
  52. {ok-script-0.0.7/autohelper → ok-script-0.0.9/ok}/save/SaveMethodBase.py +2 -2
  53. {ok-script-0.0.7/autohelper → ok-script-0.0.9/ok}/scene/FeatureScene.py +2 -2
  54. {ok-script-0.0.7/autohelper → ok-script-0.0.9/ok}/scene/Scene.py +3 -3
  55. {ok-script-0.0.7/autohelper → ok-script-0.0.9/ok}/task/BaseTask.py +10 -7
  56. {ok-script-0.0.7/autohelper → ok-script-0.0.9/ok}/task/ExecutorOperation.py +8 -8
  57. ok-script-0.0.9/ok/task/FindFeatureTask.py +6 -0
  58. {ok-script-0.0.7/autohelper → ok-script-0.0.9/ok}/task/TaskExecutor.py +6 -11
  59. ok-script-0.0.9/ok/util/__init__.py +0 -0
  60. {ok-script-0.0.7/autohelper → ok-script-0.0.9/ok}/util/json.py +1 -1
  61. {ok-script-0.0.7/autohelper → ok-script-0.0.9/ok}/util/yaml.py +1 -1
  62. {ok-script-0.0.7 → ok-script-0.0.9}/ok_script.egg-info/PKG-INFO +2 -2
  63. ok-script-0.0.9/ok_script.egg-info/SOURCES.txt +127 -0
  64. ok-script-0.0.9/ok_script.egg-info/top_level.txt +1 -0
  65. {ok-script-0.0.7 → ok-script-0.0.9}/setup.py +1 -1
  66. ok-script-0.0.7/autohelper/task/FindFeatureTask.py +0 -6
  67. ok-script-0.0.7/ok_script.egg-info/SOURCES.txt +0 -125
  68. ok-script-0.0.7/ok_script.egg-info/top_level.txt +0 -1
  69. {ok-script-0.0.7/autohelper → ok-script-0.0.9/ok}/__init__.py +0 -0
  70. {ok-script-0.0.7/autohelper → ok-script-0.0.9/ok}/capture/BaseCaptureMethod.py +0 -0
  71. {ok-script-0.0.7/autohelper → ok-script-0.0.9/ok}/capture/__init__.py +0 -0
  72. {ok-script-0.0.7/autohelper → ok-script-0.0.9/ok}/capture/adb/__init__.py +0 -0
  73. {ok-script-0.0.7/autohelper → ok-script-0.0.9/ok}/capture/adb/bin/__init__.py +0 -0
  74. {ok-script-0.0.7/autohelper → ok-script-0.0.9/ok}/capture/adb/targets.py +0 -0
  75. {ok-script-0.0.7/autohelper → ok-script-0.0.9/ok}/capture/windows/__init__.py +0 -0
  76. {ok-script-0.0.7/autohelper → ok-script-0.0.9/ok}/capture/windows/utils.py +0 -0
  77. {ok-script-0.0.7/autohelper → ok-script-0.0.9/ok}/capture/windows/window.py +0 -0
  78. {ok-script-0.0.7/autohelper → ok-script-0.0.9/ok}/color/Color.py +0 -0
  79. {ok-script-0.0.7/autohelper → ok-script-0.0.9/ok}/color/__init__.py +0 -0
  80. {ok-script-0.0.7/autohelper → ok-script-0.0.9/ok}/config/__init__.py +0 -0
  81. {ok-script-0.0.7/autohelper → ok-script-0.0.9/ok}/feature/Feature.py +0 -0
  82. {ok-script-0.0.7/autohelper → ok-script-0.0.9/ok}/feature/__init__.py +0 -0
  83. {ok-script-0.0.7/autohelper → ok-script-0.0.9/ok}/gui/Communicate.py +0 -0
  84. {ok-script-0.0.7/autohelper → ok-script-0.0.9/ok}/gui/TabTitles.py +0 -0
  85. {ok-script-0.0.7/autohelper/gui/debug → ok-script-0.0.9/ok/gui/about}/__init__.py +0 -0
  86. {ok-script-0.0.7/autohelper → ok-script-0.0.9/ok}/gui/debug/AspectRatioWidget.py +0 -0
  87. {ok-script-0.0.7/autohelper/gui/i18n → ok-script-0.0.9/ok/gui/debug}/__init__.py +0 -0
  88. {ok-script-0.0.7/autohelper/gui/icon → ok-script-0.0.9/ok/gui/i18n}/__init__.py +0 -0
  89. {ok-script-0.0.7/autohelper → ok-script-0.0.9/ok}/gui/i18n/path.py +0 -0
  90. {ok-script-0.0.7/autohelper/gui/loading → ok-script-0.0.9/ok/gui/icon}/__init__.py +0 -0
  91. {ok-script-0.0.7/autohelper → ok-script-0.0.9/ok}/gui/icon/icon.py +0 -0
  92. {ok-script-0.0.7/autohelper/gui/overlay → ok-script-0.0.9/ok/gui/loading}/__init__.py +0 -0
  93. {ok-script-0.0.7/autohelper/gui/tasks → ok-script-0.0.9/ok/gui/overlay}/__init__.py +0 -0
  94. {ok-script-0.0.7/autohelper → ok-script-0.0.9/ok}/gui/resources.py +0 -0
  95. {ok-script-0.0.7/autohelper → ok-script-0.0.9/ok}/gui/tasks/TooltipTableWidget.py +0 -0
  96. {ok-script-0.0.7/autohelper/gui/util → ok-script-0.0.9/ok/gui/tasks}/__init__.py +0 -0
  97. {ok-script-0.0.7/autohelper/gui/widget → ok-script-0.0.9/ok/gui/util}/__init__.py +0 -0
  98. {ok-script-0.0.7/autohelper → ok-script-0.0.9/ok}/gui/widget/RoundCornerContainer.py +0 -0
  99. {ok-script-0.0.7/autohelper → ok-script-0.0.9/ok}/gui/widget/TabWidget.py +0 -0
  100. {ok-script-0.0.7/autohelper → ok-script-0.0.9/ok}/gui/widget/UpdateConfigWidgetItem.py +0 -0
  101. {ok-script-0.0.7/autohelper/interaction → ok-script-0.0.9/ok/gui/widget}/__init__.py +0 -0
  102. {ok-script-0.0.7/autohelper/logging → ok-script-0.0.9/ok/interaction}/__init__.py +0 -0
  103. {ok-script-0.0.7/autohelper/ocr → ok-script-0.0.9/ok/logging}/__init__.py +0 -0
  104. {ok-script-0.0.7/autohelper/predict → ok-script-0.0.9/ok/ocr}/__init__.py +0 -0
  105. {ok-script-0.0.7/autohelper/rotypes/Windows/Media → ok-script-0.0.9/ok/predict}/__init__.py +0 -0
  106. {ok-script-0.0.7/autohelper → ok-script-0.0.9/ok}/predict/predict.py +0 -0
  107. {ok-script-0.0.7/autohelper → ok-script-0.0.9/ok}/rotypes/Windows/Graphics/__init__.py +0 -0
  108. {ok-script-0.0.7/autohelper/rotypes/Windows/Security → ok-script-0.0.9/ok/rotypes/Windows/Media}/__init__.py +0 -0
  109. {ok-script-0.0.7/autohelper/rotypes/Windows/Storage → ok-script-0.0.9/ok/rotypes/Windows/Security}/__init__.py +0 -0
  110. {ok-script-0.0.7/autohelper/rotypes/Windows → ok-script-0.0.9/ok/rotypes/Windows/Storage}/__init__.py +0 -0
  111. {ok-script-0.0.7/autohelper/save → ok-script-0.0.9/ok/rotypes/Windows}/__init__.py +0 -0
  112. {ok-script-0.0.7/autohelper → ok-script-0.0.9/ok}/rotypes/__init__.py +0 -0
  113. {ok-script-0.0.7/autohelper → ok-script-0.0.9/ok}/rotypes/delegate.py +0 -0
  114. {ok-script-0.0.7/autohelper → ok-script-0.0.9/ok}/rotypes/export.py +0 -0
  115. {ok-script-0.0.7/autohelper → ok-script-0.0.9/ok}/rotypes/idldsl.py +0 -0
  116. {ok-script-0.0.7/autohelper → ok-script-0.0.9/ok}/rotypes/inspectable.py +0 -0
  117. {ok-script-0.0.7/autohelper → ok-script-0.0.9/ok}/rotypes/roapi.py +0 -0
  118. {ok-script-0.0.7/autohelper → ok-script-0.0.9/ok}/rotypes/types.py +0 -0
  119. {ok-script-0.0.7/autohelper → ok-script-0.0.9/ok}/rotypes/winstring.py +0 -0
  120. {ok-script-0.0.7/autohelper → ok-script-0.0.9/ok}/save/PostProcessor.py +0 -0
  121. {ok-script-0.0.7/autohelper/scene → ok-script-0.0.9/ok/save}/__init__.py +0 -0
  122. {ok-script-0.0.7/autohelper/stats → ok-script-0.0.9/ok/scene}/__init__.py +0 -0
  123. {ok-script-0.0.7/autohelper → ok-script-0.0.9/ok}/stats/StreamStats.py +0 -0
  124. {ok-script-0.0.7/autohelper/task → ok-script-0.0.9/ok/stats}/__init__.py +0 -0
  125. {ok-script-0.0.7/autohelper/util → ok-script-0.0.9/ok/task}/__init__.py +0 -0
  126. {ok-script-0.0.7/autohelper → ok-script-0.0.9/ok}/util/list.py +0 -0
  127. {ok-script-0.0.7/autohelper → ok-script-0.0.9/ok}/util/path.py +0 -0
  128. {ok-script-0.0.7/autohelper → ok-script-0.0.9/ok}/util/thread.py +0 -0
  129. {ok-script-0.0.7/autohelper → ok-script-0.0.9/ok}/util/win32_process.py +0 -0
  130. {ok-script-0.0.7 → ok-script-0.0.9}/ok_script.egg-info/dependency_links.txt +0 -0
  131. {ok-script-0.0.7 → ok-script-0.0.9}/ok_script.egg-info/requires.txt +0 -0
  132. {ok-script-0.0.7 → ok-script-0.0.9}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ok-script
3
- Version: 0.0.7
3
+ Version: 0.0.9
4
4
  Summary: Automation with Computer Vision for Python
5
5
  Home-page: https://github.com/ok-oldking/ok-script
6
6
  Author: ok-oldking
@@ -18,7 +18,7 @@ Requires-Dist: pywin32==306
18
18
  Requires-Dist: typing-extensions~=4.10.0
19
19
  Requires-Dist: PySide6~=6.6.2
20
20
 
21
- # autoui
21
+ # ok-script
22
22
 
23
23
  This project aims to provide a universal framework for developing automation tool for PC/Android games, running in
24
24
  windows,
@@ -1,4 +1,4 @@
1
- # autoui
1
+ # ok-script
2
2
 
3
3
  This project aims to provide a universal framework for developing automation tool for PC/Android games, running in
4
4
  windows,
@@ -5,19 +5,19 @@ from typing import Dict, Any
5
5
 
6
6
  from PySide6.QtWidgets import QApplication
7
7
 
8
- import autohelper
9
- from autohelper.feature.FeatureSet import FeatureSet
10
- from autohelper.gui.App import App
11
- from autohelper.gui.Communicate import communicate
12
- from autohelper.gui.overlay.OverlayWindow import OverlayWindow
13
- from autohelper.gui.util.InitWorker import InitWorker
14
- from autohelper.logging.Logger import get_logger, config_logger
15
- from autohelper.task.TaskExecutor import TaskExecutor
8
+ import ok
9
+ from ok.feature.FeatureSet import FeatureSet
10
+ from ok.gui.App import App
11
+ from ok.gui.Communicate import communicate
12
+ from ok.gui.overlay.OverlayWindow import OverlayWindow
13
+ from ok.gui.util.InitWorker import InitWorker
14
+ from ok.logging.Logger import get_logger, config_logger
15
+ from ok.task.TaskExecutor import TaskExecutor
16
16
 
17
17
  logger = get_logger(__name__)
18
18
 
19
19
 
20
- class AutoHelper:
20
+ class OK:
21
21
  executor: TaskExecutor
22
22
  adb = None
23
23
  adb_device = None
@@ -36,20 +36,24 @@ class AutoHelper:
36
36
  self.init_device_manager()
37
37
  if config.get("use_gui"):
38
38
  self.app = App(self.config.get('gui_icon'), self.debug, self.config.get('gui_title'),
39
- self.config['tasks'], self.exit_event)
40
- autohelper.gui.app = self.app
39
+ self.config['tasks'], self.config.get('about'), self.exit_event)
40
+ ok.gui.app = self.app
41
+ else:
42
+ self.device_manager.set_preferred_device()
43
+ self.device_manager.start()
44
+ self.do_init()
45
+
46
+ def start(self):
47
+ if self.config.get("use_gui"):
41
48
  self.app.show_loading()
42
49
  self.worker = InitWorker(self.do_init)
43
50
  self.worker.start()
44
51
  self.app.exec()
45
52
  else:
46
- self.device_manager.set_preferred_device()
47
- self.device_manager.start()
48
- self.do_init()
49
53
  self.task_executor.start()
50
- if config.get("debug"):
54
+ if self.config.get("debug"):
51
55
  self.app = QApplication(sys.argv)
52
- self.overlay_window = OverlayWindow(autohelper.gui.device_manager.hwnd)
56
+ self.overlay_window = OverlayWindow(ok.gui.device_manager.hwnd)
53
57
  self.app.exec()
54
58
  else:
55
59
  try:
@@ -101,7 +105,7 @@ class AutoHelper:
101
105
  self.init_message("TaskExecutor init Done")
102
106
 
103
107
  if self.app:
104
- autohelper.gui.executor = self.task_executor
108
+ ok.gui.executor = self.task_executor
105
109
 
106
110
  def wait_task(self):
107
111
  while not self.exit_event.is_set():
@@ -109,8 +113,8 @@ class AutoHelper:
109
113
 
110
114
  def init_device_manager(self):
111
115
  if self.device_manager is None:
112
- from autohelper.capture.adb.DeviceManager import DeviceManager
116
+ from ok.capture.adb.DeviceManager import DeviceManager
113
117
  self.device_manager = DeviceManager(self.config.get("config_folder") or "config",
114
118
  self.config.get('capture_window_title'), self.config.get("debug"),
115
119
  self.exit_event)
116
- autohelper.gui.device_manager = self.device_manager
120
+ ok.gui.device_manager = self.device_manager
@@ -5,9 +5,9 @@ import threading
5
5
  from typing_extensions import override
6
6
  from win32 import win32gui
7
7
 
8
- from autohelper.capture.windows.window import is_foreground_window, get_window_bounds
9
- from autohelper.gui.Communicate import communicate
10
- from autohelper.logging.Logger import get_logger
8
+ from ok.capture.windows.window import is_foreground_window, get_window_bounds
9
+ from ok.gui.Communicate import communicate
10
+ from ok.logging.Logger import get_logger
11
11
 
12
12
  logger = get_logger(__name__)
13
13
 
@@ -2,8 +2,8 @@
2
2
  import numpy as np
3
3
  from typing_extensions import override
4
4
 
5
- from autohelper.capture.BaseCaptureMethod import BaseCaptureMethod
6
- from autohelper.logging.Logger import get_logger
5
+ from ok.capture.BaseCaptureMethod import BaseCaptureMethod
6
+ from ok.logging.Logger import get_logger
7
7
 
8
8
  logger = get_logger(__name__)
9
9
 
@@ -4,15 +4,15 @@ import adbutils
4
4
  import cv2
5
5
  import numpy as np
6
6
 
7
- from autohelper.capture.HwndWindow import HwndWindow
8
- from autohelper.capture.adb.ADBCaptureMethod import ADBCaptureMethod
9
- from autohelper.capture.adb.vbox import installed_emulator
10
- from autohelper.capture.windows.WindowsGraphicsCaptureMethod import WindowsGraphicsCaptureMethod
11
- from autohelper.config.Config import Config
12
- from autohelper.gui.Communicate import communicate
13
- from autohelper.interaction.ADBInteraction import ADBBaseInteraction
14
- from autohelper.interaction.Win32Interaction import Win32Interaction
15
- from autohelper.logging.Logger import get_logger
7
+ from ok.capture.HwndWindow import HwndWindow
8
+ from ok.capture.adb.ADBCaptureMethod import ADBCaptureMethod
9
+ from ok.capture.adb.vbox import installed_emulator
10
+ from ok.capture.windows.WindowsGraphicsCaptureMethod import WindowsGraphicsCaptureMethod
11
+ from ok.config.Config import Config
12
+ from ok.gui.Communicate import communicate
13
+ from ok.interaction.ADBInteraction import ADBBaseInteraction
14
+ from ok.interaction.Win32Interaction import Win32Interaction
15
+ from ok.logging.Logger import get_logger
16
16
 
17
17
  logger = get_logger(__name__)
18
18
 
@@ -102,7 +102,6 @@ class DeviceManager:
102
102
  self.device_dict[self.hwnd_title] = {"address": "", "imei": self.hwnd_title, "method": "windows",
103
103
  "model": "", "nick": nick or self.hwnd_title,
104
104
  "connected": self.hwnd is not None and self.hwnd.exists,
105
- "preferred": False,
106
105
  "resolution": f"{width}x{height}"}
107
106
  communicate.adb_devices.emit()
108
107
  self.config.save_file()
@@ -110,20 +109,13 @@ class DeviceManager:
110
109
 
111
110
  def set_preferred_device(self, imei=None):
112
111
  logger.debug(f"set_preferred_device {imei}")
113
- preferred = None
114
112
  if imei is None:
115
- for device in self.device_dict.values():
116
- if device.get('preferred'):
117
- preferred = device
118
- imei = preferred['imei']
119
- else:
120
- preferred = self.device_dict.get(imei)
121
- for key in self.device_dict.keys():
122
- if imei == key:
123
- self.device_dict[imei]["preferred"] = False
113
+ imei = self.config.get("preferred")
114
+ preferred = self.device_dict.get(imei)
124
115
  if preferred is None and len(self.device_dict) > 0:
125
116
  preferred = next(iter(self.device_dict.values()))
126
117
  if preferred is not None:
118
+ imei = preferred['imei']
127
119
  preferred['preferred'] = True
128
120
  if preferred['method'] == 'windows':
129
121
  if not isinstance(self.capture_method, WindowsGraphicsCaptureMethod):
@@ -141,6 +133,7 @@ class DeviceManager:
141
133
  self.capture_method.close()
142
134
  self.capture_method = ADBCaptureMethod(self)
143
135
  self.interaction = ADBBaseInteraction(self, self.capture_method)
136
+ self.config["preferred"] = imei
144
137
  self.config.save_file()
145
138
  logger.debug(f'preferred device: {preferred}')
146
139
 
@@ -148,10 +141,10 @@ class DeviceManager:
148
141
  if isinstance(self.capture_method, ADBCaptureMethod):
149
142
  if self.debug:
150
143
  if self.hwnd is not None:
151
- self.hwnd.update_title_re("autohelper_debug")
144
+ self.hwnd.update_title_re("ok_debug")
152
145
  self.hwnd.update_frame_size(self.capture_method.width, self.capture_method.height)
153
146
  else:
154
- self.hwnd = HwndWindow("autohelper_debug", self.exit_event, self.capture_method.width,
147
+ self.hwnd = HwndWindow("ok_debug", self.exit_event, self.capture_method.width,
155
148
  self.capture_method.height)
156
149
  else:
157
150
  self.hwnd.stop()
@@ -159,8 +152,6 @@ class DeviceManager:
159
152
 
160
153
  @property
161
154
  def device(self):
162
- if self._device is None:
163
- self.set_preferred_device()
164
155
  return self._device
165
156
 
166
157
  @property
@@ -6,9 +6,9 @@ from dataclasses import dataclass
6
6
  import adbutils
7
7
  import win32com.client
8
8
 
9
- from autohelper.capture.adb.targets import ADBControllerTarget
10
- from autohelper.logging.Logger import get_logger
11
- from autohelper.util import win32_process
9
+ from ok.capture.adb.targets import ADBControllerTarget
10
+ from ok.logging.Logger import get_logger
11
+ from ok.util import win32_process
12
12
 
13
13
  logger = get_logger(__name__)
14
14
 
@@ -6,20 +6,20 @@ import time
6
6
  import numpy as np
7
7
  from typing_extensions import override
8
8
 
9
- from autohelper.capture.BaseCaptureMethod import BaseCaptureMethod
10
- from autohelper.capture.HwndWindow import HwndWindow
11
- from autohelper.capture.windows import d3d11
12
- from autohelper.capture.windows.utils import WINDOWS_BUILD_NUMBER
13
- from autohelper.logging.Logger import get_logger
14
- from autohelper.rotypes import IInspectable
15
- from autohelper.rotypes.Windows.Foundation import TypedEventHandler
16
- from autohelper.rotypes.Windows.Graphics.Capture import Direct3D11CaptureFramePool, IGraphicsCaptureItemInterop, \
9
+ from ok.capture.BaseCaptureMethod import BaseCaptureMethod
10
+ from ok.capture.HwndWindow import HwndWindow
11
+ from ok.capture.windows import d3d11
12
+ from ok.capture.windows.utils import WINDOWS_BUILD_NUMBER
13
+ from ok.logging.Logger import get_logger
14
+ from ok.rotypes import IInspectable
15
+ from ok.rotypes.Windows.Foundation import TypedEventHandler
16
+ from ok.rotypes.Windows.Graphics.Capture import Direct3D11CaptureFramePool, IGraphicsCaptureItemInterop, \
17
17
  IGraphicsCaptureItem, GraphicsCaptureItem
18
- from autohelper.rotypes.Windows.Graphics.DirectX import DirectXPixelFormat
19
- from autohelper.rotypes.Windows.Graphics.DirectX.Direct3D11 import IDirect3DDevice, \
18
+ from ok.rotypes.Windows.Graphics.DirectX import DirectXPixelFormat
19
+ from ok.rotypes.Windows.Graphics.DirectX.Direct3D11 import IDirect3DDevice, \
20
20
  CreateDirect3D11DeviceFromDXGIDevice, \
21
21
  IDirect3DDxgiInterfaceAccess
22
- from autohelper.rotypes.roapi import GetActivationFactory
22
+ from ok.rotypes.roapi import GetActivationFactory
23
23
 
24
24
  PBYTE = ctypes.POINTER(ctypes.c_ubyte)
25
25
  WGC_NO_BORDER_MIN_BUILD = 20348
@@ -1,7 +1,7 @@
1
1
  import ctypes.wintypes
2
2
 
3
- from autohelper.rotypes import IUnknown
4
- from autohelper.rotypes import idldsl
3
+ from ok.rotypes import IUnknown
4
+ from ok.rotypes import idldsl
5
5
 
6
6
  D3D11_SDK_VERSION = 7
7
7
  D3D_DRIVER_TYPE_HARDWARE = 1
@@ -1,5 +1,5 @@
1
- from autohelper.util.json import read_json_file, write_json_file
2
- from autohelper.util.path import get_path_relative_to_exe
1
+ from ok.util.json import read_json_file, write_json_file
2
+ from ok.util.path import get_path_relative_to_exe
3
3
 
4
4
 
5
5
  class Config:
@@ -1,4 +1,4 @@
1
- from autohelper.gui.Communicate import communicate
1
+ from ok.gui.Communicate import communicate
2
2
 
3
3
 
4
4
  class InfoDict(dict):
@@ -24,6 +24,14 @@ class Box:
24
24
  self.confidence == other.confidence and
25
25
  self.name == other.name)
26
26
 
27
+ def in_boundary(self, boxes):
28
+ in_boundary_boxes = []
29
+ for box in boxes:
30
+ if (self.x <= box.x and self.x + self.width >= box.x + box.width and
31
+ self.y <= box.y and self.y + self.height >= box.y + box.height):
32
+ in_boundary_boxes.append(box)
33
+ return in_boundary_boxes
34
+
27
35
  def __repr__(self):
28
36
  return self.name
29
37
 
@@ -80,7 +88,7 @@ class Box:
80
88
  def center(self):
81
89
  return self.x + self.width / 2, self.y + self.height / 2
82
90
 
83
- def find_closest_box(self, direction: str, boxes: list):
91
+ def find_closest_box(self, direction: str, boxes: list, condition=None):
84
92
  orig_center_x, orig_center_y = self.center()
85
93
 
86
94
  def distance_criteria(box):
@@ -91,14 +99,21 @@ class Box:
91
99
  dy = box_center_y - orig_center_y
92
100
  distance = math.sqrt(dx ** 2 + dy ** 2)
93
101
  if box == self:
94
- return float('inf')
102
+ distance = float('inf')
95
103
  elif direction == 'up' and self.y - (box.y + box.height / 2) >= 0:
96
- return distance
104
+ pass
97
105
  elif direction == 'down' and box.y - (self.y + self.height / 2) >= 0:
98
- return distance
106
+ pass
99
107
  elif direction == 'left' and self.x - (box.x + box.width / 2) >= 0:
100
- return distance
108
+ pass
101
109
  elif direction == 'right' and box.x - (self.x + self.width / 2) >= 0:
110
+ pass
111
+ else:
112
+ distance = float('inf')
113
+ return check_condition(box, distance)
114
+
115
+ def check_condition(box, distance):
116
+ if condition is None or condition(box):
102
117
  return distance
103
118
  else:
104
119
  return float('inf')
@@ -7,10 +7,10 @@ from typing import List
7
7
  import cv2
8
8
  import numpy as np
9
9
 
10
- from autohelper.feature.Box import Box, sort_boxes
11
- from autohelper.feature.Feature import Feature
12
- from autohelper.gui.Communicate import communicate
13
- from autohelper.logging.Logger import get_logger
10
+ from ok.feature.Box import Box, sort_boxes
11
+ from ok.feature.Feature import Feature
12
+ from ok.gui.Communicate import communicate
13
+ from ok.logging.Logger import get_logger
14
14
 
15
15
  logger = get_logger(__name__)
16
16
 
@@ -1,7 +1,7 @@
1
1
  import sys
2
2
  from typing import List
3
3
 
4
- from autohelper.feature.Box import Box
4
+ from ok.feature.Box import Box
5
5
 
6
6
 
7
7
  class FindFeature:
@@ -5,25 +5,26 @@ from PySide6.QtCore import QSize, QCoreApplication, QLocale, QTranslator
5
5
  from PySide6.QtGui import QIcon
6
6
  from PySide6.QtWidgets import QApplication, QStyleFactory, QMenu, QSystemTrayIcon
7
7
 
8
- import autohelper
9
- import autohelper.gui.resources
10
- from autohelper.gui.Communicate import communicate
11
- from autohelper.gui.MainWindow import MainWindow
12
- from autohelper.gui.i18n.path import i18n_path
13
- from autohelper.gui.loading.LoadingWindow import LoadingWindow
14
- from autohelper.gui.overlay.OverlayWindow import OverlayWindow
15
- from autohelper.logging.Logger import get_logger
8
+ import ok
9
+ import ok.gui.resources
10
+ from ok.gui.Communicate import communicate
11
+ from ok.gui.MainWindow import MainWindow
12
+ from ok.gui.i18n.path import i18n_path
13
+ from ok.gui.loading.LoadingWindow import LoadingWindow
14
+ from ok.gui.overlay.OverlayWindow import OverlayWindow
15
+ from ok.logging.Logger import get_logger
16
16
 
17
17
  logger = get_logger(__name__)
18
18
 
19
19
 
20
20
  class App:
21
- def __init__(self, icon=None, overlay=False, title="AutoUI", tasks=None,
21
+ def __init__(self, icon=None, overlay=False, title="AutoUI", tasks=None, about=None,
22
22
  exit_event=None):
23
23
  super().__init__()
24
24
  self.app = QApplication(sys.argv)
25
25
  self.app.setStyle(QStyleFactory.create("Fusion"))
26
26
  self.tasks = tasks
27
+ self.about = about
27
28
  self.title = title
28
29
  self.overlay = overlay
29
30
  self.loading_window = None
@@ -86,11 +87,11 @@ class App:
86
87
 
87
88
  def show_main_window(self):
88
89
  self.loading_window.close()
89
- self.main_window = MainWindow(self.tasks, self.overlay, exit_event=self.exit_event)
90
+ self.main_window = MainWindow(self.tasks, self.overlay, self.about, exit_event=self.exit_event)
90
91
  self.main_window.setWindowTitle(self.title) # Set the window title here
91
92
  self.main_window.setWindowIcon(self.icon)
92
- if self.overlay and autohelper.gui.device_manager.hwnd is not None:
93
- self.overlay_window = OverlayWindow(autohelper.gui.device_manager.hwnd)
93
+ if self.overlay and ok.gui.device_manager.hwnd is not None:
94
+ self.overlay_window = OverlayWindow(ok.gui.device_manager.hwnd)
94
95
 
95
96
  size = self.size_relative_to_screen(width=0.5, height=0.6)
96
97
  self.main_window.resize(size)
@@ -1,9 +1,10 @@
1
1
  from PySide6.QtCore import QObject, Signal, Slot
2
2
  from PySide6.QtWidgets import QMessageBox, QTabWidget
3
3
 
4
- from autohelper.gui.debug.DebugTab import DebugTab
5
- from autohelper.gui.tasks.TaskTab import TaskTab
6
- from autohelper.logging.Logger import get_logger
4
+ from ok.gui.about.AboutTab import AboutTab
5
+ from ok.gui.debug.DebugTab import DebugTab
6
+ from ok.gui.tasks.TaskTab import TaskTab
7
+ from ok.logging.Logger import get_logger
7
8
 
8
9
  logger = get_logger(__name__)
9
10
 
@@ -13,7 +14,7 @@ class Communicate(QObject):
13
14
 
14
15
 
15
16
  class MainWindow(QTabWidget):
16
- def __init__(self, tasks, debug=False, exit_event=None):
17
+ def __init__(self, tasks, debug=False, about=None, exit_event=None):
17
18
  super().__init__()
18
19
  self.exit_event = exit_event
19
20
  task_tab = TaskTab(tasks)
@@ -22,6 +23,9 @@ class MainWindow(QTabWidget):
22
23
  debug_tab = DebugTab()
23
24
  self.addTab(debug_tab, self.tr("Debug"))
24
25
  # ... Add other tabs similarly
26
+ if about:
27
+ about_tab = AboutTab(about)
28
+ self.addTab(about_tab, self.tr("About"))
25
29
 
26
30
  # Styling the tabs and content if needed, for example:
27
31
  self.setStyleSheet("""
@@ -1,4 +1,4 @@
1
- from autohelper.capture.adb.DeviceManager import DeviceManager
1
+ from ok.capture.adb.DeviceManager import DeviceManager
2
2
 
3
3
  executor = None
4
4
  app = None
@@ -0,0 +1,16 @@
1
+ from PySide6.QtWidgets import QWidget, QTextEdit, QVBoxLayout
2
+
3
+
4
+ class AboutTab(QWidget):
5
+ def __init__(self, text=""):
6
+ super().__init__()
7
+ layout = QVBoxLayout()
8
+
9
+ # Create a QTextEdit instance
10
+ text_edit = QTextEdit()
11
+ text_edit.setHtml(text)
12
+ text_edit.setReadOnly(True)
13
+ layout.addWidget(text_edit)
14
+
15
+ # Set the layout on the widget
16
+ self.setLayout(layout)
@@ -1,9 +1,9 @@
1
1
  from PySide6.QtCore import Qt
2
2
  from PySide6.QtWidgets import QWidget, QGridLayout, QSplitter
3
3
 
4
- from autohelper.gui.debug.FrameWidget import FrameWidget
5
- from autohelper.gui.debug.InfoWidget import InfoWidget
6
- from autohelper.gui.debug.LoggerWidget import LoggerWidget
4
+ from ok.gui.debug.FrameWidget import FrameWidget
5
+ from ok.gui.debug.InfoWidget import InfoWidget
6
+ from ok.gui.debug.LoggerWidget import LoggerWidget
7
7
 
8
8
 
9
9
  class DebugTab(QWidget):
@@ -5,8 +5,8 @@ from PySide6.QtCore import Qt
5
5
  from PySide6.QtGui import QPainter, QImage, QPixmap, QColor, QPen
6
6
  from PySide6.QtWidgets import QWidget
7
7
 
8
- from autohelper.feature.Box import Box
9
- from autohelper.gui.Communicate import communicate
8
+ from ok.feature.Box import Box
9
+ from ok.gui.Communicate import communicate
10
10
 
11
11
 
12
12
  class FrameWidget(QWidget):
@@ -1,6 +1,6 @@
1
1
  from PySide6.QtWidgets import QWidget, QVBoxLayout, QLabel
2
2
 
3
- from autohelper.gui.Communicate import communicate
3
+ from ok.gui.Communicate import communicate
4
4
 
5
5
 
6
6
  class InfoWidget(QWidget):
@@ -2,7 +2,7 @@ import logging
2
2
 
3
3
  from PySide6.QtWidgets import (QWidget, QVBoxLayout, QHBoxLayout, QComboBox, QLineEdit, QTextEdit)
4
4
 
5
- from autohelper.gui.Communicate import communicate
5
+ from ok.gui.Communicate import communicate
6
6
 
7
7
  level_map = {'DEBUG': logging.DEBUG, 'INFO': logging.INFO, 'WARNING': logging.WARNING, 'ERROR': logging.ERROR,
8
8
  'CRITICAL': logging.CRITICAL}
@@ -1,12 +1,12 @@
1
1
  from PySide6.QtCore import Qt, QTimer
2
2
  from PySide6.QtWidgets import QWidget, QVBoxLayout, QMessageBox, QHBoxLayout, QListWidget, QPushButton
3
3
 
4
- import autohelper
5
- from autohelper.gui.Communicate import communicate
6
- from autohelper.gui.util.Alert import show_alert
7
- from autohelper.gui.widget.RoundCornerContainer import RoundCornerContainer
8
- from autohelper.interaction.Win32Interaction import is_admin
9
- from autohelper.logging.Logger import get_logger
4
+ import ok
5
+ from ok.gui.Communicate import communicate
6
+ from ok.gui.util.Alert import show_alert
7
+ from ok.gui.widget.RoundCornerContainer import RoundCornerContainer
8
+ from ok.interaction.Win32Interaction import is_admin
9
+ from ok.logging.Logger import get_logger
10
10
 
11
11
  logger = get_logger(__name__)
12
12
 
@@ -50,7 +50,7 @@ class LoadingWindow(QWidget):
50
50
  self.update_capture()
51
51
 
52
52
  def refresh_clicked(self):
53
- autohelper.gui.device_manager.refresh()
53
+ ok.gui.device_manager.refresh()
54
54
  self.refresh_button.setDisabled(True)
55
55
  self.refresh_button.setText(self.tr("Refreshing"))
56
56
 
@@ -65,22 +65,22 @@ class LoadingWindow(QWidget):
65
65
  show_alert(self.tr("Error"),
66
66
  self.tr(f"PC version requires admin privileges, Please restart this app with admin privileges!"))
67
67
  return
68
- autohelper.gui.device_manager.start()
68
+ ok.gui.device_manager.start()
69
69
  self.app.show_main_window()
70
70
 
71
71
  def capture_index_changed(self): # i is an index
72
72
  i = self.capture_list.currentRow()
73
73
  imei = self.capture_list_data[i]["imei"]
74
- autohelper.gui.device_manager.set_preferred_device(imei)
74
+ ok.gui.device_manager.set_preferred_device(imei)
75
75
 
76
76
  def update_capture(self):
77
- devices = autohelper.gui.device_manager.get_devices()
77
+ devices = ok.gui.device_manager.get_devices()
78
78
  selected = self.capture_list.currentRow()
79
79
  self.capture_list.clear()
80
80
  self.capture_list_data.clear()
81
81
  if len(devices) > 0:
82
82
  for row, device in enumerate(devices):
83
- if device["preferred"]:
83
+ if device["imei"] == ok.gui.device_manager.config.get("preferred"):
84
84
  selected = row
85
85
  method = self.tr("PC") if device['method'] == "windows" else self.tr("Android")
86
86
  connected = self.tr("Connected") if device['connected'] else self.tr("Disconnected")
@@ -1,9 +1,9 @@
1
1
  from PySide6.QtCore import QObject, Signal, Qt
2
2
 
3
- from autohelper.capture.HwndWindow import HwndWindow
4
- from autohelper.gui.Communicate import communicate
5
- from autohelper.gui.debug.FrameWidget import FrameWidget
6
- from autohelper.logging.Logger import get_logger
3
+ from ok.capture.HwndWindow import HwndWindow
4
+ from ok.gui.Communicate import communicate
5
+ from ok.gui.debug.FrameWidget import FrameWidget
6
+ from ok.logging.Logger import get_logger
7
7
 
8
8
  logger = get_logger(__name__)
9
9
 
@@ -1,6 +1,6 @@
1
- from autohelper.gui.widget.ListTableWidgetItem import ListTableWidgetItem
2
- from autohelper.gui.widget.NumericTableWidgetItem import NumericTableWidgetItem
3
- from autohelper.gui.widget.YesNonWidgetItem import YesNonWidgetItem
1
+ from ok.gui.widget.ListTableWidgetItem import ListTableWidgetItem
2
+ from ok.gui.widget.NumericTableWidgetItem import NumericTableWidgetItem
3
+ from ok.gui.widget.YesNonWidgetItem import YesNonWidgetItem
4
4
 
5
5
 
6
6
  def config_widget_item(table, row, col, config, key, value):
@@ -2,10 +2,10 @@ from PySide6.QtCore import Slot, QPropertyAnimation
2
2
  from PySide6.QtGui import QColor
3
3
  from PySide6.QtWidgets import QPushButton
4
4
 
5
- import autohelper
6
- from autohelper.gui.Communicate import communicate
7
- from autohelper.gui.util.Alert import show_alert
8
- from autohelper.logging.Logger import get_logger
5
+ import ok
6
+ from ok.gui.Communicate import communicate
7
+ from ok.gui.util.Alert import show_alert
8
+ from ok.logging.Logger import get_logger
9
9
 
10
10
  logger = get_logger(__name__)
11
11
 
@@ -33,12 +33,12 @@ class StartButton(QPushButton):
33
33
  def toggle_text(self):
34
34
  if self.isChecked():
35
35
  logger.info("Click Start Executor")
36
- if not autohelper.gui.executor.start():
36
+ if not ok.gui.executor.start():
37
37
  show_alert("Error", "No Task to Run, Please Enable Task First!")
38
38
  self.setChecked(False)
39
39
  else:
40
40
  logger.info("Click Pause Executor")
41
- autohelper.gui.executor.pause()
41
+ ok.gui.executor.pause()
42
42
 
43
43
  def start_animation(self):
44
44
  self.animation.setStartValue(QColor(0, 0, 0))
@@ -1,8 +1,8 @@
1
1
  from PySide6.QtCore import Slot
2
2
  from PySide6.QtWidgets import QPushButton
3
3
 
4
- from autohelper.logging.Logger import get_logger
5
- from autohelper.task.BaseTask import BaseTask
4
+ from ok.logging.Logger import get_logger
5
+ from ok.task.BaseTask import BaseTask
6
6
 
7
7
  logger = get_logger(__name__)
8
8