ok-script 0.0.41__tar.gz → 0.0.42__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.42}/PKG-INFO +1 -1
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/capture/BaseCaptureMethod.py +0 -7
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/capture/HwndWindow.py +25 -33
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/capture/adb/DeviceManager.py +17 -9
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/capture/windows/WindowsGraphicsCaptureMethod.py +32 -29
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/task/ExecutorOperation.py +6 -3
- {ok-script-0.0.41 → ok-script-0.0.42}/ok_script.egg-info/PKG-INFO +1 -1
- {ok-script-0.0.41 → ok-script-0.0.42}/setup.py +1 -1
- {ok-script-0.0.41 → ok-script-0.0.42}/README.md +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/OK.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/__init__.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/capture/__init__.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/capture/adb/ADBCaptureMethod.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/capture/adb/__init__.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/capture/adb/bin/__init__.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/capture/adb/targets.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/capture/adb/vbox.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/capture/windows/__init__.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/capture/windows/d3d11.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/capture/windows/dump.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/capture/windows/utils.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/capture/windows/window.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/color/Color.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/color/__init__.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/config/Config.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/config/InfoDict.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/config/__init__.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/feature/Box.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/feature/Feature.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/feature/FeatureSet.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/feature/FindFeature.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/feature/__init__.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/gui/App.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/gui/Communicate.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/gui/MainWindow.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/gui/MessageWindow.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/gui/TabTitles.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/gui/__init__.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/gui/about/AboutTab.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/gui/about/__init__.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/gui/common/OKIcon.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/gui/common/__init__.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/gui/common/config.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/gui/common/style_sheet.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/gui/debug/AspectRatioWidget.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/gui/debug/DebugTab.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/gui/debug/FrameWidget.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/gui/debug/InfoWidget.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/gui/debug/LoggerWidget.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/gui/debug/Screenshot.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/gui/debug/__init__.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/gui/i18n/__init__.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/gui/i18n/path.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/gui/i18n/update.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/gui/icon/__init__.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/gui/icon/icon.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/gui/overlay/OverlayWindow.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/gui/overlay/__init__.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/gui/qss/__init__.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/gui/resources.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/gui/settings/SettingTab.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/gui/settings/__init__.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/gui/start/SelectCaptureListView.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/gui/start/SelectHwndWindow.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/gui/start/StartCard.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/gui/start/StartTab.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/gui/start/__init__.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/gui/tasks/ConfigItemFactory.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/gui/tasks/ConfigLabelAndWidget.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/gui/tasks/LabelAndDoubleSpinBox.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/gui/tasks/LabelAndDropDown.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/gui/tasks/LabelAndLineEdit.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/gui/tasks/LabelAndList.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/gui/tasks/LabelAndSpinBox.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/gui/tasks/LabelAndSwitchButton.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/gui/tasks/LabelAndWidget.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/gui/tasks/ModifyListDialog.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/gui/tasks/ModifyListItem.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/gui/tasks/OneTimeTaskTab.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/gui/tasks/StartButton.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/gui/tasks/TaskCard.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/gui/tasks/TaskOpButton.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/gui/tasks/TooltipTableWidget.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/gui/tasks/TriggerTaskTab.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/gui/tasks/__init__.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/gui/util/Alert.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/gui/util/InitWorker.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/gui/util/__init__.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/gui/widget/Card.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/gui/widget/FramelessDialog.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/gui/widget/ListTableWidgetItem.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/gui/widget/NumericTableWidgetItem.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/gui/widget/StatusBar.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/gui/widget/Tab.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/gui/widget/TabWidget.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/gui/widget/UpdateConfigWidgetItem.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/gui/widget/YesNonWidgetItem.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/gui/widget/__init__.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/interaction/ADBInteraction.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/interaction/BaseInteraction.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/interaction/Win32Interaction.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/interaction/__init__.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/logging/Logger.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/logging/__init__.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/ocr/OCR.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/ocr/__init__.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/rotypes/Windows/Foundation/Collections.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/rotypes/Windows/Foundation/__init__.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/rotypes/Windows/Globalization/__init__.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/rotypes/Windows/Graphics/Capture/__init__.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/rotypes/Windows/Graphics/DirectX/Direct3D11/__init__.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/rotypes/Windows/Graphics/DirectX/__init__.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/rotypes/Windows/Graphics/Imaging/__init__.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/rotypes/Windows/Graphics/__init__.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/rotypes/Windows/Media/Ocr/__init__.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/rotypes/Windows/Media/__init__.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/rotypes/Windows/Security/Cryptography/__init__.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/rotypes/Windows/Security/__init__.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/rotypes/Windows/Storage/Streams/__init__.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/rotypes/Windows/Storage/__init__.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/rotypes/Windows/__init__.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/rotypes/__init__.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/rotypes/delegate.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/rotypes/export.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/rotypes/idldsl.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/rotypes/inspectable.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/rotypes/roapi.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/rotypes/types.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/rotypes/winstring.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/save/BlackBarProcessor.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/save/PostProcessor.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/save/SaveByInterval.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/save/SaveByKeyPress.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/save/SaveMethodBase.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/save/__init__.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/scene/FeatureScene.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/scene/Scene.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/scene/__init__.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/stats/StreamStats.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/stats/__init__.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/task/BaseTask.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/task/OneTimeTask.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/task/TaskExecutor.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/task/TriggerTask.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/task/__init__.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/util/__init__.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/util/exit_event.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/util/json.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/util/list.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/util/path.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/util/thread.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/util/win32_process.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok/util/yaml.py +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok_script.egg-info/SOURCES.txt +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok_script.egg-info/dependency_links.txt +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok_script.egg-info/requires.txt +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/ok_script.egg-info/top_level.txt +0 -0
- {ok-script-0.0.41 → ok-script-0.0.42}/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:
|
|
@@ -142,37 +142,29 @@ class HwndWindow:
|
|
|
142
142
|
return ""
|
|
143
143
|
|
|
144
144
|
|
|
145
|
-
def find_hwnd_by_title_and_exe(title,
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
elif re.search(title, text):
|
|
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
|
|
145
|
+
def find_hwnd_by_title_and_exe(title, exe_name):
|
|
146
|
+
result = []
|
|
147
|
+
|
|
148
|
+
def callback(hwnd, lParam):
|
|
149
|
+
if len(result) == 0 and win32gui.IsWindowVisible(hwnd) and win32gui.IsWindowEnabled(hwnd):
|
|
150
|
+
if title:
|
|
151
|
+
text = win32gui.GetWindowText(hwnd)
|
|
152
|
+
if isinstance(title, str):
|
|
153
|
+
if title != text:
|
|
154
|
+
return True
|
|
155
|
+
elif not re.search(title, text):
|
|
156
|
+
return True
|
|
157
|
+
if exe_name:
|
|
158
|
+
name = get_exe_name_by_hwnd(hwnd)
|
|
159
|
+
if name == exe_name:
|
|
160
|
+
result.append(hwnd)
|
|
161
|
+
return True # Stop enumeration as we found the first match
|
|
162
|
+
else:
|
|
163
|
+
result.append(hwnd)
|
|
164
|
+
return True
|
|
165
|
+
|
|
166
|
+
win32gui.EnumWindows(callback, None)
|
|
167
|
+
return result[0] if result else None
|
|
176
168
|
|
|
177
169
|
|
|
178
170
|
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,13 @@ class DeviceManager:
|
|
|
44
45
|
|
|
45
46
|
@property
|
|
46
47
|
def device_dict(self):
|
|
47
|
-
|
|
48
|
+
device_dict = self.config.get("devices")
|
|
49
|
+
if self.pc_device is not None:
|
|
50
|
+
full = {'pc': self.pc_device}
|
|
51
|
+
full.update(device_dict)
|
|
52
|
+
return full
|
|
53
|
+
else:
|
|
54
|
+
return device_dict
|
|
48
55
|
|
|
49
56
|
def connect_all(self):
|
|
50
57
|
if not self._connect_all:
|
|
@@ -61,7 +68,6 @@ class DeviceManager:
|
|
|
61
68
|
return list(self.device_dict.values())
|
|
62
69
|
|
|
63
70
|
def do_refresh(self):
|
|
64
|
-
self.connect_all()
|
|
65
71
|
|
|
66
72
|
if self.hwnd_title:
|
|
67
73
|
nick = ""
|
|
@@ -74,16 +80,18 @@ class DeviceManager:
|
|
|
74
80
|
hwnd)
|
|
75
81
|
if not nick:
|
|
76
82
|
nick = self.exe_name
|
|
77
|
-
self.
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
+
self.pc_device = {"address": "", "imei": 'pc', "device": "windows",
|
|
84
|
+
"model": "", "nick": nick, "width": width,
|
|
85
|
+
"height": height,
|
|
86
|
+
"hwnd": nick, "capture": "windows",
|
|
87
|
+
"connected": hwnd is not None
|
|
88
|
+
}
|
|
83
89
|
if width != 0:
|
|
84
|
-
self.
|
|
90
|
+
self.pc_device["resolution"] = f"{width}x{height}"
|
|
85
91
|
communicate.adb_devices.emit(False)
|
|
86
92
|
|
|
93
|
+
self.connect_all()
|
|
94
|
+
|
|
87
95
|
installed_emulators = installed_emulator()
|
|
88
96
|
for device in self.adb.list():
|
|
89
97
|
logger.debug(f'adb.list() {device}')
|
|
@@ -118,37 +118,40 @@ 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
|
-
|
|
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
|
-
|
|
150
|
-
|
|
151
|
-
self.
|
|
124
|
+
try:
|
|
125
|
+
if self.hwnd_window.exists and self.frame_pool is None:
|
|
126
|
+
logger.info('init windows capture')
|
|
127
|
+
self.rtdevice = IDirect3DDevice()
|
|
128
|
+
self.dxdevice = d3d11.ID3D11Device()
|
|
129
|
+
self.immediatedc = d3d11.ID3D11DeviceContext()
|
|
130
|
+
self.create_device()
|
|
131
|
+
interop = GetActivationFactory('Windows.Graphics.Capture.GraphicsCaptureItem').astype(
|
|
132
|
+
IGraphicsCaptureItemInterop)
|
|
133
|
+
item = interop.CreateForWindow(self.hwnd_window.hwnd, IGraphicsCaptureItem.GUID)
|
|
134
|
+
self.item = item
|
|
135
|
+
self.last_size = item.Size
|
|
136
|
+
delegate = TypedEventHandler(GraphicsCaptureItem, IInspectable).delegate(
|
|
137
|
+
self.close)
|
|
138
|
+
self.evtoken = item.add_Closed(delegate)
|
|
139
|
+
self.frame_pool = Direct3D11CaptureFramePool.CreateFreeThreaded(self.rtdevice,
|
|
140
|
+
DirectXPixelFormat.B8G8R8A8UIntNormalized,
|
|
141
|
+
1, item.Size)
|
|
142
|
+
self.session = self.frame_pool.CreateCaptureSession(item)
|
|
143
|
+
pool = self.frame_pool
|
|
144
|
+
pool.add_FrameArrived(
|
|
145
|
+
TypedEventHandler(Direct3D11CaptureFramePool, IInspectable).delegate(
|
|
146
|
+
self.frame_arrived_callback))
|
|
147
|
+
self.session.IsCursorCaptureEnabled = capture_cursor
|
|
148
|
+
if WINDOWS_BUILD_NUMBER >= WGC_NO_BORDER_MIN_BUILD:
|
|
149
|
+
self.session.IsBorderRequired = False
|
|
150
|
+
self.session.StartCapture()
|
|
151
|
+
elif not self.hwnd_window.exists and self.frame_pool is not None:
|
|
152
|
+
self.close()
|
|
153
|
+
except Exception as e:
|
|
154
|
+
logger.error('start_or_stop failed:', exception=e)
|
|
152
155
|
return self.hwnd_window.exists
|
|
153
156
|
|
|
154
157
|
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.42}/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
|