ok-script 0.0.41__tar.gz → 0.0.43__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.41 → ok-script-0.0.43}/PKG-INFO +1 -1
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/capture/BaseCaptureMethod.py +0 -7
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/capture/HwndWindow.py +29 -32
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/capture/adb/DeviceManager.py +34 -13
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/capture/windows/WindowsGraphicsCaptureMethod.py +31 -26
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/task/ExecutorOperation.py +6 -3
- {ok-script-0.0.41 → ok-script-0.0.43}/ok_script.egg-info/PKG-INFO +1 -1
- {ok-script-0.0.41 → ok-script-0.0.43}/setup.py +1 -1
- {ok-script-0.0.41 → ok-script-0.0.43}/README.md +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/OK.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/__init__.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/capture/__init__.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/capture/adb/ADBCaptureMethod.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/capture/adb/__init__.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/capture/adb/bin/__init__.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/capture/adb/targets.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/capture/adb/vbox.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/capture/windows/__init__.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/capture/windows/d3d11.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/capture/windows/dump.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/capture/windows/utils.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/capture/windows/window.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/color/Color.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/color/__init__.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/config/Config.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/config/InfoDict.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/config/__init__.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/feature/Box.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/feature/Feature.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/feature/FeatureSet.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/feature/FindFeature.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/feature/__init__.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/gui/App.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/gui/Communicate.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/gui/MainWindow.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/gui/MessageWindow.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/gui/TabTitles.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/gui/__init__.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/gui/about/AboutTab.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/gui/about/__init__.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/gui/common/OKIcon.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/gui/common/__init__.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/gui/common/config.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/gui/common/style_sheet.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/gui/debug/AspectRatioWidget.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/gui/debug/DebugTab.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/gui/debug/FrameWidget.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/gui/debug/InfoWidget.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/gui/debug/LoggerWidget.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/gui/debug/Screenshot.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/gui/debug/__init__.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/gui/i18n/__init__.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/gui/i18n/path.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/gui/i18n/update.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/gui/icon/__init__.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/gui/icon/icon.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/gui/overlay/OverlayWindow.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/gui/overlay/__init__.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/gui/qss/__init__.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/gui/resources.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/gui/settings/SettingTab.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/gui/settings/__init__.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/gui/start/SelectCaptureListView.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/gui/start/SelectHwndWindow.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/gui/start/StartCard.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/gui/start/StartTab.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/gui/start/__init__.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/gui/tasks/ConfigItemFactory.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/gui/tasks/ConfigLabelAndWidget.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/gui/tasks/LabelAndDoubleSpinBox.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/gui/tasks/LabelAndDropDown.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/gui/tasks/LabelAndLineEdit.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/gui/tasks/LabelAndList.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/gui/tasks/LabelAndSpinBox.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/gui/tasks/LabelAndSwitchButton.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/gui/tasks/LabelAndWidget.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/gui/tasks/ModifyListDialog.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/gui/tasks/ModifyListItem.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/gui/tasks/OneTimeTaskTab.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/gui/tasks/StartButton.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/gui/tasks/TaskCard.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/gui/tasks/TaskOpButton.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/gui/tasks/TooltipTableWidget.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/gui/tasks/TriggerTaskTab.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/gui/tasks/__init__.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/gui/util/Alert.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/gui/util/InitWorker.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/gui/util/__init__.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/gui/widget/Card.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/gui/widget/FramelessDialog.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/gui/widget/ListTableWidgetItem.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/gui/widget/NumericTableWidgetItem.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/gui/widget/StatusBar.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/gui/widget/Tab.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/gui/widget/TabWidget.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/gui/widget/UpdateConfigWidgetItem.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/gui/widget/YesNonWidgetItem.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/gui/widget/__init__.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/interaction/ADBInteraction.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/interaction/BaseInteraction.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/interaction/Win32Interaction.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/interaction/__init__.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/logging/Logger.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/logging/__init__.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/ocr/OCR.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/ocr/__init__.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/rotypes/Windows/Foundation/Collections.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/rotypes/Windows/Foundation/__init__.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/rotypes/Windows/Globalization/__init__.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/rotypes/Windows/Graphics/Capture/__init__.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/rotypes/Windows/Graphics/DirectX/Direct3D11/__init__.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/rotypes/Windows/Graphics/DirectX/__init__.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/rotypes/Windows/Graphics/Imaging/__init__.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/rotypes/Windows/Graphics/__init__.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/rotypes/Windows/Media/Ocr/__init__.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/rotypes/Windows/Media/__init__.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/rotypes/Windows/Security/Cryptography/__init__.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/rotypes/Windows/Security/__init__.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/rotypes/Windows/Storage/Streams/__init__.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/rotypes/Windows/Storage/__init__.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/rotypes/Windows/__init__.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/rotypes/__init__.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/rotypes/delegate.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/rotypes/export.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/rotypes/idldsl.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/rotypes/inspectable.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/rotypes/roapi.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/rotypes/types.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/rotypes/winstring.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/save/BlackBarProcessor.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/save/PostProcessor.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/save/SaveByInterval.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/save/SaveByKeyPress.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/save/SaveMethodBase.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/save/__init__.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/scene/FeatureScene.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/scene/Scene.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/scene/__init__.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/stats/StreamStats.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/stats/__init__.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/task/BaseTask.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/task/OneTimeTask.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/task/TaskExecutor.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/task/TriggerTask.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/task/__init__.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/util/__init__.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/util/exit_event.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/util/json.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/util/list.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/util/path.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/util/thread.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/util/win32_process.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok/util/yaml.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok_script.egg-info/SOURCES.txt +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok_script.egg-info/dependency_links.txt +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok_script.egg-info/requires.txt +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/ok_script.egg-info/top_level.txt +0 -0
- {ok-script-0.0.41 → ok-script-0.0.43}/setup.cfg +0 -0
|
@@ -8,13 +8,6 @@ class CaptureException(Exception):
|
|
|
8
8
|
class BaseCaptureMethod:
|
|
9
9
|
name = "None"
|
|
10
10
|
description = ""
|
|
11
|
-
last_captured_frame: np.ndarray
|
|
12
|
-
top_cut = 0
|
|
13
|
-
bottom_cut = 0
|
|
14
|
-
left_cut = 0
|
|
15
|
-
right_cut = 0
|
|
16
|
-
width = 0
|
|
17
|
-
height = 0
|
|
18
11
|
_size = (0, 0)
|
|
19
12
|
|
|
20
13
|
def __init__(self):
|
|
@@ -101,7 +101,7 @@ class HwndWindow:
|
|
|
101
101
|
visible = is_foreground_window(self.hwnd)
|
|
102
102
|
x, y, border, title_height, width, height, scaling = get_window_bounds(
|
|
103
103
|
self.hwnd)
|
|
104
|
-
if self.frame_aspect_ratio != 0:
|
|
104
|
+
if self.frame_aspect_ratio != 0 and height != 0:
|
|
105
105
|
window_ratio = width / height
|
|
106
106
|
if window_ratio < self.frame_aspect_ratio:
|
|
107
107
|
cropped_window_height = int(width / self.frame_aspect_ratio)
|
|
@@ -124,7 +124,7 @@ class HwndWindow:
|
|
|
124
124
|
changed = True
|
|
125
125
|
if changed:
|
|
126
126
|
logger.debug(
|
|
127
|
-
f"do_update_window_size changed:
|
|
127
|
+
f"do_update_window_size changed,visible:{self.visible} x:{self.x} y:{self.y} border:{self.border} width:{self.width} height:{self.height} self.title_height:{self.title_height} scaling:{self.scaling}")
|
|
128
128
|
communicate.window.emit(self.visible, self.x, self.y, self.border, self.title_height, self.width,
|
|
129
129
|
self.height, self.scaling)
|
|
130
130
|
except Exception as e:
|
|
@@ -141,38 +141,35 @@ class HwndWindow:
|
|
|
141
141
|
return win32gui.GetWindowText(self.hwnd)
|
|
142
142
|
return ""
|
|
143
143
|
|
|
144
|
+
def __str__(self) -> str:
|
|
145
|
+
return f"title:{self.title},exe:{self.exe_name},width:{self.width},height:{self.height},exists:{self.exists},visible:{self.visible}"
|
|
144
146
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
+
|
|
148
|
+
def find_hwnd_by_title_and_exe(title, exe_name):
|
|
149
|
+
result = []
|
|
150
|
+
if title is None and exe_name is None:
|
|
147
151
|
return None
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
hwnds.append(hwnd)
|
|
170
|
-
|
|
171
|
-
win32gui.EnumWindows(enum_windows_proc, None)
|
|
172
|
-
if len(hwnds) > 0:
|
|
173
|
-
if len(hwnds) > 1:
|
|
174
|
-
logger.warning(f"Found multiple hwnds {len(hwnds)}")
|
|
175
|
-
return hwnds
|
|
152
|
+
|
|
153
|
+
def callback(hwnd, lParam):
|
|
154
|
+
if len(result) == 0 and win32gui.IsWindowVisible(hwnd) and win32gui.IsWindowEnabled(hwnd):
|
|
155
|
+
if title:
|
|
156
|
+
text = win32gui.GetWindowText(hwnd)
|
|
157
|
+
if isinstance(title, str):
|
|
158
|
+
if title != text:
|
|
159
|
+
return True
|
|
160
|
+
elif not re.search(title, text):
|
|
161
|
+
return True
|
|
162
|
+
if exe_name:
|
|
163
|
+
name = get_exe_name_by_hwnd(hwnd)
|
|
164
|
+
if name == exe_name:
|
|
165
|
+
result.append(hwnd)
|
|
166
|
+
return True # Stop enumeration as we found the first match
|
|
167
|
+
else:
|
|
168
|
+
result.append(hwnd)
|
|
169
|
+
return True
|
|
170
|
+
|
|
171
|
+
win32gui.EnumWindows(callback, None)
|
|
172
|
+
return result[0] if result else None
|
|
176
173
|
|
|
177
174
|
|
|
178
175
|
OpenProcess = ctypes.windll.kernel32.OpenProcess
|
|
@@ -26,6 +26,7 @@ class DeviceManager:
|
|
|
26
26
|
self.adb = self.adb = adbutils.AdbClient(host="127.0.0.1")
|
|
27
27
|
logger.debug(f'connect adb')
|
|
28
28
|
self.hwnd_title = hwnd_title
|
|
29
|
+
self.pc_device = None
|
|
29
30
|
self.exe_name = exe_name
|
|
30
31
|
self.debug = debug
|
|
31
32
|
self.interaction = None
|
|
@@ -44,7 +45,15 @@ class DeviceManager:
|
|
|
44
45
|
|
|
45
46
|
@property
|
|
46
47
|
def device_dict(self):
|
|
47
|
-
|
|
48
|
+
device_dict = self.config.get("devices")
|
|
49
|
+
if device_dict is None:
|
|
50
|
+
device_dict = {}
|
|
51
|
+
if self.pc_device is not None:
|
|
52
|
+
full = {'pc': self.pc_device}
|
|
53
|
+
full.update(device_dict)
|
|
54
|
+
return full
|
|
55
|
+
else:
|
|
56
|
+
return device_dict
|
|
48
57
|
|
|
49
58
|
def connect_all(self):
|
|
50
59
|
if not self._connect_all:
|
|
@@ -61,7 +70,6 @@ class DeviceManager:
|
|
|
61
70
|
return list(self.device_dict.values())
|
|
62
71
|
|
|
63
72
|
def do_refresh(self):
|
|
64
|
-
self.connect_all()
|
|
65
73
|
|
|
66
74
|
if self.hwnd_title:
|
|
67
75
|
nick = ""
|
|
@@ -74,16 +82,18 @@ class DeviceManager:
|
|
|
74
82
|
hwnd)
|
|
75
83
|
if not nick:
|
|
76
84
|
nick = self.exe_name
|
|
77
|
-
self.
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
85
|
+
self.pc_device = {"address": "", "imei": 'pc', "device": "windows",
|
|
86
|
+
"model": "", "nick": nick, "width": width,
|
|
87
|
+
"height": height,
|
|
88
|
+
"hwnd": nick, "capture": "windows",
|
|
89
|
+
"connected": hwnd is not None
|
|
90
|
+
}
|
|
83
91
|
if width != 0:
|
|
84
|
-
self.
|
|
92
|
+
self.pc_device["resolution"] = f"{width}x{height}"
|
|
85
93
|
communicate.adb_devices.emit(False)
|
|
86
94
|
|
|
95
|
+
self.connect_all()
|
|
96
|
+
|
|
87
97
|
installed_emulators = installed_emulator()
|
|
88
98
|
for device in self.adb.list():
|
|
89
99
|
logger.debug(f'adb.list() {device}')
|
|
@@ -120,15 +130,15 @@ class DeviceManager:
|
|
|
120
130
|
old_hwnd = self.device_dict[imei].get("hwnd")
|
|
121
131
|
self.device_dict[imei] = adb_device
|
|
122
132
|
if old_capture is not None:
|
|
123
|
-
self.
|
|
133
|
+
self.update_device_value(imei, 'capture', old_capture)
|
|
124
134
|
if old_hwnd is not None:
|
|
125
|
-
self.
|
|
135
|
+
self.update_device_value(imei, 'hwnd', old_hwnd)
|
|
126
136
|
else:
|
|
127
|
-
self.
|
|
137
|
+
self.update_device(imei, adb_device)
|
|
128
138
|
adb_connected.append(imei)
|
|
129
139
|
for imei in self.device_dict:
|
|
130
140
|
if imei not in adb_connected and self.device_dict[imei]['device'] == 'adb':
|
|
131
|
-
self.
|
|
141
|
+
self.update_device_value(imei, 'connected', False)
|
|
132
142
|
|
|
133
143
|
self.config.save_file()
|
|
134
144
|
|
|
@@ -138,6 +148,17 @@ class DeviceManager:
|
|
|
138
148
|
communicate.adb_devices.emit(True)
|
|
139
149
|
logger.debug(f'refresh {self.device_dict}')
|
|
140
150
|
|
|
151
|
+
def update_device(self, imei, device=None):
|
|
152
|
+
devices = self.config.get("devices", {})
|
|
153
|
+
devices[imei] = device
|
|
154
|
+
self.config["devices"] = devices
|
|
155
|
+
|
|
156
|
+
def update_device_value(self, imei, key, value):
|
|
157
|
+
devices = self.config.get("devices", {})
|
|
158
|
+
if imei in devices:
|
|
159
|
+
devices[imei][key] = value
|
|
160
|
+
self.config["devices"] = devices
|
|
161
|
+
|
|
141
162
|
def set_preferred_device(self, imei=None):
|
|
142
163
|
logger.debug(f"set_preferred_device {imei}")
|
|
143
164
|
if imei is None:
|
|
@@ -118,37 +118,42 @@ class WindowsGraphicsCaptureMethod(BaseCaptureMethod):
|
|
|
118
118
|
self.start_or_stop()
|
|
119
119
|
|
|
120
120
|
def connected(self):
|
|
121
|
-
return self.hwnd_window is not None and self.hwnd_window.exists
|
|
121
|
+
return self.hwnd_window is not None and self.hwnd_window.exists and self.frame_pool is not None
|
|
122
122
|
|
|
123
123
|
def start_or_stop(self, capture_cursor=False):
|
|
124
|
+
|
|
124
125
|
if self.hwnd_window.exists and self.frame_pool is None:
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
126
|
+
try:
|
|
127
|
+
logger.info('init windows capture')
|
|
128
|
+
self.rtdevice = IDirect3DDevice()
|
|
129
|
+
self.dxdevice = d3d11.ID3D11Device()
|
|
130
|
+
self.immediatedc = d3d11.ID3D11DeviceContext()
|
|
131
|
+
self.create_device()
|
|
132
|
+
interop = GetActivationFactory('Windows.Graphics.Capture.GraphicsCaptureItem').astype(
|
|
133
|
+
IGraphicsCaptureItemInterop)
|
|
134
|
+
item = interop.CreateForWindow(self.hwnd_window.hwnd, IGraphicsCaptureItem.GUID)
|
|
135
|
+
self.item = item
|
|
136
|
+
self.last_size = item.Size
|
|
137
|
+
delegate = TypedEventHandler(GraphicsCaptureItem, IInspectable).delegate(
|
|
138
|
+
self.close)
|
|
139
|
+
self.evtoken = item.add_Closed(delegate)
|
|
140
|
+
self.frame_pool = Direct3D11CaptureFramePool.CreateFreeThreaded(self.rtdevice,
|
|
141
|
+
DirectXPixelFormat.B8G8R8A8UIntNormalized,
|
|
142
|
+
1, item.Size)
|
|
143
|
+
self.session = self.frame_pool.CreateCaptureSession(item)
|
|
144
|
+
pool = self.frame_pool
|
|
145
|
+
pool.add_FrameArrived(
|
|
146
|
+
TypedEventHandler(Direct3D11CaptureFramePool, IInspectable).delegate(
|
|
147
|
+
self.frame_arrived_callback))
|
|
148
|
+
self.session.IsCursorCaptureEnabled = capture_cursor
|
|
149
|
+
if WINDOWS_BUILD_NUMBER >= WGC_NO_BORDER_MIN_BUILD:
|
|
150
|
+
self.session.IsBorderRequired = False
|
|
151
|
+
self.session.StartCapture()
|
|
152
|
+
except Exception as e:
|
|
153
|
+
logger.error(f'start_or_stop failed: {self.hwnd_window}', exception=e)
|
|
150
154
|
elif not self.hwnd_window.exists and self.frame_pool is not None:
|
|
151
155
|
self.close()
|
|
156
|
+
|
|
152
157
|
return self.hwnd_window.exists
|
|
153
158
|
|
|
154
159
|
def create_device(self):
|
|
@@ -13,10 +13,13 @@ class ExecutorOperation:
|
|
|
13
13
|
def box_in_horizontal_center(self, box, off_percent=0.02):
|
|
14
14
|
if box is None:
|
|
15
15
|
return False
|
|
16
|
+
|
|
16
17
|
center = self.executor.method.width / 2
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
box_center = box.x + box.width / 2
|
|
19
|
+
|
|
20
|
+
offset = abs(box_center - center)
|
|
21
|
+
|
|
22
|
+
if offset / self.executor.method.width < off_percent:
|
|
20
23
|
return True
|
|
21
24
|
else:
|
|
22
25
|
return False
|
|
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
|
|
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.41 → ok-script-0.0.43}/ok/rotypes/Windows/Graphics/DirectX/Direct3D11/__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
|
|
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
|