ok-script 0.0.48__tar.gz → 0.0.49__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.48 → ok-script-0.0.49}/PKG-INFO +1 -1
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/OK.py +3 -2
- ok-script-0.0.49/ok/config/Config.py +132 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/gui/debug/Screenshot.py +0 -1
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/gui/resources.py +2 -2
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/gui/start/StartCard.py +13 -8
- {ok-script-0.0.48 → ok-script-0.0.49}/ok_script.egg-info/PKG-INFO +1 -1
- {ok-script-0.0.48 → ok-script-0.0.49}/setup.py +1 -1
- ok-script-0.0.48/ok/config/Config.py +0 -100
- {ok-script-0.0.48 → ok-script-0.0.49}/README.md +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/__init__.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/capture/BaseCaptureMethod.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/capture/HwndWindow.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/capture/__init__.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/capture/adb/ADBCaptureMethod.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/capture/adb/DeviceManager.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/capture/adb/WindowsCaptureFactory.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/capture/adb/__init__.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/capture/adb/bin/__init__.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/capture/adb/targets.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/capture/adb/vbox.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/capture/windows/BaseWindowsCaptureMethod.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/capture/windows/BitBltCaptureMethod.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/capture/windows/DesktopDuplicationCaptureMethod.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/capture/windows/WindowsGraphicsCaptureMethod.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/capture/windows/__init__.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/capture/windows/d3d11.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/capture/windows/dump.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/capture/windows/utils.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/capture/windows/window.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/color/Color.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/color/__init__.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/config/InfoDict.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/config/__init__.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/feature/Box.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/feature/Feature.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/feature/FeatureSet.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/feature/FindFeature.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/feature/__init__.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/gui/App.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/gui/Communicate.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/gui/MainWindow.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/gui/MessageWindow.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/gui/TabTitles.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/gui/__init__.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/gui/about/AboutTab.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/gui/about/__init__.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/gui/common/OKIcon.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/gui/common/__init__.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/gui/common/config.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/gui/common/style_sheet.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/gui/debug/AspectRatioWidget.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/gui/debug/DebugTab.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/gui/debug/FrameWidget.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/gui/debug/InfoWidget.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/gui/debug/LoggerWidget.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/gui/debug/__init__.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/gui/i18n/__init__.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/gui/i18n/path.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/gui/i18n/update.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/gui/icon/__init__.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/gui/icon/icon.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/gui/overlay/OverlayWindow.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/gui/overlay/__init__.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/gui/qss/__init__.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/gui/settings/SettingTab.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/gui/settings/__init__.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/gui/start/SelectCaptureListView.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/gui/start/SelectHwndWindow.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/gui/start/StartTab.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/gui/start/__init__.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/gui/tasks/ConfigItemFactory.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/gui/tasks/ConfigLabelAndWidget.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/gui/tasks/LabelAndDoubleSpinBox.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/gui/tasks/LabelAndDropDown.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/gui/tasks/LabelAndLineEdit.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/gui/tasks/LabelAndList.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/gui/tasks/LabelAndSpinBox.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/gui/tasks/LabelAndSwitchButton.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/gui/tasks/LabelAndWidget.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/gui/tasks/ModifyListDialog.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/gui/tasks/ModifyListItem.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/gui/tasks/OneTimeTaskTab.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/gui/tasks/StartButton.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/gui/tasks/TaskCard.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/gui/tasks/TaskOpButton.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/gui/tasks/TooltipTableWidget.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/gui/tasks/TriggerTaskTab.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/gui/tasks/__init__.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/gui/util/Alert.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/gui/util/InitWorker.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/gui/util/__init__.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/gui/widget/Card.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/gui/widget/FramelessDialog.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/gui/widget/ListTableWidgetItem.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/gui/widget/NumericTableWidgetItem.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/gui/widget/StatusBar.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/gui/widget/Tab.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/gui/widget/TabWidget.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/gui/widget/UpdateConfigWidgetItem.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/gui/widget/YesNonWidgetItem.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/gui/widget/__init__.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/interaction/ADBInteraction.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/interaction/BaseInteraction.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/interaction/Win32Interaction.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/interaction/__init__.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/logging/Logger.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/logging/__init__.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/ocr/OCR.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/ocr/__init__.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/rotypes/Windows/Foundation/Collections.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/rotypes/Windows/Foundation/__init__.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/rotypes/Windows/Globalization/__init__.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/rotypes/Windows/Graphics/Capture/__init__.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/rotypes/Windows/Graphics/DirectX/Direct3D11/__init__.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/rotypes/Windows/Graphics/DirectX/__init__.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/rotypes/Windows/Graphics/Imaging/__init__.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/rotypes/Windows/Graphics/__init__.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/rotypes/Windows/Media/Ocr/__init__.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/rotypes/Windows/Media/__init__.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/rotypes/Windows/Security/Cryptography/__init__.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/rotypes/Windows/Security/__init__.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/rotypes/Windows/Storage/Streams/__init__.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/rotypes/Windows/Storage/__init__.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/rotypes/Windows/__init__.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/rotypes/__init__.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/rotypes/delegate.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/rotypes/export.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/rotypes/idldsl.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/rotypes/inspectable.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/rotypes/roapi.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/rotypes/types.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/rotypes/winstring.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/save/BlackBarProcessor.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/save/PostProcessor.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/save/SaveByInterval.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/save/SaveByKeyPress.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/save/SaveMethodBase.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/save/__init__.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/scene/FeatureScene.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/scene/Scene.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/scene/__init__.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/stats/StreamStats.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/stats/__init__.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/task/BaseTask.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/task/ExecutorOperation.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/task/OneTimeTask.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/task/TaskExecutor.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/task/TriggerTask.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/task/__init__.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/util/__init__.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/util/exit_event.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/util/json.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/util/list.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/util/path.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/util/thread.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/util/win32_process.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok/util/yaml.py +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok_script.egg-info/SOURCES.txt +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok_script.egg-info/dependency_links.txt +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok_script.egg-info/requires.txt +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/ok_script.egg-info/top_level.txt +0 -0
- {ok-script-0.0.48 → ok-script-0.0.49}/setup.cfg +0 -0
|
@@ -28,6 +28,8 @@ class OK:
|
|
|
28
28
|
|
|
29
29
|
def __init__(self, config: Dict[str, Any]):
|
|
30
30
|
print(f"AutoHelper init, config: {config}")
|
|
31
|
+
config_logger(config)
|
|
32
|
+
logger.info(f"AutoHelper init, config: {config}")
|
|
31
33
|
ok.gui.ok = self
|
|
32
34
|
self.debug = config.get("debug", False)
|
|
33
35
|
try:
|
|
@@ -44,6 +46,7 @@ class OK:
|
|
|
44
46
|
self.device_manager.start()
|
|
45
47
|
self.do_init()
|
|
46
48
|
except Exception as e:
|
|
49
|
+
logger.error(f'__init__ error', e)
|
|
47
50
|
self.quit()
|
|
48
51
|
raise e
|
|
49
52
|
|
|
@@ -94,8 +97,6 @@ class OK:
|
|
|
94
97
|
inference_num_threads = self.config.get('ocr').get('inference_num_threads', -1)
|
|
95
98
|
self.ocr = RapidOCR(inference_num_threads=inference_num_threads)
|
|
96
99
|
|
|
97
|
-
config_logger(self.config)
|
|
98
|
-
|
|
99
100
|
if self.config.get('coco_feature_folder') is not None:
|
|
100
101
|
coco_feature_folder = self.config.get('coco_feature_folder')
|
|
101
102
|
from ok.feature.FeatureSet import FeatureSet
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
from ok.gui.Communicate import communicate
|
|
2
|
+
from ok.logging.Logger import get_logger
|
|
3
|
+
from ok.util.json import read_json_file, write_json_file
|
|
4
|
+
from ok.util.path import get_path_relative_to_exe
|
|
5
|
+
|
|
6
|
+
logger = get_logger(__name__)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class Config(dict):
|
|
10
|
+
def __init__(self, default, folder, name, validator=None):
|
|
11
|
+
"""
|
|
12
|
+
Initialize the Config object.
|
|
13
|
+
|
|
14
|
+
:param default: Default configuration values.
|
|
15
|
+
:param folder: Folder where the config file is stored.
|
|
16
|
+
:param name: Name of the config file.
|
|
17
|
+
:param validator: Optional function to validate key-value pairs.
|
|
18
|
+
"""
|
|
19
|
+
self.default = default
|
|
20
|
+
self.validator = validator
|
|
21
|
+
self.config_file = get_path_relative_to_exe(folder, f"{name}.json")
|
|
22
|
+
|
|
23
|
+
# Read the config file, if it exists, otherwise use default
|
|
24
|
+
config = read_json_file(self.config_file)
|
|
25
|
+
if config is None:
|
|
26
|
+
self.reset_to_default()
|
|
27
|
+
else:
|
|
28
|
+
super().__init__(config)
|
|
29
|
+
modified = self.verify_config(default)
|
|
30
|
+
if modified:
|
|
31
|
+
self.save_file()
|
|
32
|
+
logger.debug(f'init self.config = {self}')
|
|
33
|
+
|
|
34
|
+
def save_file(self):
|
|
35
|
+
"""
|
|
36
|
+
Save the current configuration to the file.
|
|
37
|
+
"""
|
|
38
|
+
try:
|
|
39
|
+
write_json_file(self.config_file, self)
|
|
40
|
+
except Exception as e:
|
|
41
|
+
logger.error(f'save_file error: {e}')
|
|
42
|
+
|
|
43
|
+
def reset_to_default(self):
|
|
44
|
+
"""
|
|
45
|
+
Reset the configuration to the default values.
|
|
46
|
+
"""
|
|
47
|
+
super().clear()
|
|
48
|
+
self.update(self.default)
|
|
49
|
+
self.save_file()
|
|
50
|
+
logger.debug(f'reset_to_default self.config = {self}')
|
|
51
|
+
|
|
52
|
+
def pop(self, key, default=None):
|
|
53
|
+
"""
|
|
54
|
+
Remove and return a value from the configuration.
|
|
55
|
+
|
|
56
|
+
:param key: The key to remove.
|
|
57
|
+
:param default: The default value if the key does not exist.
|
|
58
|
+
:return: The removed value.
|
|
59
|
+
"""
|
|
60
|
+
result = super().pop(key, default)
|
|
61
|
+
self.save_file()
|
|
62
|
+
return result
|
|
63
|
+
|
|
64
|
+
def popitem(self):
|
|
65
|
+
"""
|
|
66
|
+
Remove and return the last key-value pair from the configuration.
|
|
67
|
+
"""
|
|
68
|
+
result = super().popitem()
|
|
69
|
+
self.save_file()
|
|
70
|
+
return result
|
|
71
|
+
|
|
72
|
+
def clear(self):
|
|
73
|
+
"""
|
|
74
|
+
Clear all configuration values.
|
|
75
|
+
"""
|
|
76
|
+
super().clear()
|
|
77
|
+
self.save_file()
|
|
78
|
+
|
|
79
|
+
def __setitem__(self, key, value):
|
|
80
|
+
if self.validate(key, value):
|
|
81
|
+
super().__setitem__(key, value)
|
|
82
|
+
self.save_file()
|
|
83
|
+
|
|
84
|
+
def __getitem__(self, key):
|
|
85
|
+
try:
|
|
86
|
+
return super().__getitem__(key)
|
|
87
|
+
except KeyError as e:
|
|
88
|
+
logger.error(f'KeyError: {key} not found in config: {self}')
|
|
89
|
+
raise e
|
|
90
|
+
|
|
91
|
+
def validate(self, key, value):
|
|
92
|
+
"""
|
|
93
|
+
Validate a configuration key-value pair.
|
|
94
|
+
|
|
95
|
+
:param key: The key to validate.
|
|
96
|
+
:param value: The value to validate.
|
|
97
|
+
:return: True if valid, False otherwise.
|
|
98
|
+
"""
|
|
99
|
+
if self.validator is not None:
|
|
100
|
+
valid, message = self.validator(key, value)
|
|
101
|
+
if not valid:
|
|
102
|
+
communicate.config_validation.emit(message)
|
|
103
|
+
return False
|
|
104
|
+
return True
|
|
105
|
+
|
|
106
|
+
def verify_config(self, default_config):
|
|
107
|
+
"""
|
|
108
|
+
Verify the configuration against the default configuration.
|
|
109
|
+
|
|
110
|
+
:param default_config: The default configuration.
|
|
111
|
+
:return: True if the config was modified, False otherwise.
|
|
112
|
+
"""
|
|
113
|
+
modified = False
|
|
114
|
+
|
|
115
|
+
# Remove entries that do not exist in default_config
|
|
116
|
+
for key in list(self.keys()):
|
|
117
|
+
if key not in default_config:
|
|
118
|
+
del self[key]
|
|
119
|
+
modified = True
|
|
120
|
+
|
|
121
|
+
# Check entries in default_config
|
|
122
|
+
for key, default_value in default_config.items():
|
|
123
|
+
if key not in self or not isinstance(self[key], type(default_value)):
|
|
124
|
+
self[key] = default_value
|
|
125
|
+
modified = True
|
|
126
|
+
elif self.validator is not None:
|
|
127
|
+
valid = self.validate(key, self[key])
|
|
128
|
+
if not valid:
|
|
129
|
+
self[key] = default_value
|
|
130
|
+
modified = True
|
|
131
|
+
|
|
132
|
+
return modified
|
|
@@ -36,7 +36,6 @@ class Screenshot(QObject):
|
|
|
36
36
|
self.click_screenshot_folder = get_path_relative_to_exe(ok.gui.ok.config.get("click_screenshots_folder"))
|
|
37
37
|
self.screenshot_folder = get_path_relative_to_exe(ok.gui.ok.config.get("screenshots_folder"))
|
|
38
38
|
logger.debug(f"init Screenshot {self.screenshot_folder} {self.click_screenshot_folder}")
|
|
39
|
-
print(f"init Screenshot {self.screenshot_folder} {self.screenshot_folder}")
|
|
40
39
|
if self.click_screenshot_folder is not None or self.screenshot_folder is not None:
|
|
41
40
|
self.task_queue = queue.Queue()
|
|
42
41
|
self.exit_event.bind_queue(self.task_queue)
|
|
@@ -334,7 +334,7 @@ StartCard\x01\x03\x00\x00\x00\x08N\
|
|
|
334
334
|
*\x89\xe6S\xd1Vh\x08\x00\x00\x00\x00\x06\x00\x00\x00\
|
|
335
335
|
\x0dTrigger Tasks\x07\x00\
|
|
336
336
|
\x00\x00\x09StartCard\x01\x03\x00\x00\
|
|
337
|
-
\x00\
|
|
337
|
+
\x00\x10p\xb9Q\xfb\x90\x09b\xe9N\xfbR\xa1_\x00\
|
|
338
338
|
Y\xcb\x08\x00\x00\x00\x00\x06\x00\x00\x00\x1eWait\
|
|
339
339
|
ing for task to \
|
|
340
340
|
be enabled\x07\x00\x00\x00\x09S\
|
|
@@ -1160,7 +1160,7 @@ qt_resource_struct = b"\
|
|
|
1160
1160
|
\x00\x00\x00>\x00\x01\x00\x00\x00\x01\x00\x00\x1a\x85\
|
|
1161
1161
|
\x00\x00\x01\x8e2\xed>\xd3\
|
|
1162
1162
|
\x00\x00\x00(\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\
|
|
1163
|
-
\x00\x00\x01\x8f\
|
|
1163
|
+
\x00\x00\x01\x8f\xcf\xc5~\xab\
|
|
1164
1164
|
\x00\x00\x00T\x00\x02\x00\x00\x00\x05\x00\x00\x00\x0d\
|
|
1165
1165
|
\x00\x00\x00\x00\x00\x00\x00\x00\
|
|
1166
1166
|
\x00\x00\x00b\x00\x02\x00\x00\x00\x05\x00\x00\x00\x08\
|
|
@@ -143,16 +143,21 @@ class StartCard(SettingCard):
|
|
|
143
143
|
if not ok.gui.executor.connected():
|
|
144
144
|
self.status_bar.setTitle(self.tr("Game Window Disconnected"))
|
|
145
145
|
self.status_bar.setState(True)
|
|
146
|
-
elif not ok.gui.executor.can_capture():
|
|
147
|
-
self.status_bar.setTitle(self.tr('Paused: PC Game Window Must Be in Front!'))
|
|
148
|
-
self.status_bar.setState(True)
|
|
149
146
|
elif active_trigger_task_count := ok.gui.executor.active_trigger_task_count():
|
|
150
|
-
|
|
151
|
-
self.tr(
|
|
152
|
-
|
|
147
|
+
if not ok.gui.executor.can_capture():
|
|
148
|
+
self.status_bar.setTitle(self.tr('Paused: PC Game Window Must Be in Front!'))
|
|
149
|
+
self.status_bar.setState(True)
|
|
150
|
+
else:
|
|
151
|
+
self.status_bar.setTitle(
|
|
152
|
+
self.tr("Running") + ": " + str(active_trigger_task_count) + ' ' + self.tr("Trigger Tasks"))
|
|
153
|
+
self.status_bar.setState(False)
|
|
153
154
|
elif task := ok.gui.executor.current_task:
|
|
154
|
-
|
|
155
|
-
|
|
155
|
+
if not ok.gui.executor.can_capture():
|
|
156
|
+
self.status_bar.setTitle(self.tr('Paused: PC Game Window Must Be in Front!'))
|
|
157
|
+
self.status_bar.setState(True)
|
|
158
|
+
else:
|
|
159
|
+
self.status_bar.setTitle(self.tr("Running") + ": " + task.name)
|
|
160
|
+
self.status_bar.setState(False)
|
|
156
161
|
else:
|
|
157
162
|
self.status_bar.setTitle(self.tr("Waiting for task to be enabled"))
|
|
158
163
|
self.status_bar.setState(False)
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
from ok.gui.Communicate import communicate
|
|
2
|
-
from ok.util.json import read_json_file, write_json_file
|
|
3
|
-
from ok.util.path import get_path_relative_to_exe
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
class Config:
|
|
7
|
-
def __init__(self, default, folder, name, validator=None):
|
|
8
|
-
super().__init__()
|
|
9
|
-
self.default = default
|
|
10
|
-
self.validator = validator
|
|
11
|
-
self.config_file = get_path_relative_to_exe(folder, f"{name}.json")
|
|
12
|
-
self.config = read_json_file(self.config_file)
|
|
13
|
-
if self.config is None:
|
|
14
|
-
self.config = default
|
|
15
|
-
elif self.verify_config(self.config, default):
|
|
16
|
-
self.save_file()
|
|
17
|
-
|
|
18
|
-
def save_file(self):
|
|
19
|
-
write_json_file(self.config_file, self.config)
|
|
20
|
-
|
|
21
|
-
def reset_to_default(self):
|
|
22
|
-
self.config.clear()
|
|
23
|
-
self.update(self.default)
|
|
24
|
-
self.save_file()
|
|
25
|
-
|
|
26
|
-
def update(self, *args, **kwargs):
|
|
27
|
-
self.config.update(*args, **kwargs)
|
|
28
|
-
self.save_file()
|
|
29
|
-
|
|
30
|
-
def get(self, key, default=None):
|
|
31
|
-
return self.config.get(key, default)
|
|
32
|
-
|
|
33
|
-
def keys(self):
|
|
34
|
-
return self.config.keys()
|
|
35
|
-
|
|
36
|
-
def values(self):
|
|
37
|
-
return self.config.values()
|
|
38
|
-
|
|
39
|
-
def items(self):
|
|
40
|
-
return self.config.items()
|
|
41
|
-
|
|
42
|
-
def pop(self, key, default=None):
|
|
43
|
-
result = self.config.pop(key, default)
|
|
44
|
-
self.save_file()
|
|
45
|
-
return result
|
|
46
|
-
|
|
47
|
-
def popitem(self):
|
|
48
|
-
result = self.config.popitem()
|
|
49
|
-
self.save_file()
|
|
50
|
-
return result
|
|
51
|
-
|
|
52
|
-
def setdefault(self, key, default=None):
|
|
53
|
-
result = self.config.setdefault(key, default)
|
|
54
|
-
self.save_file()
|
|
55
|
-
return result
|
|
56
|
-
|
|
57
|
-
def clear(self):
|
|
58
|
-
self.config.clear()
|
|
59
|
-
self.save_file()
|
|
60
|
-
|
|
61
|
-
def __len__(self):
|
|
62
|
-
return len(self.config)
|
|
63
|
-
|
|
64
|
-
def __setitem__(self, key, value):
|
|
65
|
-
if self.validate(key, value):
|
|
66
|
-
self.config[key] = value
|
|
67
|
-
self.save_file()
|
|
68
|
-
|
|
69
|
-
def __getitem__(self, key):
|
|
70
|
-
return self.config[key]
|
|
71
|
-
|
|
72
|
-
def validate(self, key, value):
|
|
73
|
-
if self.validator is not None:
|
|
74
|
-
valid, message = self.validator(key, value)
|
|
75
|
-
if not valid:
|
|
76
|
-
communicate.config_validation.emit(message)
|
|
77
|
-
return False
|
|
78
|
-
return True
|
|
79
|
-
|
|
80
|
-
def verify_config(self, config, default_config):
|
|
81
|
-
modified = False
|
|
82
|
-
|
|
83
|
-
# Remove entries that do not exist in default_config
|
|
84
|
-
for key in list(config.keys()):
|
|
85
|
-
if key not in default_config:
|
|
86
|
-
del config[key]
|
|
87
|
-
modified = True
|
|
88
|
-
|
|
89
|
-
# Check entries in default_config
|
|
90
|
-
for key, default_value in default_config.items():
|
|
91
|
-
if key not in config or (default_value is not None and type(config[key]) != type(default_value)):
|
|
92
|
-
config[key] = default_value
|
|
93
|
-
modified = True
|
|
94
|
-
elif self.validator is not None:
|
|
95
|
-
valid = self.validate(key, self.config[key])
|
|
96
|
-
if not valid:
|
|
97
|
-
config[key] = default_value
|
|
98
|
-
modified = True
|
|
99
|
-
|
|
100
|
-
return not modified
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
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.48 → ok-script-0.0.49}/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
|