ok-script 0.0.76__tar.gz → 0.0.78__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.76 → ok-script-0.0.78}/PKG-INFO +1 -1
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/OK.py +15 -10
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/capture/HwndWindow.py +2 -1
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/capture/adb/DeviceManager.py +1 -1
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/feature/FeatureSet.py +2 -1
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/feature/FindFeature.py +1 -1
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/gui/MainWindow.py +2 -6
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/gui/debug/DebugTab.py +4 -5
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/ocr/OCR.py +4 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/task/ExecutorOperation.py +7 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/update/GithubMultiDownloader.py +8 -1
- {ok-script-0.0.76 → ok-script-0.0.78}/ok_script.egg-info/PKG-INFO +1 -1
- {ok-script-0.0.76 → ok-script-0.0.78}/setup.py +1 -1
- {ok-script-0.0.76 → ok-script-0.0.78}/README.md +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/__init__.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/alas/__init__.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/alas/emulator_base.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/alas/emulator_windows.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/alas/platform_base.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/alas/platform_windows.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/alas/utils.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/capture/BaseCaptureMethod.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/capture/__init__.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/capture/adb/ADBCaptureMethod.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/capture/adb/WindowsCaptureFactory.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/capture/adb/__init__.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/capture/adb/bin/__init__.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/capture/image/ImageCaptureMethod.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/capture/image/__init__.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/capture/windows/BaseWindowsCaptureMethod.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/capture/windows/BitBltCaptureMethod.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/capture/windows/DesktopDuplicationCaptureMethod.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/capture/windows/WindowsGraphicsCaptureMethod.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/capture/windows/__init__.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/capture/windows/d3d11.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/capture/windows/dump.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/capture/windows/utils.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/capture/windows/window.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/color/Color.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/color/__init__.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/config/Config.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/config/InfoDict.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/config/__init__.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/feature/Box.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/feature/Feature.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/feature/__init__.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/firebase/Analytics.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/firebase/__init__.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/gui/App.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/gui/Communicate.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/gui/MessageWindow.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/gui/StartController.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/gui/TabTitles.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/gui/__init__.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/gui/about/AboutTab.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/gui/about/HttpTextEdit.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/gui/about/VersionCard.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/gui/about/__init__.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/gui/common/OKIcon.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/gui/common/__init__.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/gui/common/config.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/gui/common/style_sheet.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/gui/debug/AspectRatioWidget.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/gui/debug/FrameWidget.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/gui/debug/InfoWidget.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/gui/debug/LoggerWidget.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/gui/debug/Screenshot.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/gui/debug/__init__.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/gui/i18n/__init__.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/gui/i18n/path.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/gui/i18n/update.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/gui/icon/__init__.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/gui/icon/icon.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/gui/overlay/OverlayWindow.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/gui/overlay/__init__.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/gui/qss/__init__.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/gui/resources.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/gui/settings/SettingTab.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/gui/settings/__init__.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/gui/start/SelectCaptureListView.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/gui/start/StartCard.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/gui/start/StartTab.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/gui/start/__init__.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/gui/tasks/ConfigItemFactory.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/gui/tasks/ConfigLabelAndWidget.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/gui/tasks/LabelAndDoubleSpinBox.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/gui/tasks/LabelAndDropDown.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/gui/tasks/LabelAndLineEdit.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/gui/tasks/LabelAndList.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/gui/tasks/LabelAndSpinBox.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/gui/tasks/LabelAndSwitchButton.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/gui/tasks/LabelAndWidget.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/gui/tasks/ModifyListDialog.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/gui/tasks/ModifyListItem.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/gui/tasks/OneTimeTaskTab.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/gui/tasks/StartButton.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/gui/tasks/TaskCard.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/gui/tasks/TaskOpButton.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/gui/tasks/TooltipTableWidget.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/gui/tasks/TriggerTaskTab.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/gui/tasks/__init__.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/gui/util/Alert.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/gui/util/InitWorker.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/gui/util/__init__.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/gui/widget/Card.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/gui/widget/EmptyCard.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/gui/widget/FramelessDialog.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/gui/widget/ListTableWidgetItem.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/gui/widget/NumericTableWidgetItem.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/gui/widget/StartLoadingDialog.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/gui/widget/StatusBar.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/gui/widget/Tab.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/gui/widget/TabWidget.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/gui/widget/UpdateConfigWidgetItem.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/gui/widget/YesNonWidgetItem.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/gui/widget/__init__.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/interaction/ADBInteraction.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/interaction/BaseInteraction.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/interaction/DoNothingInteraction.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/interaction/Win32Interaction.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/interaction/__init__.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/logging/Logger.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/logging/__init__.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/ocr/__init__.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/rotypes/Windows/Foundation/Collections.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/rotypes/Windows/Foundation/__init__.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/rotypes/Windows/Globalization/__init__.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/rotypes/Windows/Graphics/Capture/__init__.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/rotypes/Windows/Graphics/DirectX/Direct3D11/__init__.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/rotypes/Windows/Graphics/DirectX/__init__.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/rotypes/Windows/Graphics/Imaging/__init__.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/rotypes/Windows/Graphics/__init__.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/rotypes/Windows/Media/Ocr/__init__.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/rotypes/Windows/Media/__init__.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/rotypes/Windows/Security/Cryptography/__init__.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/rotypes/Windows/Security/__init__.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/rotypes/Windows/Storage/Streams/__init__.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/rotypes/Windows/Storage/__init__.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/rotypes/Windows/__init__.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/rotypes/__init__.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/rotypes/delegate.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/rotypes/export.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/rotypes/idldsl.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/rotypes/inspectable.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/rotypes/roapi.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/rotypes/types.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/rotypes/winstring.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/save/BlackBarProcessor.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/save/PostProcessor.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/save/SaveByInterval.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/save/SaveByKeyPress.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/save/SaveMethodBase.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/save/__init__.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/scene/FeatureScene.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/scene/Scene.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/scene/__init__.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/stats/StreamStats.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/stats/__init__.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/task/BaseTask.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/task/OneTimeTask.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/task/TaskExecutor.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/task/TriggerTask.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/task/__init__.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/update/Updater.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/update/__init__.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/update/gen_md5.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/util/Handler.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/util/__init__.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/util/exit_event.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/util/json.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/util/list.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/util/path.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/util/thread.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/util/win32_process.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok/util/yaml.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok_script.egg-info/SOURCES.txt +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok_script.egg-info/dependency_links.txt +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok_script.egg-info/requires.txt +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/ok_script.egg-info/top_level.txt +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/setup.cfg +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/tests/__init__.py +0 -0
- {ok-script-0.0.76 → ok-script-0.0.78}/tests/test_updater.py +0 -0
|
@@ -27,6 +27,7 @@ class OK:
|
|
|
27
27
|
app = None
|
|
28
28
|
screenshot = None
|
|
29
29
|
exit_event = ExitEvent()
|
|
30
|
+
init_error = None
|
|
30
31
|
|
|
31
32
|
def __init__(self, config: Dict[str, Any]):
|
|
32
33
|
print(f"AutoHelper init, config: {config}")
|
|
@@ -57,7 +58,8 @@ class OK:
|
|
|
57
58
|
def start(self):
|
|
58
59
|
try:
|
|
59
60
|
if self.config.get("use_gui"):
|
|
60
|
-
self.
|
|
61
|
+
if not self.init_error:
|
|
62
|
+
self.app.show_main_window()
|
|
61
63
|
self.app.exec()
|
|
62
64
|
else:
|
|
63
65
|
self.task_executor.start()
|
|
@@ -91,14 +93,6 @@ class OK:
|
|
|
91
93
|
|
|
92
94
|
def do_init(self):
|
|
93
95
|
logger.info(f"initializing {self.__class__.__name__}, config: {self.config}")
|
|
94
|
-
if self.config.get('ocr'):
|
|
95
|
-
isascii, path = install_path_isascii()
|
|
96
|
-
if not isascii:
|
|
97
|
-
self.app.show_path_ascii_error(path)
|
|
98
|
-
return False
|
|
99
|
-
from rapidocr_openvino import RapidOCR
|
|
100
|
-
inference_num_threads = self.config.get('ocr').get('inference_num_threads', -1)
|
|
101
|
-
self.ocr = RapidOCR(inference_num_threads=inference_num_threads)
|
|
102
96
|
|
|
103
97
|
template_matching = self.config.get('template_matching')
|
|
104
98
|
if template_matching is not None:
|
|
@@ -117,10 +111,21 @@ class OK:
|
|
|
117
111
|
trigger_tasks=self.config.get('trigger_tasks', []),
|
|
118
112
|
scenes=self.config['scenes'],
|
|
119
113
|
feature_set=self.feature_set,
|
|
120
|
-
|
|
114
|
+
config_folder=self.config.get("config_folder"))
|
|
121
115
|
|
|
122
116
|
ok.gui.executor = self.task_executor
|
|
123
117
|
|
|
118
|
+
if self.config.get('ocr'):
|
|
119
|
+
isascii, path = install_path_isascii()
|
|
120
|
+
if not isascii:
|
|
121
|
+
self.app.show_path_ascii_error(path)
|
|
122
|
+
self.init_error = True
|
|
123
|
+
return False
|
|
124
|
+
from rapidocr_openvino import RapidOCR
|
|
125
|
+
inference_num_threads = self.config.get('ocr').get('inference_num_threads', -1)
|
|
126
|
+
self.ocr = RapidOCR(inference_num_threads=inference_num_threads)
|
|
127
|
+
self.task_executor.ocr = self.ocr
|
|
128
|
+
|
|
124
129
|
return True
|
|
125
130
|
|
|
126
131
|
def wait_task(self):
|
|
@@ -186,8 +186,9 @@ def find_hwnd(title, exe_name, frame_width, frame_height):
|
|
|
186
186
|
biggest = result
|
|
187
187
|
x_offset = 0
|
|
188
188
|
y_offset = 0
|
|
189
|
-
real_width, real_height =
|
|
189
|
+
real_width, real_height = 0, 0
|
|
190
190
|
if biggest is not None and frame_aspect_ratio != 0:
|
|
191
|
+
real_width, real_height = biggest[2], biggest[3]
|
|
191
192
|
matching_child = enum_child_windows(biggest, frame_aspect_ratio)
|
|
192
193
|
if matching_child is not None:
|
|
193
194
|
x_offset, y_offset, real_width, real_height = matching_child
|
|
@@ -280,7 +280,7 @@ class DeviceManager:
|
|
|
280
280
|
communicate.adb_devices.emit(True)
|
|
281
281
|
|
|
282
282
|
def update_resolution_for_hwnd(self):
|
|
283
|
-
if self.hwnd is not None and self.hwnd.frame_aspect_ratio == 0:
|
|
283
|
+
if self.hwnd is not None and self.hwnd.frame_aspect_ratio == 0 and self.adb_capture_config:
|
|
284
284
|
width, height = self.get_resolution()
|
|
285
285
|
logger.debug(f'update resolution for {self.hwnd} {width}x{height}')
|
|
286
286
|
self.hwnd.update_frame_size(width, height)
|
|
@@ -105,7 +105,8 @@ class FeatureSet:
|
|
|
105
105
|
self.feature_dict[category_name] = Feature(image, x, y, w, h)
|
|
106
106
|
self.box_dict[category_name] = Box(x, y, w, h, name=category_name)
|
|
107
107
|
|
|
108
|
-
def get_box_by_name(self, category_name: str) -> Box:
|
|
108
|
+
def get_box_by_name(self, mat, category_name: str) -> Box:
|
|
109
|
+
self.check_size(mat)
|
|
109
110
|
if category_name in self.box_dict:
|
|
110
111
|
return self.box_dict[category_name]
|
|
111
112
|
else:
|
|
@@ -18,7 +18,7 @@ class FindFeature:
|
|
|
18
18
|
threshold, use_gray_scale, x, y, to_x, to_y, width, height)
|
|
19
19
|
|
|
20
20
|
def get_box_by_name(self, name):
|
|
21
|
-
return self.feature_set.get_box_by_name(name)
|
|
21
|
+
return self.feature_set.get_box_by_name(self.executor.frame, name)
|
|
22
22
|
|
|
23
23
|
def find_feature_and_set(self, features, horizontal_variance=0, vertical_variance=0, threshold=0):
|
|
24
24
|
ret = True
|
|
@@ -2,12 +2,10 @@ import os
|
|
|
2
2
|
import sys
|
|
3
3
|
|
|
4
4
|
from PySide6.QtCore import QObject, Signal, Qt
|
|
5
|
-
from PySide6.QtGui import QKeySequence, QShortcut
|
|
6
5
|
from PySide6.QtWidgets import QMenu, QSystemTrayIcon
|
|
7
6
|
from qfluentwidgets import FluentIcon, NavigationItemPosition, MSFluentWindow, InfoBar, InfoBarPosition, MessageBox
|
|
8
7
|
|
|
9
8
|
import ok.gui
|
|
10
|
-
from ok.capture.windows.dump import dump_threads
|
|
11
9
|
from ok.gui.Communicate import communicate
|
|
12
10
|
from ok.gui.about.AboutTab import AboutTab
|
|
13
11
|
from ok.gui.debug.DebugTab import DebugTab
|
|
@@ -68,8 +66,6 @@ class MainWindow(MSFluentWindow):
|
|
|
68
66
|
communicate.executor_paused.connect(self.executor_paused)
|
|
69
67
|
communicate.tab.connect(self.navigate_tab)
|
|
70
68
|
|
|
71
|
-
|
|
72
|
-
|
|
73
69
|
# Create a context menu for the tray
|
|
74
70
|
menu = QMenu()
|
|
75
71
|
exit_action = menu.addAction(self.tr("Exit"))
|
|
@@ -168,9 +164,9 @@ class MainWindow(MSFluentWindow):
|
|
|
168
164
|
# Create a message box that asks the user if they really want to close the window
|
|
169
165
|
if sys.platform == 'win32' and 'shutdown' in os.environ.get('SESSIONNAME', '').lower():
|
|
170
166
|
event.accept()
|
|
167
|
+
ok.gui.ok.quit()
|
|
171
168
|
return
|
|
172
169
|
|
|
173
|
-
# Your existing code for the message box
|
|
174
170
|
if ok.gui.ok.exit_event.is_set():
|
|
175
171
|
event.accept()
|
|
176
172
|
return
|
|
@@ -179,7 +175,7 @@ class MainWindow(MSFluentWindow):
|
|
|
179
175
|
w = MessageBox(title, content, self.window())
|
|
180
176
|
if w.exec():
|
|
181
177
|
logger.info("Window closed")
|
|
182
|
-
ok.gui.ok.quit()
|
|
183
178
|
event.accept()
|
|
179
|
+
ok.gui.ok.quit()
|
|
184
180
|
else:
|
|
185
181
|
event.ignore()
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import subprocess
|
|
2
2
|
from ctypes import windll, wintypes
|
|
3
3
|
|
|
4
|
-
from PySide6.QtCore import Qt, Signal
|
|
5
|
-
from PySide6.
|
|
6
|
-
from PySide6.QtWidgets import QWidget, QFileDialog, QCompleter, QVBoxLayout, QHBoxLayout, QMessageBox
|
|
4
|
+
from PySide6.QtCore import Qt, Signal
|
|
5
|
+
from PySide6.QtWidgets import QWidget, QFileDialog, QCompleter, QVBoxLayout, QHBoxLayout
|
|
7
6
|
from _ctypes import byref
|
|
8
7
|
from qfluentwidgets import PushButton, FlowLayout, ComboBox, SearchLineEdit, TextEdit
|
|
9
8
|
|
|
@@ -124,9 +123,9 @@ class DebugTab(Tab):
|
|
|
124
123
|
VK_S = 0x53
|
|
125
124
|
|
|
126
125
|
if not windll.user32.RegisterHotKey(None, 1, MOD_ALT | MOD_CONTROL, VK_D):
|
|
127
|
-
|
|
126
|
+
logger.debug("Failed to register hotkey for Alt+Ctrl+D")
|
|
128
127
|
if not windll.user32.RegisterHotKey(None, 2, MOD_ALT | MOD_CONTROL, VK_S):
|
|
129
|
-
|
|
128
|
+
logger.debug("Failed to register hotkey for Alt+Ctrl+S")
|
|
130
129
|
logger.debug('bind_hot_keys')
|
|
131
130
|
|
|
132
131
|
def __del__(self):
|
|
@@ -51,6 +51,7 @@ class OCR:
|
|
|
51
51
|
time.sleep(3)
|
|
52
52
|
result, _ = self.executor.ocr(image, use_det=True, use_cls=False, use_rec=True)
|
|
53
53
|
detected_boxes = []
|
|
54
|
+
ocr_boxes = None
|
|
54
55
|
# Process the results and create Box objects
|
|
55
56
|
if result is not None:
|
|
56
57
|
for res in result:
|
|
@@ -70,6 +71,7 @@ class OCR:
|
|
|
70
71
|
detected_box.x += box.x
|
|
71
72
|
detected_box.y += box.y
|
|
72
73
|
detected_boxes.append(detected_box)
|
|
74
|
+
ocr_boxes = detected_boxes
|
|
73
75
|
if match is not None:
|
|
74
76
|
detected_boxes = find_boxes_by_name(detected_boxes, match)
|
|
75
77
|
|
|
@@ -77,6 +79,8 @@ class OCR:
|
|
|
77
79
|
communicate.emit_draw_box("ocr_zone", box, "blue")
|
|
78
80
|
logger.debug(
|
|
79
81
|
f"ocr_zone {box} found result: {len(detected_boxes)}) time: {(time.time() - start):.2f} scale_factor: {scale_factor:.2f}")
|
|
82
|
+
if not detected_boxes and ocr_boxes:
|
|
83
|
+
logger.info(f'ocr detected but no match: {match} {ocr_boxes}')
|
|
80
84
|
return sort_boxes(detected_boxes)
|
|
81
85
|
|
|
82
86
|
def wait_click_ocr(self, x=0, y=0, to_x=1, to_y=1, width=0, height=0, box=None, name=None,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import queue
|
|
2
2
|
from typing import List
|
|
3
3
|
|
|
4
|
+
from ok.color.Color import calculate_color_percentage
|
|
4
5
|
from ok.feature.Box import Box, find_box_by_name, relative_box
|
|
5
6
|
from ok.gui.Communicate import communicate
|
|
6
7
|
|
|
@@ -163,5 +164,11 @@ class ExecutorOperation:
|
|
|
163
164
|
def draw_boxes(feature_name=None, boxes=None, color="red"):
|
|
164
165
|
communicate.emit_draw_box(feature_name, boxes, color)
|
|
165
166
|
|
|
167
|
+
def calculate_color_percentage(self, color, box: Box):
|
|
168
|
+
percentage = calculate_color_percentage(self.frame, color, box)
|
|
169
|
+
box.confidence = percentage
|
|
170
|
+
self.draw_boxes(box.name, box)
|
|
171
|
+
return percentage
|
|
172
|
+
|
|
166
173
|
def adb_shell(self, *args, **kwargs):
|
|
167
174
|
return self.executor.device_manager.shell(*args, **kwargs)
|
|
@@ -55,13 +55,14 @@ class GithubMultiDownloader:
|
|
|
55
55
|
downloaded = os.path.getsize(file)
|
|
56
56
|
if downloaded == part_size:
|
|
57
57
|
logger.info(f'File {file} already downloaded')
|
|
58
|
+
self.downloaded += part_size
|
|
58
59
|
return
|
|
59
60
|
elif downloaded > part_size:
|
|
60
61
|
logger.warning(f'File size error {file} {downloaded} > {part_size}')
|
|
61
62
|
os.remove(file)
|
|
62
63
|
else:
|
|
63
64
|
part_start += downloaded
|
|
64
|
-
|
|
65
|
+
self.downloaded += downloaded
|
|
65
66
|
|
|
66
67
|
target_size = end - part_start + 1
|
|
67
68
|
|
|
@@ -117,6 +118,12 @@ class GithubMultiDownloader:
|
|
|
117
118
|
response.close()
|
|
118
119
|
logger.debug('switch to fast proxy')
|
|
119
120
|
break
|
|
121
|
+
if part_downloaded == target_size:
|
|
122
|
+
logger.debug("download_part finished")
|
|
123
|
+
return
|
|
124
|
+
else:
|
|
125
|
+
logger.warning(f'download_part size failed {part_downloaded} {target_size}')
|
|
126
|
+
return True
|
|
120
127
|
except Exception as e:
|
|
121
128
|
with self.lock:
|
|
122
129
|
if proxy in self.proxys:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
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.76 → ok-script-0.0.78}/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
|