ok-script 0.0.8__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.
- {ok-script-0.0.8 → ok-script-0.0.9}/PKG-INFO +2 -2
- {ok-script-0.0.8 → ok-script-0.0.9}/README.md +1 -1
- {ok-script-0.0.8 → ok-script-0.0.9}/ok/OK.py +9 -5
- {ok-script-0.0.8 → ok-script-0.0.9}/ok/capture/adb/DeviceManager.py +6 -15
- {ok-script-0.0.8 → ok-script-0.0.9}/ok/feature/Box.py +20 -5
- {ok-script-0.0.8 → ok-script-0.0.9}/ok/gui/App.py +3 -2
- {ok-script-0.0.8 → ok-script-0.0.9}/ok/gui/MainWindow.py +5 -1
- ok-script-0.0.9/ok/gui/about/AboutTab.py +16 -0
- {ok-script-0.0.8 → ok-script-0.0.9}/ok/gui/loading/LoadingWindow.py +1 -1
- {ok-script-0.0.8 → ok-script-0.0.9}/ok/task/BaseTask.py +5 -2
- {ok-script-0.0.8 → ok-script-0.0.9}/ok/task/ExecutorOperation.py +6 -6
- {ok-script-0.0.8 → ok-script-0.0.9}/ok/task/TaskExecutor.py +1 -6
- ok-script-0.0.9/ok/util/__init__.py +0 -0
- {ok-script-0.0.8 → ok-script-0.0.9}/ok_script.egg-info/PKG-INFO +2 -2
- {ok-script-0.0.8 → ok-script-0.0.9}/ok_script.egg-info/SOURCES.txt +2 -0
- {ok-script-0.0.8 → ok-script-0.0.9}/setup.py +1 -1
- {ok-script-0.0.8 → ok-script-0.0.9}/ok/__init__.py +0 -0
- {ok-script-0.0.8 → ok-script-0.0.9}/ok/capture/BaseCaptureMethod.py +0 -0
- {ok-script-0.0.8 → ok-script-0.0.9}/ok/capture/HwndWindow.py +0 -0
- {ok-script-0.0.8 → ok-script-0.0.9}/ok/capture/__init__.py +0 -0
- {ok-script-0.0.8 → ok-script-0.0.9}/ok/capture/adb/ADBCaptureMethod.py +0 -0
- {ok-script-0.0.8 → ok-script-0.0.9}/ok/capture/adb/__init__.py +0 -0
- {ok-script-0.0.8 → ok-script-0.0.9}/ok/capture/adb/bin/__init__.py +0 -0
- {ok-script-0.0.8 → ok-script-0.0.9}/ok/capture/adb/targets.py +0 -0
- {ok-script-0.0.8 → ok-script-0.0.9}/ok/capture/adb/vbox.py +0 -0
- {ok-script-0.0.8 → ok-script-0.0.9}/ok/capture/windows/WindowsGraphicsCaptureMethod.py +0 -0
- {ok-script-0.0.8 → ok-script-0.0.9}/ok/capture/windows/__init__.py +0 -0
- {ok-script-0.0.8 → ok-script-0.0.9}/ok/capture/windows/d3d11.py +0 -0
- {ok-script-0.0.8 → ok-script-0.0.9}/ok/capture/windows/utils.py +0 -0
- {ok-script-0.0.8 → ok-script-0.0.9}/ok/capture/windows/window.py +0 -0
- {ok-script-0.0.8 → ok-script-0.0.9}/ok/color/Color.py +0 -0
- {ok-script-0.0.8 → ok-script-0.0.9}/ok/color/__init__.py +0 -0
- {ok-script-0.0.8 → ok-script-0.0.9}/ok/config/Config.py +0 -0
- {ok-script-0.0.8 → ok-script-0.0.9}/ok/config/InfoDict.py +0 -0
- {ok-script-0.0.8 → ok-script-0.0.9}/ok/config/__init__.py +0 -0
- {ok-script-0.0.8 → ok-script-0.0.9}/ok/feature/Feature.py +0 -0
- {ok-script-0.0.8 → ok-script-0.0.9}/ok/feature/FeatureSet.py +0 -0
- {ok-script-0.0.8 → ok-script-0.0.9}/ok/feature/FindFeature.py +0 -0
- {ok-script-0.0.8 → ok-script-0.0.9}/ok/feature/__init__.py +0 -0
- {ok-script-0.0.8 → ok-script-0.0.9}/ok/gui/Communicate.py +0 -0
- {ok-script-0.0.8 → ok-script-0.0.9}/ok/gui/TabTitles.py +0 -0
- {ok-script-0.0.8 → ok-script-0.0.9}/ok/gui/__init__.py +0 -0
- {ok-script-0.0.8/ok/gui/debug → ok-script-0.0.9/ok/gui/about}/__init__.py +0 -0
- {ok-script-0.0.8 → ok-script-0.0.9}/ok/gui/debug/AspectRatioWidget.py +0 -0
- {ok-script-0.0.8 → ok-script-0.0.9}/ok/gui/debug/DebugTab.py +0 -0
- {ok-script-0.0.8 → ok-script-0.0.9}/ok/gui/debug/FrameWidget.py +0 -0
- {ok-script-0.0.8 → ok-script-0.0.9}/ok/gui/debug/InfoWidget.py +0 -0
- {ok-script-0.0.8 → ok-script-0.0.9}/ok/gui/debug/LoggerWidget.py +0 -0
- {ok-script-0.0.8/ok/gui/i18n → ok-script-0.0.9/ok/gui/debug}/__init__.py +0 -0
- {ok-script-0.0.8/ok/gui/icon → ok-script-0.0.9/ok/gui/i18n}/__init__.py +0 -0
- {ok-script-0.0.8 → ok-script-0.0.9}/ok/gui/i18n/path.py +0 -0
- {ok-script-0.0.8/ok/gui/loading → ok-script-0.0.9/ok/gui/icon}/__init__.py +0 -0
- {ok-script-0.0.8 → ok-script-0.0.9}/ok/gui/icon/icon.py +0 -0
- {ok-script-0.0.8/ok/gui/overlay → ok-script-0.0.9/ok/gui/loading}/__init__.py +0 -0
- {ok-script-0.0.8 → ok-script-0.0.9}/ok/gui/overlay/OverlayWindow.py +0 -0
- {ok-script-0.0.8/ok/gui/tasks → ok-script-0.0.9/ok/gui/overlay}/__init__.py +0 -0
- {ok-script-0.0.8 → ok-script-0.0.9}/ok/gui/resources.py +0 -0
- {ok-script-0.0.8 → ok-script-0.0.9}/ok/gui/tasks/ConfigItemFactory.py +0 -0
- {ok-script-0.0.8 → ok-script-0.0.9}/ok/gui/tasks/StartButton.py +0 -0
- {ok-script-0.0.8 → ok-script-0.0.9}/ok/gui/tasks/TaskOpButton.py +0 -0
- {ok-script-0.0.8 → ok-script-0.0.9}/ok/gui/tasks/TaskTab.py +0 -0
- {ok-script-0.0.8 → ok-script-0.0.9}/ok/gui/tasks/TooltipTableWidget.py +0 -0
- {ok-script-0.0.8/ok/gui/util → ok-script-0.0.9/ok/gui/tasks}/__init__.py +0 -0
- {ok-script-0.0.8 → ok-script-0.0.9}/ok/gui/util/Alert.py +0 -0
- {ok-script-0.0.8 → ok-script-0.0.9}/ok/gui/util/InitWorker.py +0 -0
- {ok-script-0.0.8/ok/gui/widget → ok-script-0.0.9/ok/gui/util}/__init__.py +0 -0
- {ok-script-0.0.8 → ok-script-0.0.9}/ok/gui/widget/ListTableWidgetItem.py +0 -0
- {ok-script-0.0.8 → ok-script-0.0.9}/ok/gui/widget/NumericTableWidgetItem.py +0 -0
- {ok-script-0.0.8 → ok-script-0.0.9}/ok/gui/widget/RoundCornerContainer.py +0 -0
- {ok-script-0.0.8 → ok-script-0.0.9}/ok/gui/widget/TabWidget.py +0 -0
- {ok-script-0.0.8 → ok-script-0.0.9}/ok/gui/widget/UpdateConfigWidgetItem.py +0 -0
- {ok-script-0.0.8 → ok-script-0.0.9}/ok/gui/widget/YesNonWidgetItem.py +0 -0
- {ok-script-0.0.8/ok/interaction → ok-script-0.0.9/ok/gui/widget}/__init__.py +0 -0
- {ok-script-0.0.8 → ok-script-0.0.9}/ok/interaction/ADBInteraction.py +0 -0
- {ok-script-0.0.8 → ok-script-0.0.9}/ok/interaction/BaseInteraction.py +0 -0
- {ok-script-0.0.8 → ok-script-0.0.9}/ok/interaction/Win32Interaction.py +0 -0
- {ok-script-0.0.8/ok/logging → ok-script-0.0.9/ok/interaction}/__init__.py +0 -0
- {ok-script-0.0.8 → ok-script-0.0.9}/ok/logging/Logger.py +0 -0
- {ok-script-0.0.8/ok/ocr → ok-script-0.0.9/ok/logging}/__init__.py +0 -0
- {ok-script-0.0.8 → ok-script-0.0.9}/ok/ocr/OCR.py +0 -0
- {ok-script-0.0.8/ok/predict → ok-script-0.0.9/ok/ocr}/__init__.py +0 -0
- {ok-script-0.0.8/ok/rotypes/Windows/Media → ok-script-0.0.9/ok/predict}/__init__.py +0 -0
- {ok-script-0.0.8 → ok-script-0.0.9}/ok/predict/predict.py +0 -0
- {ok-script-0.0.8 → ok-script-0.0.9}/ok/rotypes/Windows/Foundation/Collections.py +0 -0
- {ok-script-0.0.8 → ok-script-0.0.9}/ok/rotypes/Windows/Foundation/__init__.py +0 -0
- {ok-script-0.0.8 → ok-script-0.0.9}/ok/rotypes/Windows/Globalization/__init__.py +0 -0
- {ok-script-0.0.8 → ok-script-0.0.9}/ok/rotypes/Windows/Graphics/Capture/__init__.py +0 -0
- {ok-script-0.0.8 → ok-script-0.0.9}/ok/rotypes/Windows/Graphics/DirectX/Direct3D11/__init__.py +0 -0
- {ok-script-0.0.8 → ok-script-0.0.9}/ok/rotypes/Windows/Graphics/DirectX/__init__.py +0 -0
- {ok-script-0.0.8 → ok-script-0.0.9}/ok/rotypes/Windows/Graphics/Imaging/__init__.py +0 -0
- {ok-script-0.0.8 → ok-script-0.0.9}/ok/rotypes/Windows/Graphics/__init__.py +0 -0
- {ok-script-0.0.8 → ok-script-0.0.9}/ok/rotypes/Windows/Media/Ocr/__init__.py +0 -0
- {ok-script-0.0.8/ok/rotypes/Windows/Security → ok-script-0.0.9/ok/rotypes/Windows/Media}/__init__.py +0 -0
- {ok-script-0.0.8 → ok-script-0.0.9}/ok/rotypes/Windows/Security/Cryptography/__init__.py +0 -0
- {ok-script-0.0.8/ok/rotypes/Windows/Storage → ok-script-0.0.9/ok/rotypes/Windows/Security}/__init__.py +0 -0
- {ok-script-0.0.8 → ok-script-0.0.9}/ok/rotypes/Windows/Storage/Streams/__init__.py +0 -0
- {ok-script-0.0.8/ok/rotypes/Windows → ok-script-0.0.9/ok/rotypes/Windows/Storage}/__init__.py +0 -0
- {ok-script-0.0.8/ok/save → ok-script-0.0.9/ok/rotypes/Windows}/__init__.py +0 -0
- {ok-script-0.0.8 → ok-script-0.0.9}/ok/rotypes/__init__.py +0 -0
- {ok-script-0.0.8 → ok-script-0.0.9}/ok/rotypes/delegate.py +0 -0
- {ok-script-0.0.8 → ok-script-0.0.9}/ok/rotypes/export.py +0 -0
- {ok-script-0.0.8 → ok-script-0.0.9}/ok/rotypes/idldsl.py +0 -0
- {ok-script-0.0.8 → ok-script-0.0.9}/ok/rotypes/inspectable.py +0 -0
- {ok-script-0.0.8 → ok-script-0.0.9}/ok/rotypes/roapi.py +0 -0
- {ok-script-0.0.8 → ok-script-0.0.9}/ok/rotypes/types.py +0 -0
- {ok-script-0.0.8 → ok-script-0.0.9}/ok/rotypes/winstring.py +0 -0
- {ok-script-0.0.8 → ok-script-0.0.9}/ok/save/BlackBarProcessor.py +0 -0
- {ok-script-0.0.8 → ok-script-0.0.9}/ok/save/PostProcessor.py +0 -0
- {ok-script-0.0.8 → ok-script-0.0.9}/ok/save/SaveByInterval.py +0 -0
- {ok-script-0.0.8 → ok-script-0.0.9}/ok/save/SaveByKeyPress.py +0 -0
- {ok-script-0.0.8 → ok-script-0.0.9}/ok/save/SaveMethodBase.py +0 -0
- {ok-script-0.0.8/ok/scene → ok-script-0.0.9/ok/save}/__init__.py +0 -0
- {ok-script-0.0.8 → ok-script-0.0.9}/ok/scene/FeatureScene.py +0 -0
- {ok-script-0.0.8 → ok-script-0.0.9}/ok/scene/Scene.py +0 -0
- {ok-script-0.0.8/ok/stats → ok-script-0.0.9/ok/scene}/__init__.py +0 -0
- {ok-script-0.0.8 → ok-script-0.0.9}/ok/stats/StreamStats.py +0 -0
- {ok-script-0.0.8/ok/task → ok-script-0.0.9/ok/stats}/__init__.py +0 -0
- {ok-script-0.0.8 → ok-script-0.0.9}/ok/task/FindFeatureTask.py +0 -0
- {ok-script-0.0.8/ok/util → ok-script-0.0.9/ok/task}/__init__.py +0 -0
- {ok-script-0.0.8 → ok-script-0.0.9}/ok/util/json.py +0 -0
- {ok-script-0.0.8 → ok-script-0.0.9}/ok/util/list.py +0 -0
- {ok-script-0.0.8 → ok-script-0.0.9}/ok/util/path.py +0 -0
- {ok-script-0.0.8 → ok-script-0.0.9}/ok/util/thread.py +0 -0
- {ok-script-0.0.8 → ok-script-0.0.9}/ok/util/win32_process.py +0 -0
- {ok-script-0.0.8 → ok-script-0.0.9}/ok/util/yaml.py +0 -0
- {ok-script-0.0.8 → ok-script-0.0.9}/ok_script.egg-info/dependency_links.txt +0 -0
- {ok-script-0.0.8 → ok-script-0.0.9}/ok_script.egg-info/requires.txt +0 -0
- {ok-script-0.0.8 → ok-script-0.0.9}/ok_script.egg-info/top_level.txt +0 -0
- {ok-script-0.0.8 → 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.
|
|
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
|
-
#
|
|
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,
|
|
@@ -36,18 +36,22 @@ class OK:
|
|
|
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)
|
|
39
|
+
self.config['tasks'], self.config.get('about'), self.exit_event)
|
|
40
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
56
|
self.overlay_window = OverlayWindow(ok.gui.device_manager.hwnd)
|
|
53
57
|
self.app.exec()
|
|
@@ -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
|
-
|
|
116
|
-
|
|
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("
|
|
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("
|
|
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
|
|
@@ -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
|
-
|
|
102
|
+
distance = float('inf')
|
|
95
103
|
elif direction == 'up' and self.y - (box.y + box.height / 2) >= 0:
|
|
96
|
-
|
|
104
|
+
pass
|
|
97
105
|
elif direction == 'down' and box.y - (self.y + self.height / 2) >= 0:
|
|
98
|
-
|
|
106
|
+
pass
|
|
99
107
|
elif direction == 'left' and self.x - (box.x + box.width / 2) >= 0:
|
|
100
|
-
|
|
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')
|
|
@@ -18,12 +18,13 @@ 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,7 +87,7 @@ 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
93
|
if self.overlay and ok.gui.device_manager.hwnd is not None:
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
from PySide6.QtCore import QObject, Signal, Slot
|
|
2
2
|
from PySide6.QtWidgets import QMessageBox, QTabWidget
|
|
3
3
|
|
|
4
|
+
from ok.gui.about.AboutTab import AboutTab
|
|
4
5
|
from ok.gui.debug.DebugTab import DebugTab
|
|
5
6
|
from ok.gui.tasks.TaskTab import TaskTab
|
|
6
7
|
from ok.logging.Logger import get_logger
|
|
@@ -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("""
|
|
@@ -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)
|
|
@@ -80,7 +80,7 @@ class LoadingWindow(QWidget):
|
|
|
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")
|
|
@@ -15,8 +15,6 @@ class BaseTask(ExecutorOperation):
|
|
|
15
15
|
def __init__(self):
|
|
16
16
|
self.logger = get_logger(self.__class__.__name__)
|
|
17
17
|
self.name = self.__class__.__name__
|
|
18
|
-
self.success_count = 0
|
|
19
|
-
self.error_count = 0
|
|
20
18
|
self.enabled = True
|
|
21
19
|
self.running = False
|
|
22
20
|
self.config = None
|
|
@@ -31,6 +29,11 @@ class BaseTask(ExecutorOperation):
|
|
|
31
29
|
self.notification(message)
|
|
32
30
|
communicate.task_info.emit()
|
|
33
31
|
|
|
32
|
+
def log_debug(self, message, notify=False):
|
|
33
|
+
self.logger.debug(message)
|
|
34
|
+
if notify:
|
|
35
|
+
self.notification(message)
|
|
36
|
+
|
|
34
37
|
def log_error(self, message, exception=None, notify=False):
|
|
35
38
|
self.logger.error(message, exception)
|
|
36
39
|
if exception is not None:
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
from ok.feature.Box import Box, find_box_by_name
|
|
2
2
|
from ok.gui.Communicate import communicate
|
|
3
|
-
from ok.logging.Logger import get_logger
|
|
4
|
-
|
|
5
|
-
logger = get_logger(__name__)
|
|
6
3
|
|
|
7
4
|
|
|
8
5
|
class ExecutorOperation:
|
|
@@ -17,6 +14,9 @@ class ExecutorOperation:
|
|
|
17
14
|
else:
|
|
18
15
|
return False
|
|
19
16
|
|
|
17
|
+
def pause(self):
|
|
18
|
+
self.executor.pause()
|
|
19
|
+
|
|
20
20
|
def is_scene(self, the_scene):
|
|
21
21
|
return isinstance(self.executor.current_scene, the_scene)
|
|
22
22
|
|
|
@@ -46,7 +46,7 @@ class ExecutorOperation:
|
|
|
46
46
|
"""
|
|
47
47
|
to_click = find_box_by_name(boxes, names)
|
|
48
48
|
if to_click is not None:
|
|
49
|
-
logger.info(f"click_box_if_name_match found {to_click}")
|
|
49
|
+
self.logger.info(f"click_box_if_name_match found {to_click}")
|
|
50
50
|
self.click_box(to_click, relative_x, relative_y)
|
|
51
51
|
return to_click
|
|
52
52
|
|
|
@@ -79,9 +79,9 @@ class ExecutorOperation:
|
|
|
79
79
|
if len(box) > 0:
|
|
80
80
|
box = box[0]
|
|
81
81
|
else:
|
|
82
|
-
logger.error(f"No box")
|
|
82
|
+
self.logger.error(f"No box")
|
|
83
83
|
if box is None:
|
|
84
|
-
logger.error(f"click_box box is None")
|
|
84
|
+
self.logger.error(f"click_box box is None")
|
|
85
85
|
if raise_if_not_found:
|
|
86
86
|
raise Exception(f"click_box box is None")
|
|
87
87
|
return
|
|
@@ -170,12 +170,7 @@ class TaskExecutor:
|
|
|
170
170
|
task.running = True
|
|
171
171
|
task.last_execute_time = start
|
|
172
172
|
try:
|
|
173
|
-
|
|
174
|
-
if result is not None:
|
|
175
|
-
if result:
|
|
176
|
-
task.success_count += 1
|
|
177
|
-
else:
|
|
178
|
-
task.error_count += 1
|
|
173
|
+
task.run_frame()
|
|
179
174
|
except TaskDisabledException:
|
|
180
175
|
logger.info(f"{task.name} is disabled, breaking")
|
|
181
176
|
except Exception as e:
|
|
File without changes
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: ok-script
|
|
3
|
-
Version: 0.0.
|
|
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
|
-
#
|
|
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,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{ok-script-0.0.8 → ok-script-0.0.9}/ok/rotypes/Windows/Graphics/DirectX/Direct3D11/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{ok-script-0.0.8/ok/rotypes/Windows/Security → ok-script-0.0.9/ok/rotypes/Windows/Media}/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{ok-script-0.0.8/ok/rotypes/Windows → ok-script-0.0.9/ok/rotypes/Windows/Storage}/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|