ok-script 2.0.7b1__tar.gz → 2.0.9__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-2.0.7b1/ok_script.egg-info → ok_script-2.0.9}/PKG-INFO +1 -1
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/__init__.py +36 -9
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/core/start_controller.py +6 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/device/capture_methods/base.py +6 -1
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/device/capture_methods/update.py +58 -17
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/device/capture_methods/windows_graphics.py +55 -7
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/task/TaskExecutor.py +13 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/task/exceptions.py +10 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/util/logger.py +3 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/util/windows_schedule.py +1 -1
- {ok_script-2.0.7b1 → ok_script-2.0.9/ok_script.egg-info}/PKG-INFO +1 -1
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok_script.egg-info/SOURCES.txt +3 -1
- ok_script-2.0.9/tests/test_capture_update.py +149 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/tests/test_logger.py +21 -0
- ok_script-2.0.9/tests/test_overlay_lifecycle.py +105 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/tests/test_start_controller.py +87 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/tests/test_task_executor_queue.py +54 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/tests/test_windows_graphics_capture.py +182 -17
- ok_script-2.0.9/tests/test_windows_schedule_xml.py +53 -0
- ok_script-2.0.7b1/tests/test_capture_update.py +0 -83
- {ok_script-2.0.7b1 → ok_script-2.0.9}/LICENSE.txt +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/MANIFEST.in +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/README.md +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/diagnostics/qq_trace.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/__main__.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/alas/__init__.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/alas/emulator_base.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/alas/emulator_windows.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/alas/platform_windows.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/alas/utils.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/capture/__init__.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/capture/adb/__init__.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/capture/adb/deep.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/capture/adb/minitouch.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/capture/adb/nemu_ipc.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/capture/adb/nemu_utils.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/capture/adb/pool.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/capture/adb/timer.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/capture/adb/util.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/capture/windows/__init__.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/capture/windows/d3d11.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/capture/windows/dump.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/cli.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/core/__init__.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/core/config_schema.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/core/downloads.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/core/events.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/core/icons.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/core/notifications.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/core/screenshot.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/core/script_editing.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/core/script_packager.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/core/script_templates.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/core/task_manager.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/core/template_store.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/core/translation.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/core/ui_config.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/device/DeviceManager.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/device/__init__.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/device/capture.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/device/capture_methods/__init__.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/device/capture_methods/adb.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/device/capture_methods/bitblt.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/device/capture_methods/bitblt_utils.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/device/capture_methods/browser.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/device/capture_methods/desktop_duplication.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/device/capture_methods/hwnd_window.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/device/capture_methods/image.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/device/capture_methods/nemu_ipc.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/device/capture_methods/types.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/device/interaction.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/device/interaction_methods/__init__.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/device/interaction_methods/adb.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/device/interaction_methods/base.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/device/interaction_methods/browser.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/device/interaction_methods/do_nothing.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/device/interaction_methods/foreground_post_message.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/device/interaction_methods/genshin.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/device/interaction_methods/keys.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/device/interaction_methods/post_message.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/device/interaction_methods/pydirect.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/device/interaction_methods/pynput.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/device/interaction_methods/swipe.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/device/intercation.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/feature/Box.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/feature/Feature.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/feature/FeatureSet.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/feature/__init__.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/gui/__init__.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/gui/util/pyappify_startup.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/notification/__init__.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/notification/manager.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/notification/messenger_images.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/notification/pipeline.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/notification/ppocr.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/notification/providers.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/notification/system.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/notification/windows_messenger.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ocr/__init__.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ocr/download_paddle_model.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/rotypes/Windows/Foundation/Collections.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/rotypes/Windows/Foundation/__init__.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/rotypes/Windows/Globalization/__init__.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/rotypes/Windows/Graphics/Capture/__init__.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/rotypes/Windows/Graphics/DirectX/Direct3D11/__init__.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/rotypes/Windows/Graphics/DirectX/__init__.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/rotypes/Windows/Graphics/Imaging/__init__.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/rotypes/Windows/Graphics/__init__.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/rotypes/Windows/Media/Ocr/__init__.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/rotypes/Windows/Media/__init__.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/rotypes/Windows/Security/Cryptography/__init__.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/rotypes/Windows/Security/__init__.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/rotypes/Windows/Storage/Streams/__init__.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/rotypes/Windows/Storage/__init__.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/rotypes/Windows/UI/ViewManagement/__init__.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/rotypes/Windows/UI/__init__.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/rotypes/Windows/__init__.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/rotypes/__init__.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/rotypes/delegate.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/rotypes/export.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/rotypes/idldsl.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/rotypes/inspectable.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/rotypes/roapi.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/rotypes/types.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/rotypes/winstring.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/task/DiagnosisTask.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/task/__init__.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/task/task.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/task/web.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/test/OKTestRunner.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/test/RunTests.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/test/TaskTestCase.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/test/__init__.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/third_party/__init__.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/third_party/paperclip.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/__init__.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/overlay/__init__.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/overlay/win32_gdi.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/Communicate.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/MainWindow.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/MessageWindow.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/StartController.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/TabTitles.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/__init__.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/about/AboutTab.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/about/HttpTextEdit.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/about/LinksBar.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/about/ProjectCard.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/about/UpdateCard.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/about/VersionCard.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/about/__init__.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/common/OKIcon.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/common/__init__.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/common/accent_color.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/common/config.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/common/design_system.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/common/icons.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/common/style_sheet.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/debug/DebugTab.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/debug/OverlayWidget.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/debug/RunCodeTab.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/debug/Screenshot.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/debug/__init__.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/events.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/i18n/GettextTranslator.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/i18n/__init__.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/i18n/en_US.qm +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/i18n/en_US.ts +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/i18n/es_ES.qm +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/i18n/es_ES.ts +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/i18n/ja_JP.qm +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/i18n/ja_JP.ts +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/i18n/ko_KR.qm +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/i18n/ko_KR.ts +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/i18n/path.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/i18n/update.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/i18n/zh_CN.qm +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/i18n/zh_CN.ts +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/i18n/zh_TW.qm +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/i18n/zh_TW.ts +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/overlay/OverlayWindow.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/overlay/__init__.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/qss/__init__.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/qss/dark/card.qss +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/qss/dark/discord.svg +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/qss/dark/heart.svg +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/qss/dark/message_window.qss +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/qss/dark/setting_interface.qss +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/qss/dark/status_bar.qss +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/qss/dark/stop.svg +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/qss/dark/tab.qss +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/qss/light/card.qss +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/qss/light/discord.svg +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/qss/light/heart.svg +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/qss/light/message_window.qss +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/qss/light/setting_interface.qss +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/qss/light/status_bar.qss +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/qss/light/stop.svg +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/qss/light/tab.qss +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/qt.qrc +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/resources.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/settings/GlobalConfigCard.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/settings/GlobalConfigTab.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/settings/SettingTab.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/settings/__init__.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/start/LogWindow.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/start/SelectCaptureListView.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/start/SelectInteractionListView.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/start/StartCard.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/start/StartTab.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/start/__init__.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/tasks/ConfigCard.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/tasks/ConfigItemFactory.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/tasks/ConfigLabelAndWidget.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/tasks/EditTaskTab.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/tasks/LabelAndButtons.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/tasks/LabelAndDoubleSpinBox.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/tasks/LabelAndDropDown.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/tasks/LabelAndFileSelector.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/tasks/LabelAndGlobal.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/tasks/LabelAndLineEdit.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/tasks/LabelAndList.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/tasks/LabelAndMultiSelection.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/tasks/LabelAndSpinBox.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/tasks/LabelAndSwitchButton.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/tasks/LabelAndTextEdit.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/tasks/LabelAndWidget.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/tasks/MarkUpWindow.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/tasks/ModifyListDialog.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/tasks/ModifyListItem.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/tasks/OneTimeTaskTab.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/tasks/PythonHighlighter.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/tasks/RecordScript.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/tasks/ScheduleTaskTab.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/tasks/ScriptPackager.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/tasks/StartButton.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/tasks/TaskCard.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/tasks/TaskManger.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/tasks/TaskOpButton.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/tasks/TaskTab.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/tasks/TemplateFactory.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/tasks/TemplateTab.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/tasks/TooltipTableWidget.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/tasks/TriggerTaskTab.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/tasks/__init__.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/tasks/schedule_index_sync.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/util/Alert.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/util/InitWorker.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/util/__init__.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/util/app.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/util/download.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/util/pip_util.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/util/pyappify_startup.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/util/touch_scroll.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/util/windows_thumbnail.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/widget/BaseLoading.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/widget/BaseWindow.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/widget/Card.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/widget/CustomTab.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/widget/EmptyCard.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/widget/ExpandCardLayout.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/widget/FlowLayout.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/widget/FramelessDialog.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/widget/ImageWidget.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/widget/ListTableWidgetItem.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/widget/NumericTableWidgetItem.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/widget/OkCompactSpinBox.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/widget/SortingTableWidgetItem.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/widget/StartLoadingDialog.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/widget/StatusBar.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/widget/Tab.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/widget/TabWidget.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/widget/UpdateConfigWidgetItem.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/widget/WidgetWithVLabel.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/widget/YesNonWidgetItem.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/qt/widget/__init__.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/web/__init__.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/web/app.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/web/requirements.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/web/server.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/web/static/app.js +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/web/static/chunk-fluent.js +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/web/static/chunk-react.js +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/web/static/index.css +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/ui/web/static/index.html +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/update/__init__.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/update/copy_ok_folder.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/update/inline_ok_requirements.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/util/Analytics.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/util/GlobalConfig.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/util/__init__.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/util/blur.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/util/clazz.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/util/collection.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/util/color.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/util/config.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/util/explorer.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/util/file.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/util/gpu_driver_settings.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/util/handler.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/util/i18n.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/util/partial_sync_repo.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/util/print_hwnd.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/util/process.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok/util/window.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok_script.egg-info/dependency_links.txt +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok_script.egg-info/entry_points.txt +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok_script.egg-info/not-zip-safe +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok_script.egg-info/requires.txt +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/ok_script.egg-info/top_level.txt +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/pyproject.toml +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/scripts/generate_web_i18n.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/setup.cfg +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/setup.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/tests/test_accent_color.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/tests/test_app.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/tests/test_base_interaction.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/tests/test_blur.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/tests/test_box.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/tests/test_cli.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/tests/test_config_card.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/tests/test_core_events.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/tests/test_core_ui_services.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/tests/test_device_manager.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/tests/test_expand_card_layout.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/tests/test_explorer.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/tests/test_global_config.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/tests/test_gpu_driver_settings.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/tests/test_handler.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/tests/test_headless_imports.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/tests/test_inline_ok_requirements.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/tests/test_main_window_notifications.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/tests/test_main_window_startup_tab.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/tests/test_main_window_system_theme.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/tests/test_missing_frame.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/tests/test_navigation_state.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/tests/test_nemu_ipc_capture.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/tests/test_notifications.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/tests/test_ok_mutex.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/tests/test_overlay_custom_draw.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/tests/test_package_metadata.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/tests/test_process.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/tests/test_process_mutex.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/tests/test_pyappify_startup_update.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/tests/test_qt_events.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/tests/test_qt_legacy_imports.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/tests/test_qt_page_layout.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/tests/test_runtime_startup.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/tests/test_schedule_startup.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/tests/test_schedule_task_index_sync.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/tests/test_start_tab_overlay.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/tests/test_task_ui.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/tests/test_template_tab.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/tests/test_touch_scroll.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/tests/test_translation_fallback.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/tests/test_ui_config.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/tests/test_web_app.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/tests/test_web_i18n.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/tests/test_web_server.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/tests/test_web_task_tabs.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/tests/test_web_ui_pages.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/tests/test_web_ui_tasks.py +0 -0
- {ok_script-2.0.7b1 → ok_script-2.0.9}/tests/test_windows_schedule_target_parse.py +0 -0
|
@@ -231,15 +231,35 @@ def _create_ok_config(config):
|
|
|
231
231
|
|
|
232
232
|
|
|
233
233
|
class _OverlayConfigMixin:
|
|
234
|
+
def _blur_enabled(self):
|
|
235
|
+
executor = getattr(og, 'executor', None)
|
|
236
|
+
return (callable(self.config.get('blur_area'))
|
|
237
|
+
and bool(getattr(executor, 'basic_options', {}).get('Enable Blur', False)))
|
|
238
|
+
|
|
239
|
+
def _overlay_needed(self):
|
|
240
|
+
return self.ok_config.get('use_overlay', False) or self._blur_enabled()
|
|
241
|
+
|
|
234
242
|
def overlay_state(self):
|
|
235
243
|
return {'boxes': bool(self.ok_config.get('use_overlay', False))}
|
|
236
244
|
|
|
237
245
|
def initialize_overlay(self):
|
|
238
246
|
"""Apply persisted overlay state independently of the active UI."""
|
|
239
|
-
if self.
|
|
247
|
+
if self._overlay_needed():
|
|
240
248
|
overlay = self.get_overlay_view()
|
|
241
249
|
if overlay is not None:
|
|
242
|
-
overlay.set_boxes_enabled(
|
|
250
|
+
overlay.set_boxes_enabled(self.ok_config.get('use_overlay', False))
|
|
251
|
+
|
|
252
|
+
def _on_blur_patches(self, patches):
|
|
253
|
+
# A live setting change can enable blur without a new window geometry event.
|
|
254
|
+
# The new overlay does not receive the signal currently being dispatched.
|
|
255
|
+
if self._blur_enabled() and self.overlay_window is None:
|
|
256
|
+
overlay = self.get_overlay_view()
|
|
257
|
+
if overlay is not None:
|
|
258
|
+
overlay.update_blur_patches(patches)
|
|
259
|
+
|
|
260
|
+
def _on_clear_blur_patches(self):
|
|
261
|
+
if not self._overlay_needed() and self.overlay_window is not None:
|
|
262
|
+
self._close_overlay(wait=False)
|
|
243
263
|
|
|
244
264
|
def _close_overlay(self, wait=True):
|
|
245
265
|
overlay = self.overlay_window
|
|
@@ -269,7 +289,7 @@ class _OverlayConfigMixin:
|
|
|
269
289
|
overlay = self.overlay_window
|
|
270
290
|
if name == 'boxes' and value:
|
|
271
291
|
overlay = self.get_overlay_view()
|
|
272
|
-
elif name == 'boxes' and not value and overlay is not None:
|
|
292
|
+
elif name == 'boxes' and not value and overlay is not None and not self._blur_enabled():
|
|
273
293
|
self._close_overlay()
|
|
274
294
|
return self.overlay_state()
|
|
275
295
|
if overlay is not None:
|
|
@@ -301,6 +321,8 @@ class App(_OverlayConfigMixin):
|
|
|
301
321
|
task_executor.load_tr()
|
|
302
322
|
self.ok_config = _create_ok_config(config)
|
|
303
323
|
communicate.quit.connect(self.quit)
|
|
324
|
+
communicate.blur_overlay.connect(self._on_blur_patches)
|
|
325
|
+
communicate.clear_blur_overlay.connect(self._on_clear_blur_patches)
|
|
304
326
|
|
|
305
327
|
self.about = self.config.get('about')
|
|
306
328
|
self.title = self.config.get('gui_title')
|
|
@@ -341,6 +363,9 @@ class App(_OverlayConfigMixin):
|
|
|
341
363
|
logger.debug('init app end')
|
|
342
364
|
|
|
343
365
|
def quit(self):
|
|
366
|
+
from ok.core.events import communicate
|
|
367
|
+
communicate.blur_overlay.disconnect(self._on_blur_patches)
|
|
368
|
+
communicate.clear_blur_overlay.disconnect(self._on_clear_blur_patches)
|
|
344
369
|
self.exit_event.set()
|
|
345
370
|
self._close_overlay(wait=False)
|
|
346
371
|
self._close_device_manager()
|
|
@@ -412,10 +437,8 @@ class App(_OverlayConfigMixin):
|
|
|
412
437
|
self.show_message_window(title, content)
|
|
413
438
|
|
|
414
439
|
def update_overlay(self, visible, x, y, window_width, window_height, width, height, scaling):
|
|
415
|
-
if not self.
|
|
416
|
-
#
|
|
417
|
-
# a configured blur callback must not resurrect a disabled native
|
|
418
|
-
# window (and its input/expiry workers).
|
|
440
|
+
if not self._overlay_needed():
|
|
441
|
+
# Keep the native window only while debug boxes or UID blur need it.
|
|
419
442
|
if self.overlay_window is not None:
|
|
420
443
|
self._close_overlay(wait=False)
|
|
421
444
|
return
|
|
@@ -427,7 +450,7 @@ class App(_OverlayConfigMixin):
|
|
|
427
450
|
|
|
428
451
|
def get_overlay_view(self):
|
|
429
452
|
"""Return the overlay widget exposed to tasks, custom tabs, and my_app."""
|
|
430
|
-
if not self.
|
|
453
|
+
if not self._overlay_needed():
|
|
431
454
|
return None
|
|
432
455
|
if self.overlay_window is None:
|
|
433
456
|
from ok.core.events import communicate
|
|
@@ -515,6 +538,8 @@ class HeadlessApp(_OverlayConfigMixin):
|
|
|
515
538
|
self.to_translate = None
|
|
516
539
|
communicate.quit.connect(self.quit)
|
|
517
540
|
communicate.adb_devices.connect(self.sync_overlay_source)
|
|
541
|
+
communicate.blur_overlay.connect(self._on_blur_patches)
|
|
542
|
+
communicate.clear_blur_overlay.connect(self._on_clear_blur_patches)
|
|
518
543
|
|
|
519
544
|
self.locale = LocaleName(config.get("locale", "en_US"))
|
|
520
545
|
from ok.core.start_controller import StartController
|
|
@@ -562,6 +587,8 @@ class HeadlessApp(_OverlayConfigMixin):
|
|
|
562
587
|
from ok.core.events import communicate
|
|
563
588
|
communicate.adb_devices.disconnect(self.sync_overlay_source)
|
|
564
589
|
communicate.notification.disconnect(self.show_notification)
|
|
590
|
+
communicate.blur_overlay.disconnect(self._on_blur_patches)
|
|
591
|
+
communicate.clear_blur_overlay.disconnect(self._on_clear_blur_patches)
|
|
565
592
|
if self.notification_manager is not None:
|
|
566
593
|
self.notification_manager.stop()
|
|
567
594
|
if self.exit_event:
|
|
@@ -581,7 +608,7 @@ class HeadlessApp(_OverlayConfigMixin):
|
|
|
581
608
|
self.notification_manager.submit(translated_title, translated_message, images)
|
|
582
609
|
|
|
583
610
|
def get_overlay_view(self):
|
|
584
|
-
if not self.
|
|
611
|
+
if not self._overlay_needed():
|
|
585
612
|
return None
|
|
586
613
|
if self.overlay_window is None:
|
|
587
614
|
from ok.core.events import communicate
|
|
@@ -193,6 +193,12 @@ class StartController:
|
|
|
193
193
|
dx11_config = og.global_config.get_config('Launch with DX11')
|
|
194
194
|
if dx11_config and dx11_config.get('Launch with DX11'):
|
|
195
195
|
args = "-dx11 -d3d11 -force-d3d11"
|
|
196
|
+
if device['device'] == "windows":
|
|
197
|
+
launch_arguments = (self.config.get('windows') or {}).get('launch_arguments')
|
|
198
|
+
if callable(launch_arguments):
|
|
199
|
+
launch_arguments = launch_arguments()
|
|
200
|
+
if launch_arguments:
|
|
201
|
+
args = f'{args or ""} {launch_arguments}'.strip()
|
|
196
202
|
if not execute(path, arguments=args, start_method=self.start_method):
|
|
197
203
|
communicate.starting_emulator.emit(True, self.tr("Start game failed, please start game first"), 0)
|
|
198
204
|
return False
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from ok.task.exceptions import CaptureException
|
|
1
|
+
from ok.task.exceptions import CaptureBusyException, CaptureException
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
class BaseCaptureMethod:
|
|
@@ -40,6 +40,11 @@ class BaseCaptureMethod:
|
|
|
40
40
|
if frame.shape[2] == 4:
|
|
41
41
|
frame = frame[:, :, :3]
|
|
42
42
|
return frame
|
|
43
|
+
except CaptureBusyException:
|
|
44
|
+
# Normal backpressure: another caller owns the capture request.
|
|
45
|
+
# Report "no frame this round" and let callers retry on their own
|
|
46
|
+
# schedule instead of raising a capture error.
|
|
47
|
+
return None
|
|
43
48
|
except Exception as e:
|
|
44
49
|
raise CaptureException(str(e)) from e
|
|
45
50
|
|
|
@@ -7,6 +7,7 @@ from ok.device.capture_methods import bitblt
|
|
|
7
7
|
from ok.device.capture_methods.bitblt import BitBltCaptureMethod, ForegroundBitBltCaptureMethod
|
|
8
8
|
from ok.device.capture_methods.desktop_duplication import DesktopDuplicationCaptureMethod
|
|
9
9
|
from ok.device.capture_methods.windows_graphics import WindowsGraphicsCaptureMethod
|
|
10
|
+
from ok.task.exceptions import CaptureBusyException
|
|
10
11
|
|
|
11
12
|
logger = Logger.get_logger(__name__)
|
|
12
13
|
|
|
@@ -44,31 +45,71 @@ def update_capture_method(config, capture_method, hwnd, exit_event=None, selecte
|
|
|
44
45
|
return None
|
|
45
46
|
|
|
46
47
|
def get_win_graphics_capture(capture_method, hwnd, exit_event):
|
|
47
|
-
if windows_graphics_available():
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
48
|
+
if not windows_graphics_available():
|
|
49
|
+
return None
|
|
50
|
+
|
|
51
|
+
target_method = WindowsGraphicsCaptureMethod
|
|
52
|
+
capture_method = get_capture(capture_method, target_method, hwnd, exit_event)
|
|
53
|
+
|
|
54
|
+
try:
|
|
55
|
+
started = capture_method.start_or_stop()
|
|
56
|
+
except CaptureBusyException:
|
|
57
|
+
# A concurrent request already owns this WGC instance. That is evidence
|
|
58
|
+
# of active use, not a startup failure. Keep WGC selected and let the
|
|
59
|
+
# normal caller retry.
|
|
60
|
+
logger.debug('WGC startup validation deferred because capture is busy')
|
|
61
|
+
return capture_method
|
|
62
|
+
|
|
63
|
+
if started:
|
|
64
|
+
try:
|
|
65
|
+
if _capture_can_produce_frame(capture_method, WGC_FIRST_FRAME_TIMEOUT):
|
|
66
|
+
return capture_method
|
|
67
|
+
except CaptureBusyException:
|
|
68
|
+
# Do not close or cache a WGC instance merely because another
|
|
69
|
+
# caller occupied its request lock for the probe interval.
|
|
70
|
+
logger.debug('WGC first-frame probe deferred because capture is busy')
|
|
51
71
|
return capture_method
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
72
|
+
|
|
73
|
+
# Only genuine startup failure, or an acquired probe that produced no
|
|
74
|
+
# frame, reaches this point.
|
|
75
|
+
if isinstance(capture_method, WindowsGraphicsCaptureMethod):
|
|
76
|
+
capture_hwnd = capture_method.get_capture_hwnd()
|
|
77
|
+
if capture_hwnd:
|
|
78
|
+
capture_method.last_start_failure_key = capture_hwnd
|
|
79
|
+
capture_method.last_start_failure_time = time.time()
|
|
80
|
+
capture_method.close()
|
|
81
|
+
|
|
82
|
+
return None
|
|
58
83
|
|
|
59
84
|
|
|
60
85
|
def _capture_can_produce_frame(capture_method, timeout):
|
|
61
|
-
deadline = time.
|
|
62
|
-
|
|
86
|
+
deadline = time.monotonic() + max(0.0, float(timeout))
|
|
87
|
+
|
|
88
|
+
while True:
|
|
89
|
+
remaining = deadline - time.monotonic()
|
|
90
|
+
if remaining <= 0:
|
|
91
|
+
logger.warning(f'{capture_method.get_name()} did not produce a frame within {timeout}s')
|
|
92
|
+
return False
|
|
93
|
+
|
|
63
94
|
try:
|
|
64
|
-
|
|
65
|
-
|
|
95
|
+
frame = capture_method.get_frame_for_probe(remaining)
|
|
96
|
+
except CaptureBusyException:
|
|
97
|
+
# Preserve the distinction for get_win_graphics_capture(): a busy
|
|
98
|
+
# WGC must not be closed, cached as failed, or replaced by BitBlt.
|
|
99
|
+
raise
|
|
66
100
|
except Exception as e:
|
|
67
101
|
logger.warning(f'{capture_method.get_name()} did not produce a frame: {e}')
|
|
68
102
|
return False
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
103
|
+
|
|
104
|
+
if frame is not None:
|
|
105
|
+
return True
|
|
106
|
+
|
|
107
|
+
remaining = deadline - time.monotonic()
|
|
108
|
+
if remaining <= 0:
|
|
109
|
+
logger.warning(f'{capture_method.get_name()} did not produce a frame within {timeout}s')
|
|
110
|
+
return False
|
|
111
|
+
|
|
112
|
+
time.sleep(min(0.05, remaining))
|
|
72
113
|
|
|
73
114
|
def get_capture(capture_method, target_method, hwnd, exit_event):
|
|
74
115
|
if not isinstance(capture_method, target_method):
|
|
@@ -16,6 +16,7 @@ from ok.device.capture_methods.bitblt_utils import (
|
|
|
16
16
|
composite_hwnds,
|
|
17
17
|
get_crop_point,
|
|
18
18
|
)
|
|
19
|
+
from ok.task.exceptions import CaptureBusyException
|
|
19
20
|
|
|
20
21
|
logger = Logger.get_logger(__name__)
|
|
21
22
|
|
|
@@ -142,7 +143,12 @@ class WindowsGraphicsCaptureMethod(BaseWindowsCaptureMethod):
|
|
|
142
143
|
@hwnd_window.setter
|
|
143
144
|
def hwnd_window(self, hwnd_window):
|
|
144
145
|
self._hwnd_window = hwnd_window
|
|
145
|
-
|
|
146
|
+
try:
|
|
147
|
+
self.start_or_stop()
|
|
148
|
+
except CaptureBusyException:
|
|
149
|
+
# Another request owns get_frame_lock and will validate the latest
|
|
150
|
+
# capture_target_signature before obtaining its next frame.
|
|
151
|
+
logger.debug('WGC target refresh deferred because capture is busy')
|
|
146
152
|
|
|
147
153
|
def connected(self):
|
|
148
154
|
return self.hwnd_window is not None and self.hwnd_window.exists and self.frame_pool is not None
|
|
@@ -157,6 +163,21 @@ class WindowsGraphicsCaptureMethod(BaseWindowsCaptureMethod):
|
|
|
157
163
|
return 0
|
|
158
164
|
|
|
159
165
|
def start_or_stop(self, capture_cursor=False):
|
|
166
|
+
"""Start, stop, or refresh WGC without violating the lock order.
|
|
167
|
+
|
|
168
|
+
Lifecycle operations and frame requests both acquire get_frame_lock
|
|
169
|
+
before self.lock. A contended lock means another valid WGC operation
|
|
170
|
+
is in progress; it is retryable and must not be reported as a capture
|
|
171
|
+
failure.
|
|
172
|
+
"""
|
|
173
|
+
if not self.get_frame_lock.acquire(blocking=False):
|
|
174
|
+
raise CaptureBusyException('Windows Graphics Capture is busy')
|
|
175
|
+
try:
|
|
176
|
+
return self._start_or_stop(capture_cursor)
|
|
177
|
+
finally:
|
|
178
|
+
self.get_frame_lock.release()
|
|
179
|
+
|
|
180
|
+
def _start_or_stop(self, capture_cursor=False):
|
|
160
181
|
with self.lock:
|
|
161
182
|
if self.exit_event.is_set():
|
|
162
183
|
logger.warning('start_or_stop exit_event.is_set() return')
|
|
@@ -295,12 +316,37 @@ class WindowsGraphicsCaptureMethod(BaseWindowsCaptureMethod):
|
|
|
295
316
|
self.capture_target_signature = None
|
|
296
317
|
|
|
297
318
|
def do_get_frame(self):
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
319
|
+
"""Capture one frame, or report a retryable busy state.
|
|
320
|
+
|
|
321
|
+
frame_requested, frame_event, and last_frame represent one in-flight
|
|
322
|
+
request. Only one caller may operate on them at a time.
|
|
323
|
+
"""
|
|
324
|
+
if not self.get_frame_lock.acquire(blocking=False):
|
|
325
|
+
raise CaptureBusyException('Windows Graphics Capture is busy')
|
|
326
|
+
try:
|
|
301
327
|
return self._do_get_frame()
|
|
328
|
+
finally:
|
|
329
|
+
self.get_frame_lock.release()
|
|
330
|
+
|
|
331
|
+
def get_frame_for_probe(self, timeout):
|
|
332
|
+
"""Try to produce a frame within the caller's absolute time budget.
|
|
333
|
+
|
|
334
|
+
Unlike BaseCaptureMethod.get_frame(), this deliberately propagates
|
|
335
|
+
CaptureBusyException so capture-method selection can distinguish BUSY
|
|
336
|
+
from a WGC instance that actually failed to produce a frame.
|
|
337
|
+
"""
|
|
338
|
+
timeout = max(0.0, float(timeout))
|
|
339
|
+
deadline = time.monotonic() + timeout
|
|
340
|
+
|
|
341
|
+
if not self.get_frame_lock.acquire(timeout=timeout):
|
|
342
|
+
raise CaptureBusyException('Windows Graphics Capture is busy')
|
|
343
|
+
|
|
344
|
+
try:
|
|
345
|
+
return self._do_get_frame(frame_deadline=deadline)
|
|
346
|
+
finally:
|
|
347
|
+
self.get_frame_lock.release()
|
|
302
348
|
|
|
303
|
-
def _do_get_frame(self):
|
|
349
|
+
def _do_get_frame(self, frame_deadline=None):
|
|
304
350
|
if self.exit_event.is_set():
|
|
305
351
|
return None
|
|
306
352
|
if self.start_or_stop():
|
|
@@ -309,7 +355,7 @@ class WindowsGraphicsCaptureMethod(BaseWindowsCaptureMethod):
|
|
|
309
355
|
logger.warning('no frame for 10 sec, try to restart')
|
|
310
356
|
self.close()
|
|
311
357
|
self.last_frame_time = time.time()
|
|
312
|
-
return self._do_get_frame()
|
|
358
|
+
return self._do_get_frame(frame_deadline=frame_deadline)
|
|
313
359
|
|
|
314
360
|
# A frame left by a request that timed out is not necessarily the
|
|
315
361
|
# latest frame anymore. Every call starts a fresh request instead of
|
|
@@ -321,7 +367,9 @@ class WindowsGraphicsCaptureMethod(BaseWindowsCaptureMethod):
|
|
|
321
367
|
self.frame_event.clear()
|
|
322
368
|
self.frame_requested.set()
|
|
323
369
|
|
|
324
|
-
deadline =
|
|
370
|
+
deadline = frame_deadline
|
|
371
|
+
if deadline is None:
|
|
372
|
+
deadline = time.monotonic() + WGC_FRAME_WAIT_TIMEOUT
|
|
325
373
|
while frame is None:
|
|
326
374
|
if self.exit_event.is_set():
|
|
327
375
|
with self.lock:
|
|
@@ -532,6 +532,18 @@ class TaskExecutor:
|
|
|
532
532
|
]
|
|
533
533
|
return min(delays, default=default)
|
|
534
534
|
|
|
535
|
+
def _prepare_task_for_run(self, is_trigger_task):
|
|
536
|
+
"""Prepare a task's input backend before the first frame is requested.
|
|
537
|
+
|
|
538
|
+
Foreground interaction backends such as Pynput only report a capture
|
|
539
|
+
frame while the target window is active. One-time tasks used to
|
|
540
|
+
request that frame first and only bring the target window forward from
|
|
541
|
+
inside ``task.run()``, which is too late and can leave the task waiting
|
|
542
|
+
indefinitely.
|
|
543
|
+
"""
|
|
544
|
+
if not is_trigger_task and self.interaction is not None:
|
|
545
|
+
self.interaction.on_run()
|
|
546
|
+
|
|
535
547
|
def execute(self):
|
|
536
548
|
logger.info(f"start execute")
|
|
537
549
|
while not self.exit_event.is_set():
|
|
@@ -553,6 +565,7 @@ class TaskExecutor:
|
|
|
553
565
|
self.current_task = task
|
|
554
566
|
if not is_trigger_task:
|
|
555
567
|
communicate.task.emit(task)
|
|
568
|
+
self._prepare_task_for_run(is_trigger_task)
|
|
556
569
|
if cycled or self._frame is None:
|
|
557
570
|
if self.next_frame(time_out=4) is None and is_trigger_task:
|
|
558
571
|
logger.info("no frame available, skip remaining trigger tasks")
|
|
@@ -18,6 +18,16 @@ class CaptureException(Exception):
|
|
|
18
18
|
pass
|
|
19
19
|
|
|
20
20
|
|
|
21
|
+
class CaptureBusyException(Exception):
|
|
22
|
+
"""A capture resource is temporarily owned by another caller.
|
|
23
|
+
|
|
24
|
+
This is normal backpressure (a concurrent frame request or lifecycle
|
|
25
|
+
refresh), not a capture failure. Callers should retry, and it must never
|
|
26
|
+
disqualify or close the underlying capture method.
|
|
27
|
+
"""
|
|
28
|
+
pass
|
|
29
|
+
|
|
30
|
+
|
|
21
31
|
class HotkeyConfigException(Exception):
|
|
22
32
|
def __init__(self, key):
|
|
23
33
|
self.key = key
|
|
@@ -49,6 +49,9 @@ class Logger:
|
|
|
49
49
|
stack_trace_str = self.exception_to_str(exception)
|
|
50
50
|
self.logger.error(f"{self.name}:{message} {stack_trace_str}")
|
|
51
51
|
|
|
52
|
+
def exception(self, message, *args, **kwargs):
|
|
53
|
+
self.logger.exception(f"{self.name}:{message}", *args, **kwargs)
|
|
54
|
+
|
|
52
55
|
def critical(self, message):
|
|
53
56
|
self.logger.critical(f"{self.name}:{message}")
|
|
54
57
|
|
|
@@ -1252,7 +1252,7 @@ class WindowsScheduleManager:
|
|
|
1252
1252
|
<DisallowStartIfOnBatteries>false</DisallowStartIfOnBatteries>
|
|
1253
1253
|
<StopIfGoingOnBatteries>true</StopIfGoingOnBatteries>
|
|
1254
1254
|
<AllowHardTerminate>true</AllowHardTerminate>
|
|
1255
|
-
<StartWhenAvailable>
|
|
1255
|
+
<StartWhenAvailable>true</StartWhenAvailable>
|
|
1256
1256
|
<RunOnlyIfNetworkAvailable>false</RunOnlyIfNetworkAvailable>
|
|
1257
1257
|
<AllowStartOnDemand>true</AllowStartOnDemand>
|
|
1258
1258
|
<Enabled>true</Enabled>
|
|
@@ -330,6 +330,7 @@ tests/test_nemu_ipc_capture.py
|
|
|
330
330
|
tests/test_notifications.py
|
|
331
331
|
tests/test_ok_mutex.py
|
|
332
332
|
tests/test_overlay_custom_draw.py
|
|
333
|
+
tests/test_overlay_lifecycle.py
|
|
333
334
|
tests/test_package_metadata.py
|
|
334
335
|
tests/test_process.py
|
|
335
336
|
tests/test_process_mutex.py
|
|
@@ -355,4 +356,5 @@ tests/test_web_task_tabs.py
|
|
|
355
356
|
tests/test_web_ui_pages.py
|
|
356
357
|
tests/test_web_ui_tasks.py
|
|
357
358
|
tests/test_windows_graphics_capture.py
|
|
358
|
-
tests/test_windows_schedule_target_parse.py
|
|
359
|
+
tests/test_windows_schedule_target_parse.py
|
|
360
|
+
tests/test_windows_schedule_xml.py
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import unittest
|
|
2
|
+
from unittest.mock import Mock, patch
|
|
3
|
+
|
|
4
|
+
import ok.device.capture_methods.update as capture_update
|
|
5
|
+
from ok.task.exceptions import CaptureBusyException
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class FakeClock:
|
|
9
|
+
def __init__(self):
|
|
10
|
+
self.value = 0
|
|
11
|
+
|
|
12
|
+
def time(self):
|
|
13
|
+
return self.value
|
|
14
|
+
|
|
15
|
+
def monotonic(self):
|
|
16
|
+
return self.value
|
|
17
|
+
|
|
18
|
+
def sleep(self, seconds):
|
|
19
|
+
self.value += seconds
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class FakeCapture:
|
|
23
|
+
def __init__(self, frames):
|
|
24
|
+
self.frames = list(frames)
|
|
25
|
+
|
|
26
|
+
def get_frame_for_probe(self, timeout):
|
|
27
|
+
if self.frames:
|
|
28
|
+
return self.frames.pop(0)
|
|
29
|
+
return None
|
|
30
|
+
|
|
31
|
+
def get_name(self):
|
|
32
|
+
return 'FakeCapture'
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
class TestCaptureUpdate(unittest.TestCase):
|
|
36
|
+
def test_capture_can_produce_frame_retries_until_frame_arrives(self):
|
|
37
|
+
clock = FakeClock()
|
|
38
|
+
capture = FakeCapture([None, object()])
|
|
39
|
+
|
|
40
|
+
with patch.object(capture_update.time, 'monotonic', clock.monotonic), \
|
|
41
|
+
patch.object(capture_update.time, 'sleep', clock.sleep):
|
|
42
|
+
self.assertTrue(capture_update._capture_can_produce_frame(capture, 1.0))
|
|
43
|
+
|
|
44
|
+
def test_capture_can_produce_frame_times_out(self):
|
|
45
|
+
clock = FakeClock()
|
|
46
|
+
capture = FakeCapture([])
|
|
47
|
+
|
|
48
|
+
with patch.object(capture_update.time, 'monotonic', clock.monotonic), \
|
|
49
|
+
patch.object(capture_update.time, 'sleep', clock.sleep):
|
|
50
|
+
self.assertFalse(capture_update._capture_can_produce_frame(capture, 0.1))
|
|
51
|
+
|
|
52
|
+
def test_wgc_without_first_frame_is_closed_and_rejected(self):
|
|
53
|
+
class FakeWGC:
|
|
54
|
+
def __init__(self):
|
|
55
|
+
self.last_start_failure_key = None
|
|
56
|
+
self.last_start_failure_time = 0
|
|
57
|
+
self.close = Mock()
|
|
58
|
+
|
|
59
|
+
def start_or_stop(self):
|
|
60
|
+
return True
|
|
61
|
+
|
|
62
|
+
def get_capture_hwnd(self):
|
|
63
|
+
return 123
|
|
64
|
+
|
|
65
|
+
def get_frame_for_probe(self, timeout):
|
|
66
|
+
return None
|
|
67
|
+
|
|
68
|
+
def get_name(self):
|
|
69
|
+
return 'WGC'
|
|
70
|
+
|
|
71
|
+
clock = FakeClock()
|
|
72
|
+
fake_wgc = FakeWGC()
|
|
73
|
+
|
|
74
|
+
with patch.object(capture_update, 'windows_graphics_available', return_value=True), \
|
|
75
|
+
patch.object(capture_update, 'WindowsGraphicsCaptureMethod', FakeWGC), \
|
|
76
|
+
patch.object(capture_update, 'get_capture', return_value=fake_wgc), \
|
|
77
|
+
patch.object(capture_update.time, 'time', clock.time), \
|
|
78
|
+
patch.object(capture_update.time, 'monotonic', clock.monotonic), \
|
|
79
|
+
patch.object(capture_update.time, 'sleep', clock.sleep):
|
|
80
|
+
self.assertIsNone(capture_update.get_win_graphics_capture(None, object(), object()))
|
|
81
|
+
|
|
82
|
+
self.assertEqual(123, fake_wgc.last_start_failure_key)
|
|
83
|
+
self.assertGreaterEqual(fake_wgc.last_start_failure_time, 0)
|
|
84
|
+
fake_wgc.close.assert_called_once()
|
|
85
|
+
|
|
86
|
+
def test_busy_capture_probe_propagates_busy(self):
|
|
87
|
+
capture = FakeCapture([])
|
|
88
|
+
capture.get_frame_for_probe = Mock(side_effect=CaptureBusyException('busy'))
|
|
89
|
+
|
|
90
|
+
with self.assertRaises(CaptureBusyException):
|
|
91
|
+
capture_update._capture_can_produce_frame(capture, 1.0)
|
|
92
|
+
|
|
93
|
+
def test_capture_probe_passes_remaining_budget(self):
|
|
94
|
+
clock = FakeClock()
|
|
95
|
+
capture = FakeCapture([None, object()])
|
|
96
|
+
capture.get_frame_for_probe = Mock(wraps=capture.get_frame_for_probe)
|
|
97
|
+
|
|
98
|
+
with patch.object(capture_update.time, 'monotonic', clock.monotonic), \
|
|
99
|
+
patch.object(capture_update.time, 'sleep', clock.sleep):
|
|
100
|
+
self.assertTrue(capture_update._capture_can_produce_frame(capture, 0.1))
|
|
101
|
+
|
|
102
|
+
self.assertEqual([unittest.mock.call(0.1), unittest.mock.call(0.05)],
|
|
103
|
+
capture.get_frame_for_probe.call_args_list)
|
|
104
|
+
|
|
105
|
+
def test_busy_wgc_stays_selected_without_fallback_or_failure_cache(self):
|
|
106
|
+
for busy_operation in ('start_or_stop', 'get_frame_for_probe'):
|
|
107
|
+
with self.subTest(busy_operation=busy_operation):
|
|
108
|
+
capture = Mock(spec=capture_update.WindowsGraphicsCaptureMethod)
|
|
109
|
+
capture.last_start_failure_key = None
|
|
110
|
+
capture.last_start_failure_time = 0
|
|
111
|
+
capture.start_or_stop.return_value = True
|
|
112
|
+
getattr(capture, busy_operation).side_effect = CaptureBusyException('busy')
|
|
113
|
+
fallback = Mock()
|
|
114
|
+
|
|
115
|
+
def get_capture(existing, target, hwnd, exit_event):
|
|
116
|
+
if target is capture_update.WindowsGraphicsCaptureMethod:
|
|
117
|
+
return capture
|
|
118
|
+
return fallback
|
|
119
|
+
|
|
120
|
+
with patch.object(capture_update, 'windows_graphics_available', return_value=True), \
|
|
121
|
+
patch.object(capture_update, 'get_capture', side_effect=get_capture) as select:
|
|
122
|
+
result = capture_update.update_capture_method(
|
|
123
|
+
{'capture_method': ['WGC', 'BitBlt']}, capture, object())
|
|
124
|
+
|
|
125
|
+
self.assertIs(capture, result)
|
|
126
|
+
self.assertEqual(1, select.call_count)
|
|
127
|
+
capture.close.assert_not_called()
|
|
128
|
+
self.assertIsNone(capture.last_start_failure_key)
|
|
129
|
+
self.assertEqual(0, capture.last_start_failure_time)
|
|
130
|
+
|
|
131
|
+
def test_failed_wgc_start_is_cached_closed_and_falls_back(self):
|
|
132
|
+
capture = Mock(spec=capture_update.WindowsGraphicsCaptureMethod)
|
|
133
|
+
capture.start_or_stop.return_value = False
|
|
134
|
+
capture.get_capture_hwnd.return_value = 123
|
|
135
|
+
fallback = object()
|
|
136
|
+
|
|
137
|
+
with patch.object(capture_update, 'windows_graphics_available', return_value=True), \
|
|
138
|
+
patch.object(capture_update, 'get_capture', side_effect=[capture, fallback]):
|
|
139
|
+
result = capture_update.update_capture_method(
|
|
140
|
+
{'capture_method': ['WGC', 'BitBlt']}, capture, object())
|
|
141
|
+
|
|
142
|
+
self.assertIs(fallback, result)
|
|
143
|
+
self.assertEqual(123, capture.last_start_failure_key)
|
|
144
|
+
capture.close.assert_called_once()
|
|
145
|
+
capture.get_frame_for_probe.assert_not_called()
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
if __name__ == '__main__':
|
|
149
|
+
unittest.main()
|
|
@@ -1,10 +1,31 @@
|
|
|
1
1
|
import logging
|
|
2
2
|
from unittest.mock import Mock
|
|
3
3
|
|
|
4
|
+
import pytest
|
|
5
|
+
|
|
4
6
|
import ok.util.logger as logger_module
|
|
5
7
|
from ok.util.logger import SafeFileHandler, config_logger
|
|
6
8
|
|
|
7
9
|
|
|
10
|
+
@pytest.mark.parametrize("use_exception_message", [False, True])
|
|
11
|
+
def test_logger_exception_preserves_original_traceback(caplog, use_exception_message):
|
|
12
|
+
logger = logger_module.Logger.get_logger("ok.ui.qt.MainWindow")
|
|
13
|
+
logger.logger = logging.getLogger("test.logger_exception")
|
|
14
|
+
|
|
15
|
+
try:
|
|
16
|
+
raise RuntimeError("schedule resolution failed")
|
|
17
|
+
except RuntimeError as error:
|
|
18
|
+
logger.exception(error if use_exception_message else "schedule task index sync failed in __init__")
|
|
19
|
+
|
|
20
|
+
record = caplog.records[-1]
|
|
21
|
+
assert record.levelno == logging.ERROR
|
|
22
|
+
assert record.getMessage().startswith("MainWindow:")
|
|
23
|
+
assert record.exc_info[0] is RuntimeError
|
|
24
|
+
assert str(record.exc_info[1]) == "schedule resolution failed"
|
|
25
|
+
assert "Traceback (most recent call last)" in caplog.text
|
|
26
|
+
assert "RuntimeError: schedule resolution failed" in caplog.text
|
|
27
|
+
|
|
28
|
+
|
|
8
29
|
def test_config_logger_does_not_create_file_log_during_pytest(tmp_path, monkeypatch):
|
|
9
30
|
monkeypatch.chdir(tmp_path)
|
|
10
31
|
|