ok-script 0.0.69__tar.gz → 0.0.70__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.69 → ok-script-0.0.70}/PKG-INFO +1 -1
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/OK.py +3 -5
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/capture/BaseCaptureMethod.py +2 -2
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/capture/HwndWindow.py +8 -55
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/capture/adb/DeviceManager.py +30 -13
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/capture/windows/BitBltCaptureMethod.py +9 -2
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/task/TaskExecutor.py +1 -1
- {ok-script-0.0.69 → ok-script-0.0.70}/ok_script.egg-info/PKG-INFO +1 -1
- {ok-script-0.0.69 → ok-script-0.0.70}/setup.py +1 -1
- {ok-script-0.0.69 → ok-script-0.0.70}/README.md +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/__init__.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/alas/__init__.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/alas/emulator_base.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/alas/emulator_windows.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/alas/platform_base.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/alas/platform_windows.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/alas/utils.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/capture/__init__.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/capture/adb/ADBCaptureMethod.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/capture/adb/WindowsCaptureFactory.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/capture/adb/__init__.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/capture/adb/bin/__init__.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/capture/image/ImageCaptureMethod.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/capture/image/__init__.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/capture/windows/BaseWindowsCaptureMethod.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/capture/windows/DesktopDuplicationCaptureMethod.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/capture/windows/WindowsGraphicsCaptureMethod.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/capture/windows/__init__.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/capture/windows/d3d11.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/capture/windows/dump.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/capture/windows/utils.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/capture/windows/window.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/color/Color.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/color/__init__.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/config/Config.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/config/InfoDict.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/config/__init__.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/feature/Box.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/feature/Feature.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/feature/FeatureSet.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/feature/FindFeature.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/feature/__init__.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/firebase/FireBaseAnalytics.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/firebase/__init__.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/gui/App.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/gui/Communicate.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/gui/MainWindow.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/gui/MessageWindow.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/gui/StartController.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/gui/TabTitles.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/gui/__init__.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/gui/about/AboutTab.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/gui/about/HttpTextEdit.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/gui/about/VersionCard.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/gui/about/__init__.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/gui/common/OKIcon.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/gui/common/__init__.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/gui/common/config.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/gui/common/style_sheet.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/gui/debug/AspectRatioWidget.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/gui/debug/DebugTab.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/gui/debug/FrameWidget.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/gui/debug/InfoWidget.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/gui/debug/LoggerWidget.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/gui/debug/Screenshot.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/gui/debug/__init__.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/gui/i18n/__init__.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/gui/i18n/path.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/gui/i18n/update.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/gui/icon/__init__.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/gui/icon/icon.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/gui/overlay/OverlayWindow.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/gui/overlay/__init__.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/gui/qss/__init__.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/gui/resources.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/gui/settings/SettingTab.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/gui/settings/__init__.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/gui/start/SelectCaptureListView.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/gui/start/StartCard.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/gui/start/StartTab.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/gui/start/__init__.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/gui/tasks/ConfigItemFactory.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/gui/tasks/ConfigLabelAndWidget.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/gui/tasks/LabelAndDoubleSpinBox.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/gui/tasks/LabelAndDropDown.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/gui/tasks/LabelAndLineEdit.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/gui/tasks/LabelAndList.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/gui/tasks/LabelAndSpinBox.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/gui/tasks/LabelAndSwitchButton.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/gui/tasks/LabelAndWidget.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/gui/tasks/ModifyListDialog.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/gui/tasks/ModifyListItem.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/gui/tasks/OneTimeTaskTab.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/gui/tasks/StartButton.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/gui/tasks/TaskCard.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/gui/tasks/TaskOpButton.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/gui/tasks/TooltipTableWidget.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/gui/tasks/TriggerTaskTab.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/gui/tasks/__init__.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/gui/util/Alert.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/gui/util/InitWorker.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/gui/util/__init__.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/gui/widget/Card.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/gui/widget/EmptyCard.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/gui/widget/FramelessDialog.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/gui/widget/ListTableWidgetItem.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/gui/widget/NumericTableWidgetItem.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/gui/widget/StartLoadingDialog.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/gui/widget/StatusBar.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/gui/widget/Tab.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/gui/widget/TabWidget.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/gui/widget/UpdateConfigWidgetItem.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/gui/widget/YesNonWidgetItem.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/gui/widget/__init__.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/interaction/ADBInteraction.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/interaction/BaseInteraction.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/interaction/DoNothingInteraction.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/interaction/Win32Interaction.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/interaction/__init__.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/logging/Logger.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/logging/__init__.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/ocr/OCR.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/ocr/__init__.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/rotypes/Windows/Foundation/Collections.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/rotypes/Windows/Foundation/__init__.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/rotypes/Windows/Globalization/__init__.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/rotypes/Windows/Graphics/Capture/__init__.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/rotypes/Windows/Graphics/DirectX/Direct3D11/__init__.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/rotypes/Windows/Graphics/DirectX/__init__.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/rotypes/Windows/Graphics/Imaging/__init__.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/rotypes/Windows/Graphics/__init__.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/rotypes/Windows/Media/Ocr/__init__.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/rotypes/Windows/Media/__init__.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/rotypes/Windows/Security/Cryptography/__init__.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/rotypes/Windows/Security/__init__.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/rotypes/Windows/Storage/Streams/__init__.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/rotypes/Windows/Storage/__init__.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/rotypes/Windows/__init__.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/rotypes/__init__.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/rotypes/delegate.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/rotypes/export.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/rotypes/idldsl.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/rotypes/inspectable.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/rotypes/roapi.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/rotypes/types.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/rotypes/winstring.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/save/BlackBarProcessor.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/save/PostProcessor.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/save/SaveByInterval.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/save/SaveByKeyPress.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/save/SaveMethodBase.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/save/__init__.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/scene/FeatureScene.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/scene/Scene.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/scene/__init__.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/stats/StreamStats.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/stats/__init__.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/task/BaseTask.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/task/ExecutorOperation.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/task/OneTimeTask.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/task/TriggerTask.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/task/__init__.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/update/GithubMultiDownloader.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/update/Updater.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/update/__init__.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/update/gen_md5.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/util/Handler.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/util/__init__.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/util/exit_event.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/util/json.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/util/list.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/util/path.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/util/thread.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/util/win32_process.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok/util/yaml.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok_script.egg-info/SOURCES.txt +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok_script.egg-info/dependency_links.txt +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok_script.egg-info/requires.txt +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/ok_script.egg-info/top_level.txt +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/setup.cfg +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/tests/__init__.py +0 -0
- {ok-script-0.0.69 → ok-script-0.0.70}/tests/test_updater.py +0 -0
|
@@ -34,7 +34,8 @@ class OK:
|
|
|
34
34
|
config_logger(config)
|
|
35
35
|
logger.info(f"AutoHelper init, config: {config}")
|
|
36
36
|
ok.gui.ok = self
|
|
37
|
-
|
|
37
|
+
config['debug'] = config.get("debug", False)
|
|
38
|
+
self.debug = config['debug']
|
|
38
39
|
try:
|
|
39
40
|
self.config = config
|
|
40
41
|
self.init_device_manager()
|
|
@@ -135,9 +136,6 @@ class OK:
|
|
|
135
136
|
def init_device_manager(self):
|
|
136
137
|
if self.device_manager is None:
|
|
137
138
|
from ok.capture.adb.DeviceManager import DeviceManager
|
|
138
|
-
self.device_manager = DeviceManager(self.config
|
|
139
|
-
self.config.get('windows'),
|
|
140
|
-
self.config.get('adb'),
|
|
141
|
-
self.config.get("debug"),
|
|
139
|
+
self.device_manager = DeviceManager(self.config,
|
|
142
140
|
self.exit_event)
|
|
143
141
|
ok.gui.device_manager = self.device_manager
|
|
@@ -28,7 +28,7 @@ class BaseCaptureMethod:
|
|
|
28
28
|
try:
|
|
29
29
|
self.get_frame()
|
|
30
30
|
except Exception as e:
|
|
31
|
-
logger.error('get frame error')
|
|
31
|
+
logger.error('width get frame error', e)
|
|
32
32
|
return self._size[0]
|
|
33
33
|
|
|
34
34
|
@property
|
|
@@ -37,7 +37,7 @@ class BaseCaptureMethod:
|
|
|
37
37
|
try:
|
|
38
38
|
self.get_frame()
|
|
39
39
|
except Exception as e:
|
|
40
|
-
logger.error('get frame error')
|
|
40
|
+
logger.error('height get frame error', e)
|
|
41
41
|
return self._size[1]
|
|
42
42
|
|
|
43
43
|
def get_frame(self) -> np.ndarray | None:
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
# original https://github.com/dantmnf & https://github.com/hakaboom/winAuto
|
|
2
|
-
import os.path
|
|
3
2
|
import re
|
|
4
3
|
import threading
|
|
5
4
|
import time
|
|
@@ -75,13 +74,13 @@ class HwndWindow:
|
|
|
75
74
|
def update_frame_size(self, width, height):
|
|
76
75
|
logger.debug(f"update_frame_size:{self.frame_width}x{self.frame_height} to {width}x{height}")
|
|
77
76
|
if width != self.frame_width or height != self.frame_height:
|
|
78
|
-
self.hwnd = None
|
|
79
77
|
self.frame_width = width
|
|
80
78
|
self.frame_height = height
|
|
81
79
|
if width > 0 and height > 0:
|
|
82
80
|
self.frame_aspect_ratio = width / height
|
|
83
81
|
logger.debug(f"HwndWindow: frame ratio: width: {width}, height: {height}")
|
|
84
|
-
|
|
82
|
+
self.hwnd = None
|
|
83
|
+
self.do_update_window_size()
|
|
85
84
|
|
|
86
85
|
def update_window_size(self):
|
|
87
86
|
while not self.app_exit_event.is_set() and not self.stop_event.is_set():
|
|
@@ -131,8 +130,8 @@ class HwndWindow:
|
|
|
131
130
|
self.x, self.y, self.border, self.title_height, self.width, self.height, self.ext_left_bounds, self.ext_top_bounds = x, y, border, title_height, width, height, ext_left_bounds, ext_top_bounds
|
|
132
131
|
changed = True
|
|
133
132
|
if changed:
|
|
134
|
-
logger.
|
|
135
|
-
f"do_update_window_size changed,visible:{self.visible} x:{self.x} y:{self.y} border:{self.border}
|
|
133
|
+
logger.info(
|
|
134
|
+
f"do_update_window_size changed,visible:{self.visible} x:{self.x} y:{self.y} border:{self.border} window:{self.width}x{self.height} self.title_height:{self.title_height} real:{self.real_width}x{self.real_height} scaling:{self.scaling}")
|
|
136
135
|
communicate.window.emit(self.visible, self.x, self.y, self.border, self.title_height, self.width,
|
|
137
136
|
self.height, self.scaling)
|
|
138
137
|
except Exception as e:
|
|
@@ -185,13 +184,6 @@ def find_hwnd(title, exe_name, frame_width, frame_height):
|
|
|
185
184
|
from ok.capture.windows.BitBltCaptureMethod import bit_blt_test_hwnd
|
|
186
185
|
if (biggest is None or (result[2] * result[3]) > biggest[2] * biggest[3]) and bit_blt_test_hwnd(result[0]):
|
|
187
186
|
biggest = result
|
|
188
|
-
for result in results:
|
|
189
|
-
if frame_aspect_ratio != 0:
|
|
190
|
-
ratio = result[2] / result[3]
|
|
191
|
-
difference = abs(ratio - frame_aspect_ratio)
|
|
192
|
-
support = difference <= 0.01 * frame_aspect_ratio
|
|
193
|
-
if support and biggest != result:
|
|
194
|
-
ratio_match = result
|
|
195
187
|
x_offset = 0
|
|
196
188
|
y_offset = 0
|
|
197
189
|
real_width, real_height = biggest[2], biggest[3]
|
|
@@ -199,7 +191,7 @@ def find_hwnd(title, exe_name, frame_width, frame_height):
|
|
|
199
191
|
matching_child = enum_child_windows(biggest, frame_aspect_ratio)
|
|
200
192
|
if matching_child is not None:
|
|
201
193
|
x_offset, y_offset, real_width, real_height = matching_child
|
|
202
|
-
logger.
|
|
194
|
+
logger.info(f'find_hwnd {frame_width, frame_height} {biggest} {x_offset, y_offset, real_width, real_height}')
|
|
203
195
|
return biggest[6], biggest[0], biggest[1], x_offset, y_offset, real_width, real_height,
|
|
204
196
|
else:
|
|
205
197
|
return None, None, None, 0, 0, 0, 0
|
|
@@ -216,10 +208,10 @@ def enum_child_windows(biggest, frame_aspect_ratio):
|
|
|
216
208
|
visible = win32gui.IsWindowVisible(hwnd)
|
|
217
209
|
parent = win32gui.GetParent(hwnd)
|
|
218
210
|
rect = win32gui.GetWindowRect(hwnd)
|
|
219
|
-
|
|
211
|
+
real_width = rect[2] - rect[0]
|
|
212
|
+
real_height = rect[3] - rect[1]
|
|
213
|
+
logger.info(f'find_hwnd child_callback {visible} {biggest[0]} {parent} {rect} {real_width} {real_height}')
|
|
220
214
|
if visible and parent == biggest[0]:
|
|
221
|
-
real_width = rect[2] - rect[0]
|
|
222
|
-
real_height = rect[3] - rect[1]
|
|
223
215
|
ratio = real_width / real_height
|
|
224
216
|
difference = abs(ratio - frame_aspect_ratio)
|
|
225
217
|
support = difference <= 0.01 * frame_aspect_ratio
|
|
@@ -244,45 +236,6 @@ def get_exe_by_hwnd(hwnd):
|
|
|
244
236
|
return process.name(), process.exe()
|
|
245
237
|
|
|
246
238
|
|
|
247
|
-
def enum_windows(emulator_path=None):
|
|
248
|
-
if emulator_path is not None:
|
|
249
|
-
emulator_path = os.path.normpath(emulator_path)
|
|
250
|
-
|
|
251
|
-
def callback(hwnd, extra):
|
|
252
|
-
name, full_path = get_exe_by_hwnd(hwnd)
|
|
253
|
-
if emulator_path and emulator_path != full_path:
|
|
254
|
-
return True
|
|
255
|
-
buff = win32gui.GetWindowText(hwnd)
|
|
256
|
-
if buff and win32gui.IsWindowVisible(hwnd):
|
|
257
|
-
rect = win32gui.GetWindowRect(hwnd)
|
|
258
|
-
width = rect[2] - rect[0]
|
|
259
|
-
height = rect[3] - rect[1]
|
|
260
|
-
extra.append((hwnd, buff, width, height))
|
|
261
|
-
return True
|
|
262
|
-
|
|
263
|
-
windows = []
|
|
264
|
-
win32gui.EnumWindows(callback, windows)
|
|
265
|
-
return windows
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
#
|
|
269
|
-
# def enum_child_windows(parent_handle):
|
|
270
|
-
# """
|
|
271
|
-
# A function to enumerate all child windows of the given parent window handle
|
|
272
|
-
# and print their handle and window title.
|
|
273
|
-
# """
|
|
274
|
-
#
|
|
275
|
-
# def callback(hwnd, _):
|
|
276
|
-
# if win32gui.IsWindowVisible(hwnd) and win32gui.GetParent(hwnd) == parent_handle:
|
|
277
|
-
# rect = win32gui.GetWindowRect(hwnd)
|
|
278
|
-
# width = rect[2] - rect[0]
|
|
279
|
-
# height = rect[3] - rect[1]
|
|
280
|
-
# print(f"Child HWND: {hwnd} - Window Text: {win32gui.GetWindowText(hwnd)} {rect} {width} {height}")
|
|
281
|
-
# return True
|
|
282
|
-
#
|
|
283
|
-
# win32gui.EnumChildWindows(parent_handle, callback, None)
|
|
284
|
-
|
|
285
|
-
|
|
286
239
|
if __name__ == '__main__':
|
|
287
240
|
print(find_hwnd("MuMu模拟器12", None))
|
|
288
241
|
# hwnd_window = HwndWindow(threading.Event(), None, 'D:\\MuMuPlayer-12.0\\shell\\MuMuPlayer.exe', 16, 9)
|
|
@@ -16,20 +16,25 @@ logger = get_logger(__name__)
|
|
|
16
16
|
|
|
17
17
|
class DeviceManager:
|
|
18
18
|
|
|
19
|
-
def __init__(self,
|
|
19
|
+
def __init__(self, app_config, exit_event=None):
|
|
20
20
|
self._device = None
|
|
21
21
|
self._adb = None
|
|
22
|
-
self.
|
|
23
|
-
|
|
24
|
-
self.
|
|
22
|
+
self.supported_ratio = parse_ratio(app_config.get(
|
|
23
|
+
'supported_screen_ratio'))
|
|
24
|
+
self.windows_capture_config = app_config.get('windows')
|
|
25
|
+
self.adb_capture_config = app_config.get('adb')
|
|
26
|
+
self.debug = app_config.get('debug')
|
|
25
27
|
self.interaction = None
|
|
26
28
|
self.device_dict = {}
|
|
27
29
|
self.exit_event = exit_event
|
|
28
30
|
self.resolution_dict = {}
|
|
29
|
-
if windows_capture_config is not None:
|
|
30
|
-
self.hwnd = HwndWindow(exit_event, windows_capture_config.get('title'),
|
|
31
|
-
windows_capture_config.get('exe'))
|
|
32
|
-
|
|
31
|
+
if self.windows_capture_config is not None:
|
|
32
|
+
self.hwnd = HwndWindow(exit_event, self.windows_capture_config.get('title'),
|
|
33
|
+
self.windows_capture_config.get('exe'))
|
|
34
|
+
else:
|
|
35
|
+
self.hwnd = None
|
|
36
|
+
self.config = Config({"preferred": "none", "pc_full_path": "none", 'capture': 'windows'},
|
|
37
|
+
app_config.get('config_folder'),
|
|
33
38
|
"devices")
|
|
34
39
|
self.capture_method = None
|
|
35
40
|
self.handler = Handler(exit_event, 'RefreshAdb')
|
|
@@ -113,7 +118,7 @@ class DeviceManager:
|
|
|
113
118
|
found = True
|
|
114
119
|
break
|
|
115
120
|
if not found:
|
|
116
|
-
|
|
121
|
+
width, height = self.get_resolution(adb_device)
|
|
117
122
|
logger.debug(f'refresh_phones found an phone {adb_device}')
|
|
118
123
|
phone_device = {"address": adb_device.serial, "device": "adb", "connected": True, "imei": imei,
|
|
119
124
|
"nick": adb_device.prop.model or imei,
|
|
@@ -150,8 +155,11 @@ class DeviceManager:
|
|
|
150
155
|
frame = do_screencap(device)
|
|
151
156
|
if frame is not None:
|
|
152
157
|
height, width, _ = frame.shape
|
|
153
|
-
self.
|
|
154
|
-
|
|
158
|
+
if self.supported_ratio is None or abs(width / height - self.supported_ratio) < 0.01:
|
|
159
|
+
self.resolution_dict[device.serial] = (width, height)
|
|
160
|
+
else:
|
|
161
|
+
logger.warning(f'resolution error {device.serial} {self.supported_ratio} {width, height}')
|
|
162
|
+
return width, height
|
|
155
163
|
|
|
156
164
|
def set_preferred_device(self, imei=None, index=-1):
|
|
157
165
|
logger.debug(f"set_preferred_device {imei} {index}")
|
|
@@ -244,7 +252,7 @@ class DeviceManager:
|
|
|
244
252
|
self.interaction = Win32Interaction(self.capture_method)
|
|
245
253
|
preferred['connected'] = self.capture_method.connected()
|
|
246
254
|
else:
|
|
247
|
-
|
|
255
|
+
width, height = self.get_resolution()
|
|
248
256
|
if self.config.get('capture') == "windows":
|
|
249
257
|
self.ensure_hwnd(None, preferred.get('full_path'), width, height)
|
|
250
258
|
self.use_windows_capture({'can_bit_blt': True}, require_bg=True, use_bit_blt_only=True)
|
|
@@ -271,7 +279,7 @@ class DeviceManager:
|
|
|
271
279
|
|
|
272
280
|
def update_resolution_for_hwnd(self):
|
|
273
281
|
if self.hwnd is not None and self.hwnd.frame_aspect_ratio == 0:
|
|
274
|
-
|
|
282
|
+
width, height = self.get_resolution()
|
|
275
283
|
logger.debug(f'update resolution for {self.hwnd} {width}x{height}')
|
|
276
284
|
self.hwnd.update_frame_size(width, height)
|
|
277
285
|
|
|
@@ -375,3 +383,12 @@ class DeviceManager:
|
|
|
375
383
|
elif installed := self.adb_check_installed(packages):
|
|
376
384
|
self.adb_start_package(installed)
|
|
377
385
|
return True
|
|
386
|
+
|
|
387
|
+
|
|
388
|
+
def parse_ratio(ratio_str):
|
|
389
|
+
if ratio_str:
|
|
390
|
+
# Split the string into two parts: '16' and '9'
|
|
391
|
+
numerator, denominator = ratio_str.split(':')
|
|
392
|
+
# Convert the strings to integers and perform the division
|
|
393
|
+
ratio_float = int(numerator) / int(denominator)
|
|
394
|
+
return ratio_float
|
|
@@ -40,8 +40,15 @@ class BitBltCaptureMethod(BaseWindowsCaptureMethod):
|
|
|
40
40
|
|
|
41
41
|
@override
|
|
42
42
|
def do_get_frame(self) -> MatLike | None:
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
if self.hwnd_window.real_x_offset != 0 or self.hwnd_window.real_y_offset != 0:
|
|
44
|
+
x = self.hwnd_window.real_x_offset
|
|
45
|
+
y = self.hwnd_window.real_y_offset
|
|
46
|
+
else:
|
|
47
|
+
x = self.hwnd_window.border
|
|
48
|
+
y = self.hwnd_window.title_height
|
|
49
|
+
|
|
50
|
+
return bit_blt_capture_frame(self.hwnd_window.hwnd, x,
|
|
51
|
+
y,
|
|
45
52
|
self.hwnd_window.real_width or self.hwnd_window.width,
|
|
46
53
|
self.hwnd_window.real_height or self.hwnd_window.height,
|
|
47
54
|
self.hwnd_window.ext_left_bounds, self.hwnd_window.ext_top_bounds)
|
|
@@ -74,12 +74,12 @@ class TaskExecutor:
|
|
|
74
74
|
return self._frame
|
|
75
75
|
|
|
76
76
|
def check_frame_and_resolution(self, supported_ratio):
|
|
77
|
+
self.device_manager.update_resolution_for_hwnd()
|
|
77
78
|
frame = self.method.get_frame()
|
|
78
79
|
if frame is None:
|
|
79
80
|
return False, None
|
|
80
81
|
if supported_ratio is None:
|
|
81
82
|
return True, None
|
|
82
|
-
self.device_manager.update_resolution_for_hwnd()
|
|
83
83
|
width = self.method.width
|
|
84
84
|
height = self.method.height
|
|
85
85
|
if height == 0:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
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.69 → ok-script-0.0.70}/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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|