ok-script 0.0.33__tar.gz → 0.0.35__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.33 → ok-script-0.0.35}/PKG-INFO +1 -1
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/capture/BaseCaptureMethod.py +8 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/capture/adb/ADBCaptureMethod.py +1 -1
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/capture/windows/WindowsGraphicsCaptureMethod.py +1 -1
- ok-script-0.0.35/ok/capture/windows/dump.py +27 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/gui/App.py +2 -33
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/gui/Communicate.py +2 -1
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/gui/MainWindow.py +42 -1
- ok-script-0.0.35/ok/gui/about/AboutTab.py +24 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/gui/tasks/OneTimeTaskTab.py +1 -2
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/gui/tasks/StartButton.py +2 -1
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/logging/Logger.py +11 -1
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/task/BaseTask.py +2 -2
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/task/TaskExecutor.py +6 -1
- {ok-script-0.0.33 → ok-script-0.0.35}/ok_script.egg-info/PKG-INFO +1 -1
- {ok-script-0.0.33 → ok-script-0.0.35}/ok_script.egg-info/SOURCES.txt +1 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/setup.py +1 -1
- ok-script-0.0.33/ok/gui/about/AboutTab.py +0 -15
- {ok-script-0.0.33 → ok-script-0.0.35}/README.md +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/OK.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/__init__.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/capture/HwndWindow.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/capture/__init__.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/capture/adb/DeviceManager.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/capture/adb/__init__.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/capture/adb/bin/__init__.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/capture/adb/targets.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/capture/adb/vbox.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/capture/windows/__init__.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/capture/windows/d3d11.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/capture/windows/utils.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/capture/windows/window.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/color/Color.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/color/__init__.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/config/Config.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/config/InfoDict.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/config/__init__.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/feature/Box.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/feature/Feature.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/feature/FeatureSet.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/feature/FindFeature.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/feature/__init__.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/gui/TabTitles.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/gui/__init__.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/gui/about/__init__.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/gui/common/OKIcon.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/gui/common/__init__.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/gui/common/config.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/gui/common/style_sheet.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/gui/debug/AspectRatioWidget.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/gui/debug/DebugTab.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/gui/debug/FrameWidget.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/gui/debug/InfoWidget.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/gui/debug/LoggerWidget.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/gui/debug/Screenshot.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/gui/debug/__init__.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/gui/i18n/__init__.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/gui/i18n/path.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/gui/i18n/update.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/gui/icon/__init__.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/gui/icon/icon.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/gui/overlay/OverlayWindow.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/gui/overlay/__init__.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/gui/qss/__init__.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/gui/resources.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/gui/settings/SettingTab.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/gui/settings/__init__.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/gui/start/SelectCaptureListView.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/gui/start/SelectHwndWindow.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/gui/start/StartCard.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/gui/start/StartTab.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/gui/start/__init__.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/gui/tasks/ConfigItemFactory.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/gui/tasks/ConfigLabelAndWidget.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/gui/tasks/LabelAndDoubleSpinBox.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/gui/tasks/LabelAndDropDown.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/gui/tasks/LabelAndLineEdit.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/gui/tasks/LabelAndList.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/gui/tasks/LabelAndSpinBox.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/gui/tasks/LabelAndSwitchButton.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/gui/tasks/LabelAndWidget.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/gui/tasks/ModifyListDialog.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/gui/tasks/ModifyListItem.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/gui/tasks/TaskCard.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/gui/tasks/TaskOpButton.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/gui/tasks/TooltipTableWidget.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/gui/tasks/TriggerTaskTab.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/gui/tasks/__init__.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/gui/util/Alert.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/gui/util/InitWorker.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/gui/util/__init__.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/gui/widget/Card.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/gui/widget/FramelessDialog.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/gui/widget/ListTableWidgetItem.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/gui/widget/NumericTableWidgetItem.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/gui/widget/StatusBar.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/gui/widget/Tab.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/gui/widget/TabWidget.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/gui/widget/UpdateConfigWidgetItem.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/gui/widget/YesNonWidgetItem.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/gui/widget/__init__.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/interaction/ADBInteraction.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/interaction/BaseInteraction.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/interaction/Win32Interaction.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/interaction/__init__.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/logging/__init__.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/ocr/OCR.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/ocr/__init__.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/predict/__init__.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/predict/predict.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/rotypes/Windows/Foundation/Collections.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/rotypes/Windows/Foundation/__init__.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/rotypes/Windows/Globalization/__init__.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/rotypes/Windows/Graphics/Capture/__init__.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/rotypes/Windows/Graphics/DirectX/Direct3D11/__init__.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/rotypes/Windows/Graphics/DirectX/__init__.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/rotypes/Windows/Graphics/Imaging/__init__.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/rotypes/Windows/Graphics/__init__.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/rotypes/Windows/Media/Ocr/__init__.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/rotypes/Windows/Media/__init__.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/rotypes/Windows/Security/Cryptography/__init__.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/rotypes/Windows/Security/__init__.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/rotypes/Windows/Storage/Streams/__init__.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/rotypes/Windows/Storage/__init__.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/rotypes/Windows/__init__.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/rotypes/__init__.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/rotypes/delegate.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/rotypes/export.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/rotypes/idldsl.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/rotypes/inspectable.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/rotypes/roapi.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/rotypes/types.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/rotypes/winstring.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/save/BlackBarProcessor.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/save/PostProcessor.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/save/SaveByInterval.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/save/SaveByKeyPress.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/save/SaveMethodBase.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/save/__init__.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/scene/FeatureScene.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/scene/Scene.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/scene/__init__.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/stats/StreamStats.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/stats/__init__.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/task/ExecutorOperation.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/task/OneTimeTask.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/task/TriggerTask.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/task/__init__.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/util/__init__.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/util/exit_event.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/util/json.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/util/list.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/util/path.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/util/thread.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/util/win32_process.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok/util/yaml.py +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok_script.egg-info/dependency_links.txt +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok_script.egg-info/requires.txt +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/ok_script.egg-info/top_level.txt +0 -0
- {ok-script-0.0.33 → ok-script-0.0.35}/setup.cfg +0 -0
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import numpy as np
|
|
2
2
|
|
|
3
|
+
class CaptureException(Exception):
|
|
4
|
+
pass
|
|
3
5
|
|
|
4
6
|
class BaseCaptureMethod:
|
|
5
7
|
name = "None"
|
|
@@ -21,6 +23,12 @@ class BaseCaptureMethod:
|
|
|
21
23
|
pass
|
|
22
24
|
|
|
23
25
|
def get_frame(self) -> np.ndarray | None:
|
|
26
|
+
try:
|
|
27
|
+
return self.do_get_frame()
|
|
28
|
+
except Exception as e:
|
|
29
|
+
raise CaptureException() from e
|
|
30
|
+
|
|
31
|
+
def do_get_frame(self):
|
|
24
32
|
pass
|
|
25
33
|
|
|
26
34
|
def draw_rectangle(self):
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import sys
|
|
2
|
+
import traceback
|
|
3
|
+
import threading
|
|
4
|
+
|
|
5
|
+
from ok.util.path import get_path_relative_to_exe
|
|
6
|
+
|
|
7
|
+
def get_thread_name(thread_id):
|
|
8
|
+
for thread in threading.enumerate():
|
|
9
|
+
if thread.ident == thread_id:
|
|
10
|
+
return thread.name
|
|
11
|
+
return "" # Return empty string if the thread name is not found
|
|
12
|
+
|
|
13
|
+
def dump_threads():
|
|
14
|
+
# Get the stack trace for each thread
|
|
15
|
+
thread_dumps = []
|
|
16
|
+
for thread_id, frame in sys._current_frames().items():
|
|
17
|
+
thread_name = get_thread_name(thread_id)
|
|
18
|
+
thread_dump = f"Stack for thread {thread_id} (Name: {thread_name}):\n"
|
|
19
|
+
thread_dump += "".join(traceback.format_stack(frame))
|
|
20
|
+
thread_dumps.append(thread_dump)
|
|
21
|
+
|
|
22
|
+
# Write the thread dumps to a file
|
|
23
|
+
output_file = get_path_relative_to_exe("thread_dumps.txt")
|
|
24
|
+
print(f'Dumping threads to {output_file}')
|
|
25
|
+
|
|
26
|
+
with open(output_file, "w") as file:
|
|
27
|
+
file.write("\n\n".join(thread_dumps))
|
|
@@ -3,16 +3,14 @@ import sys
|
|
|
3
3
|
|
|
4
4
|
from PySide6.QtCore import QSize, QCoreApplication, QLocale, QTranslator, Qt
|
|
5
5
|
from PySide6.QtGui import QIcon
|
|
6
|
-
from PySide6.QtWidgets import QApplication
|
|
6
|
+
from PySide6.QtWidgets import QApplication
|
|
7
7
|
from qfluentwidgets import FluentTranslator, qconfig, Theme
|
|
8
8
|
|
|
9
9
|
import ok
|
|
10
10
|
import ok.gui.resources
|
|
11
|
-
from ok.gui.Communicate import communicate
|
|
12
11
|
from ok.gui.MainWindow import MainWindow
|
|
13
12
|
from ok.gui.i18n.path import i18n_path
|
|
14
13
|
from ok.gui.overlay.OverlayWindow import OverlayWindow
|
|
15
|
-
from ok.gui.start.StartTab import StartTab
|
|
16
14
|
from ok.logging.Logger import get_logger
|
|
17
15
|
|
|
18
16
|
logger = get_logger(__name__)
|
|
@@ -45,7 +43,6 @@ class App:
|
|
|
45
43
|
self.main_window = None
|
|
46
44
|
self.exit_event = exit_event
|
|
47
45
|
self.icon = QIcon(self.config.get('gui_icon') or ":/icon/icon.ico")
|
|
48
|
-
self.tray = QSystemTrayIcon(self.icon)
|
|
49
46
|
|
|
50
47
|
translator = QTranslator(self.app)
|
|
51
48
|
full_path = os.path.join(i18n_path, f"{self.locale.name()}")
|
|
@@ -57,30 +54,6 @@ class App:
|
|
|
57
54
|
else:
|
|
58
55
|
logger.debug(f"No translation available for {self.locale}, falling back to English/default. {full_path}")
|
|
59
56
|
|
|
60
|
-
# Create a context menu for the tray
|
|
61
|
-
menu = QMenu()
|
|
62
|
-
exit_action = menu.addAction(self.app.tr("Exit"))
|
|
63
|
-
exit_action.triggered.connect(self.quit)
|
|
64
|
-
|
|
65
|
-
# Set the context menu and show the tray icon
|
|
66
|
-
self.tray.setContextMenu(menu)
|
|
67
|
-
self.tray.show()
|
|
68
|
-
|
|
69
|
-
communicate.notification.connect(self.show_notification)
|
|
70
|
-
|
|
71
|
-
def show_notification(self, title, message):
|
|
72
|
-
if title is None:
|
|
73
|
-
title = self.title
|
|
74
|
-
self.tray.showMessage(title, message)
|
|
75
|
-
|
|
76
|
-
def show(self):
|
|
77
|
-
self.loading_window = StartTab(self, self.exit_event)
|
|
78
|
-
size = self.size_relative_to_screen(width=0.6, height=0.4)
|
|
79
|
-
self.loading_window.resize(size)
|
|
80
|
-
self.loading_window.setMinimumSize(size)
|
|
81
|
-
self.center_window(self.loading_window)
|
|
82
|
-
self.loading_window.show()
|
|
83
|
-
|
|
84
57
|
def center_window(self, window):
|
|
85
58
|
screen = self.app.primaryScreen()
|
|
86
59
|
size = screen.size()
|
|
@@ -91,7 +64,7 @@ class App:
|
|
|
91
64
|
window.move(half_screen_width / 2, half_screen_height / 2)
|
|
92
65
|
|
|
93
66
|
def show_main_window(self):
|
|
94
|
-
self.main_window = MainWindow(self.overlay, self.about, exit_event=self.exit_event)
|
|
67
|
+
self.main_window = MainWindow(self.icon, self.overlay, self.about, exit_event=self.exit_event)
|
|
95
68
|
self.main_window.setWindowTitle(f'{self.title} {self.version}') # Set the window title here
|
|
96
69
|
self.main_window.setWindowIcon(self.icon)
|
|
97
70
|
if self.overlay and ok.gui.device_manager.hwnd is not None:
|
|
@@ -119,7 +92,3 @@ class App:
|
|
|
119
92
|
|
|
120
93
|
def exec(self):
|
|
121
94
|
sys.exit(self.app.exec())
|
|
122
|
-
|
|
123
|
-
def quit(self):
|
|
124
|
-
ok.gui.ok.quit()
|
|
125
|
-
self.app.quit()
|
|
@@ -12,12 +12,13 @@ class Communicate(QObject):
|
|
|
12
12
|
task_info = Signal()
|
|
13
13
|
window = Signal(bool, int, int, int, int, int, int, float)
|
|
14
14
|
loading_progress = Signal(str)
|
|
15
|
-
notification = Signal(str, str)
|
|
15
|
+
notification = Signal(str, str, bool)
|
|
16
16
|
executor_paused: Signal = Signal(bool)
|
|
17
17
|
screenshot = Signal(np.ndarray, str)
|
|
18
18
|
update_overlay = Signal()
|
|
19
19
|
adb_devices: Signal = Signal(bool)
|
|
20
20
|
tab = Signal(str)
|
|
21
|
+
capture_error = Signal()
|
|
21
22
|
|
|
22
23
|
def emit_draw_box(self, key: str = None, boxes=None, color=None, frame=None):
|
|
23
24
|
self.draw_box.emit(key, boxes, color, frame)
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
from PySide6.QtCore import QObject, Signal, Qt
|
|
2
|
+
from PySide6.QtGui import QKeySequence, QShortcut
|
|
3
|
+
from PySide6.QtWidgets import QMenu, QSystemTrayIcon
|
|
2
4
|
from qfluentwidgets import FluentIcon, NavigationItemPosition, MSFluentWindow, InfoBar, InfoBarPosition, MessageBox
|
|
3
5
|
|
|
4
6
|
import ok.gui
|
|
7
|
+
from ok.capture.windows.dump import dump_threads
|
|
5
8
|
from ok.gui.Communicate import communicate
|
|
6
9
|
from ok.gui.about.AboutTab import AboutTab
|
|
7
10
|
from ok.gui.start.StartTab import StartTab
|
|
@@ -17,7 +20,7 @@ class Communicate(QObject):
|
|
|
17
20
|
|
|
18
21
|
|
|
19
22
|
class MainWindow(MSFluentWindow):
|
|
20
|
-
def __init__(self, debug=False, about=None, exit_event=None):
|
|
23
|
+
def __init__(self, icon, debug=False, about=None, exit_event=None):
|
|
21
24
|
super().__init__()
|
|
22
25
|
self.exit_event = exit_event
|
|
23
26
|
self.start_tab = StartTab()
|
|
@@ -48,6 +51,44 @@ class MainWindow(MSFluentWindow):
|
|
|
48
51
|
communicate.executor_paused.connect(self.executor_paused)
|
|
49
52
|
communicate.tab.connect(self.navigate_tab)
|
|
50
53
|
|
|
54
|
+
self.shortcut = QShortcut(QKeySequence("Ctrl+Alt+D"), self)
|
|
55
|
+
self.shortcut.activated.connect(dump_threads)
|
|
56
|
+
|
|
57
|
+
# Create a context menu for the tray
|
|
58
|
+
menu = QMenu()
|
|
59
|
+
exit_action = menu.addAction(self.tr("Exit"))
|
|
60
|
+
exit_action.triggered.connect(ok.gui.ok.quit)
|
|
61
|
+
|
|
62
|
+
self.tray = QSystemTrayIcon(icon)
|
|
63
|
+
|
|
64
|
+
# Set the context menu and show the tray icon
|
|
65
|
+
self.tray.setContextMenu(menu)
|
|
66
|
+
self.tray.show()
|
|
67
|
+
|
|
68
|
+
communicate.capture_error.connect(self.capture_error)
|
|
69
|
+
communicate.notification.connect(self.show_notification)
|
|
70
|
+
|
|
71
|
+
def show_notification(self, message, title=None, error=None):
|
|
72
|
+
bar = InfoBar.error if error else InfoBar.info
|
|
73
|
+
if title is None:
|
|
74
|
+
title = f"{self.tr('Error') if error else 'Info'}:"
|
|
75
|
+
bar(
|
|
76
|
+
title=title,
|
|
77
|
+
content=message,
|
|
78
|
+
orient=Qt.Horizontal,
|
|
79
|
+
isClosable=True,
|
|
80
|
+
position=InfoBarPosition.TOP,
|
|
81
|
+
duration=5000, # won't disappear automatically
|
|
82
|
+
parent=self.window()
|
|
83
|
+
)
|
|
84
|
+
if title is None:
|
|
85
|
+
title = self.title
|
|
86
|
+
self.tray.showMessage(title, message)
|
|
87
|
+
|
|
88
|
+
def capture_error(self):
|
|
89
|
+
self.show_notification(self.tr('Please check whether the game window is selected correctly!'),
|
|
90
|
+
self.tr('Capture Error'), error=True)
|
|
91
|
+
|
|
51
92
|
def navigate_tab(self, index):
|
|
52
93
|
if index == "start":
|
|
53
94
|
self.switchTo(self.start_tab)
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
from PySide6.QtWidgets import QTextEdit
|
|
2
|
+
from qfluentwidgets import TextEdit, PushButton
|
|
3
|
+
|
|
4
|
+
import ok.gui
|
|
5
|
+
from ok.capture.windows.dump import dump_threads
|
|
6
|
+
from ok.gui.widget.Tab import Tab
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class AboutTab(Tab):
|
|
10
|
+
def __init__(self, text=""):
|
|
11
|
+
super().__init__()
|
|
12
|
+
# Create a QTextEdit instance
|
|
13
|
+
text_edit = TextEdit()
|
|
14
|
+
text_edit.setHtml(text)
|
|
15
|
+
text_edit.setReadOnly(True)
|
|
16
|
+
|
|
17
|
+
# Set the layout on the widget
|
|
18
|
+
self.addWidget(text_edit)
|
|
19
|
+
if ok.gui.ok.debug:
|
|
20
|
+
dump_button = PushButton(self.tr("Dump Threads(HotKey:Ctrl+Alt+D)"))
|
|
21
|
+
dump_button.clicked.connect(dump_threads)
|
|
22
|
+
self.addWidget(dump_button)
|
|
23
|
+
|
|
24
|
+
|
|
@@ -35,8 +35,7 @@ class OneTimeTaskTab(Tab):
|
|
|
35
35
|
communicate.task_info.connect(self.update_info_table)
|
|
36
36
|
|
|
37
37
|
def task_update(self, task):
|
|
38
|
-
|
|
39
|
-
self.update_info_table()
|
|
38
|
+
self.update_info_table()
|
|
40
39
|
|
|
41
40
|
def update_info_table(self):
|
|
42
41
|
task = ok.gui.executor.current_task
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
from PySide6.QtCore import Slot, QPropertyAnimation
|
|
2
2
|
from PySide6.QtGui import QColor
|
|
3
3
|
from PySide6.QtWidgets import QPushButton
|
|
4
|
+
from qfluentwidgets import PushButton
|
|
4
5
|
|
|
5
6
|
import ok
|
|
6
7
|
from ok.gui.Communicate import communicate
|
|
@@ -10,7 +11,7 @@ from ok.logging.Logger import get_logger
|
|
|
10
11
|
logger = get_logger(__name__)
|
|
11
12
|
|
|
12
13
|
|
|
13
|
-
class StartButton(
|
|
14
|
+
class StartButton(PushButton):
|
|
14
15
|
def __init__(self):
|
|
15
16
|
super().__init__("Start")
|
|
16
17
|
self.setCheckable(True)
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import logging
|
|
2
2
|
import os
|
|
3
|
+
import sys
|
|
3
4
|
import traceback
|
|
4
|
-
import ok
|
|
5
5
|
from logging.handlers import TimedRotatingFileHandler
|
|
6
6
|
|
|
7
|
+
import ok
|
|
7
8
|
from ok.util.path import get_path_relative_to_exe, ensure_dir_for_file
|
|
8
9
|
|
|
9
10
|
|
|
@@ -34,6 +35,13 @@ def get_substring_from_last_dot_exclusive(s):
|
|
|
34
35
|
auto_helper_logger = logging.getLogger("ok")
|
|
35
36
|
|
|
36
37
|
|
|
38
|
+
def log_exception_handler(exctype, value, traceback):
|
|
39
|
+
if auto_helper_logger is not None:
|
|
40
|
+
auto_helper_logger.error(f"Uncaught exception: {exctype}, traceback: {traceback}")
|
|
41
|
+
# Call the default excepthook to print the traceback
|
|
42
|
+
sys.__excepthook__(exctype, value, traceback)
|
|
43
|
+
|
|
44
|
+
|
|
37
45
|
def config_logger(config):
|
|
38
46
|
if config.get('debug'):
|
|
39
47
|
auto_helper_logger.setLevel(logging.DEBUG)
|
|
@@ -70,6 +78,8 @@ def config_logger(config):
|
|
|
70
78
|
file_handler.setLevel(logging.ERROR) # File handler level
|
|
71
79
|
auto_helper_logger.addHandler(file_handler)
|
|
72
80
|
|
|
81
|
+
sys.excepthook = log_exception_handler
|
|
82
|
+
|
|
73
83
|
|
|
74
84
|
class Logger:
|
|
75
85
|
def __init__(self, name):
|
|
@@ -64,8 +64,8 @@ class BaseTask(ExecutorOperation):
|
|
|
64
64
|
communicate.task_info.emit()
|
|
65
65
|
|
|
66
66
|
@staticmethod
|
|
67
|
-
def notification(message, title=None):
|
|
68
|
-
communicate.notification.emit(title,
|
|
67
|
+
def notification(message, title=None, error=False):
|
|
68
|
+
communicate.notification.emit(message, title, error)
|
|
69
69
|
|
|
70
70
|
@property
|
|
71
71
|
def enabled(self):
|
|
@@ -2,6 +2,7 @@ import threading
|
|
|
2
2
|
import time
|
|
3
3
|
import traceback
|
|
4
4
|
|
|
5
|
+
from ok.capture.BaseCaptureMethod import CaptureException
|
|
5
6
|
from ok.capture.adb.DeviceManager import DeviceManager
|
|
6
7
|
from ok.gui.Communicate import communicate
|
|
7
8
|
from ok.logging.Logger import get_logger
|
|
@@ -227,11 +228,15 @@ class TaskExecutor:
|
|
|
227
228
|
logger.info(f"FinishedException, breaking")
|
|
228
229
|
break
|
|
229
230
|
except Exception as e:
|
|
231
|
+
if isinstance(e, CaptureException):
|
|
232
|
+
communicate.capture_error.emit()
|
|
233
|
+
name = ""
|
|
230
234
|
if self.current_task is not None:
|
|
235
|
+
name = self.current_task.name
|
|
231
236
|
self.current_task.disable()
|
|
232
237
|
traceback.print_exc()
|
|
233
238
|
stack_trace_str = traceback.format_exc()
|
|
234
|
-
logger.error(f"{
|
|
239
|
+
logger.error(f"{name} exception: {e}, traceback: {stack_trace_str}")
|
|
235
240
|
self.current_task = None
|
|
236
241
|
if isinstance(self.current_task, OneTimeTask):
|
|
237
242
|
self.current_task.running = False
|
|
@@ -14,6 +14,7 @@ ok/capture/adb/bin/__init__.py
|
|
|
14
14
|
ok/capture/windows/WindowsGraphicsCaptureMethod.py
|
|
15
15
|
ok/capture/windows/__init__.py
|
|
16
16
|
ok/capture/windows/d3d11.py
|
|
17
|
+
ok/capture/windows/dump.py
|
|
17
18
|
ok/capture/windows/utils.py
|
|
18
19
|
ok/capture/windows/window.py
|
|
19
20
|
ok/color/Color.py
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
from PySide6.QtWidgets import QTextEdit
|
|
2
|
-
|
|
3
|
-
from ok.gui.widget.Tab import Tab
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
class AboutTab(Tab):
|
|
7
|
-
def __init__(self, text=""):
|
|
8
|
-
super().__init__()
|
|
9
|
-
# Create a QTextEdit instance
|
|
10
|
-
text_edit = QTextEdit()
|
|
11
|
-
text_edit.setHtml(text)
|
|
12
|
-
text_edit.setReadOnly(True)
|
|
13
|
-
|
|
14
|
-
# Set the layout on the widget
|
|
15
|
-
self.addWidget(text_edit)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
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.33 → ok-script-0.0.35}/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
|