ok-script 2.0.8__tar.gz → 2.0.10__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.8/ok_script.egg-info → ok_script-2.0.10}/PKG-INFO +1 -1
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/core/start_controller.py +5 -3
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/device/capture_methods/base.py +6 -1
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/device/capture_methods/update.py +58 -17
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/device/capture_methods/windows_graphics.py +46 -13
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/task/exceptions.py +10 -0
- {ok_script-2.0.8 → ok_script-2.0.10/ok_script.egg-info}/PKG-INFO +1 -1
- ok_script-2.0.10/tests/test_capture_update.py +149 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/tests/test_start_controller.py +2 -2
- {ok_script-2.0.8 → ok_script-2.0.10}/tests/test_windows_graphics_capture.py +84 -21
- ok_script-2.0.8/tests/test_capture_update.py +0 -83
- {ok_script-2.0.8 → ok_script-2.0.10}/LICENSE.txt +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/MANIFEST.in +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/README.md +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/diagnostics/qq_trace.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/__init__.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/__main__.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/alas/__init__.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/alas/emulator_base.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/alas/emulator_windows.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/alas/platform_windows.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/alas/utils.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/capture/__init__.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/capture/adb/__init__.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/capture/adb/deep.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/capture/adb/minitouch.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/capture/adb/nemu_ipc.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/capture/adb/nemu_utils.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/capture/adb/pool.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/capture/adb/timer.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/capture/adb/util.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/capture/windows/__init__.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/capture/windows/d3d11.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/capture/windows/dump.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/cli.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/core/__init__.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/core/config_schema.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/core/downloads.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/core/events.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/core/icons.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/core/notifications.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/core/screenshot.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/core/script_editing.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/core/script_packager.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/core/script_templates.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/core/task_manager.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/core/template_store.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/core/translation.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/core/ui_config.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/device/DeviceManager.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/device/__init__.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/device/capture.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/device/capture_methods/__init__.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/device/capture_methods/adb.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/device/capture_methods/bitblt.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/device/capture_methods/bitblt_utils.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/device/capture_methods/browser.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/device/capture_methods/desktop_duplication.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/device/capture_methods/hwnd_window.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/device/capture_methods/image.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/device/capture_methods/nemu_ipc.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/device/capture_methods/types.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/device/interaction.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/device/interaction_methods/__init__.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/device/interaction_methods/adb.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/device/interaction_methods/base.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/device/interaction_methods/browser.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/device/interaction_methods/do_nothing.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/device/interaction_methods/foreground_post_message.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/device/interaction_methods/genshin.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/device/interaction_methods/keys.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/device/interaction_methods/post_message.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/device/interaction_methods/pydirect.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/device/interaction_methods/pynput.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/device/interaction_methods/swipe.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/device/intercation.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/feature/Box.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/feature/Feature.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/feature/FeatureSet.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/feature/__init__.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/gui/__init__.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/gui/util/pyappify_startup.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/notification/__init__.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/notification/manager.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/notification/messenger_images.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/notification/pipeline.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/notification/ppocr.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/notification/providers.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/notification/system.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/notification/windows_messenger.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ocr/__init__.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ocr/download_paddle_model.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/rotypes/Windows/Foundation/Collections.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/rotypes/Windows/Foundation/__init__.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/rotypes/Windows/Globalization/__init__.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/rotypes/Windows/Graphics/Capture/__init__.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/rotypes/Windows/Graphics/DirectX/Direct3D11/__init__.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/rotypes/Windows/Graphics/DirectX/__init__.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/rotypes/Windows/Graphics/Imaging/__init__.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/rotypes/Windows/Graphics/__init__.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/rotypes/Windows/Media/Ocr/__init__.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/rotypes/Windows/Media/__init__.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/rotypes/Windows/Security/Cryptography/__init__.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/rotypes/Windows/Security/__init__.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/rotypes/Windows/Storage/Streams/__init__.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/rotypes/Windows/Storage/__init__.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/rotypes/Windows/UI/ViewManagement/__init__.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/rotypes/Windows/UI/__init__.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/rotypes/Windows/__init__.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/rotypes/__init__.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/rotypes/delegate.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/rotypes/export.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/rotypes/idldsl.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/rotypes/inspectable.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/rotypes/roapi.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/rotypes/types.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/rotypes/winstring.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/task/DiagnosisTask.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/task/TaskExecutor.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/task/__init__.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/task/task.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/task/web.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/test/OKTestRunner.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/test/RunTests.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/test/TaskTestCase.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/test/__init__.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/third_party/__init__.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/third_party/paperclip.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/__init__.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/overlay/__init__.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/overlay/win32_gdi.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/Communicate.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/MainWindow.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/MessageWindow.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/StartController.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/TabTitles.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/__init__.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/about/AboutTab.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/about/HttpTextEdit.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/about/LinksBar.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/about/ProjectCard.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/about/UpdateCard.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/about/VersionCard.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/about/__init__.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/common/OKIcon.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/common/__init__.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/common/accent_color.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/common/config.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/common/design_system.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/common/icons.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/common/style_sheet.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/debug/DebugTab.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/debug/OverlayWidget.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/debug/RunCodeTab.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/debug/Screenshot.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/debug/__init__.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/events.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/i18n/GettextTranslator.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/i18n/__init__.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/i18n/en_US.qm +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/i18n/en_US.ts +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/i18n/es_ES.qm +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/i18n/es_ES.ts +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/i18n/ja_JP.qm +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/i18n/ja_JP.ts +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/i18n/ko_KR.qm +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/i18n/ko_KR.ts +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/i18n/path.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/i18n/update.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/i18n/zh_CN.qm +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/i18n/zh_CN.ts +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/i18n/zh_TW.qm +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/i18n/zh_TW.ts +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/overlay/OverlayWindow.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/overlay/__init__.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/qss/__init__.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/qss/dark/card.qss +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/qss/dark/discord.svg +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/qss/dark/heart.svg +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/qss/dark/message_window.qss +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/qss/dark/setting_interface.qss +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/qss/dark/status_bar.qss +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/qss/dark/stop.svg +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/qss/dark/tab.qss +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/qss/light/card.qss +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/qss/light/discord.svg +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/qss/light/heart.svg +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/qss/light/message_window.qss +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/qss/light/setting_interface.qss +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/qss/light/status_bar.qss +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/qss/light/stop.svg +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/qss/light/tab.qss +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/qt.qrc +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/resources.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/settings/GlobalConfigCard.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/settings/GlobalConfigTab.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/settings/SettingTab.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/settings/__init__.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/start/LogWindow.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/start/SelectCaptureListView.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/start/SelectInteractionListView.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/start/StartCard.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/start/StartTab.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/start/__init__.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/tasks/ConfigCard.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/tasks/ConfigItemFactory.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/tasks/ConfigLabelAndWidget.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/tasks/EditTaskTab.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/tasks/LabelAndButtons.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/tasks/LabelAndDoubleSpinBox.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/tasks/LabelAndDropDown.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/tasks/LabelAndFileSelector.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/tasks/LabelAndGlobal.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/tasks/LabelAndLineEdit.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/tasks/LabelAndList.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/tasks/LabelAndMultiSelection.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/tasks/LabelAndSpinBox.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/tasks/LabelAndSwitchButton.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/tasks/LabelAndTextEdit.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/tasks/LabelAndWidget.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/tasks/MarkUpWindow.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/tasks/ModifyListDialog.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/tasks/ModifyListItem.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/tasks/OneTimeTaskTab.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/tasks/PythonHighlighter.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/tasks/RecordScript.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/tasks/ScheduleTaskTab.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/tasks/ScriptPackager.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/tasks/StartButton.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/tasks/TaskCard.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/tasks/TaskManger.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/tasks/TaskOpButton.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/tasks/TaskTab.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/tasks/TemplateFactory.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/tasks/TemplateTab.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/tasks/TooltipTableWidget.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/tasks/TriggerTaskTab.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/tasks/__init__.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/tasks/schedule_index_sync.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/util/Alert.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/util/InitWorker.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/util/__init__.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/util/app.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/util/download.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/util/pip_util.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/util/pyappify_startup.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/util/touch_scroll.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/util/windows_thumbnail.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/widget/BaseLoading.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/widget/BaseWindow.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/widget/Card.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/widget/CustomTab.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/widget/EmptyCard.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/widget/ExpandCardLayout.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/widget/FlowLayout.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/widget/FramelessDialog.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/widget/ImageWidget.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/widget/ListTableWidgetItem.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/widget/NumericTableWidgetItem.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/widget/OkCompactSpinBox.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/widget/SortingTableWidgetItem.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/widget/StartLoadingDialog.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/widget/StatusBar.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/widget/Tab.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/widget/TabWidget.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/widget/UpdateConfigWidgetItem.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/widget/WidgetWithVLabel.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/widget/YesNonWidgetItem.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/qt/widget/__init__.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/web/__init__.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/web/app.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/web/requirements.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/web/server.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/web/static/app.js +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/web/static/chunk-fluent.js +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/web/static/chunk-react.js +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/web/static/index.css +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/ui/web/static/index.html +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/update/__init__.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/update/copy_ok_folder.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/update/inline_ok_requirements.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/util/Analytics.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/util/GlobalConfig.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/util/__init__.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/util/blur.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/util/clazz.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/util/collection.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/util/color.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/util/config.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/util/explorer.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/util/file.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/util/gpu_driver_settings.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/util/handler.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/util/i18n.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/util/logger.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/util/partial_sync_repo.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/util/print_hwnd.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/util/process.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/util/window.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok/util/windows_schedule.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok_script.egg-info/SOURCES.txt +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok_script.egg-info/dependency_links.txt +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok_script.egg-info/entry_points.txt +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok_script.egg-info/not-zip-safe +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok_script.egg-info/requires.txt +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/ok_script.egg-info/top_level.txt +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/pyproject.toml +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/scripts/generate_web_i18n.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/setup.cfg +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/setup.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/tests/test_accent_color.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/tests/test_app.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/tests/test_base_interaction.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/tests/test_blur.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/tests/test_box.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/tests/test_cli.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/tests/test_config_card.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/tests/test_core_events.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/tests/test_core_ui_services.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/tests/test_device_manager.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/tests/test_expand_card_layout.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/tests/test_explorer.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/tests/test_global_config.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/tests/test_gpu_driver_settings.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/tests/test_handler.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/tests/test_headless_imports.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/tests/test_inline_ok_requirements.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/tests/test_logger.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/tests/test_main_window_notifications.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/tests/test_main_window_startup_tab.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/tests/test_main_window_system_theme.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/tests/test_missing_frame.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/tests/test_navigation_state.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/tests/test_nemu_ipc_capture.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/tests/test_notifications.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/tests/test_ok_mutex.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/tests/test_overlay_custom_draw.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/tests/test_overlay_lifecycle.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/tests/test_package_metadata.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/tests/test_process.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/tests/test_process_mutex.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/tests/test_pyappify_startup_update.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/tests/test_qt_events.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/tests/test_qt_legacy_imports.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/tests/test_qt_page_layout.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/tests/test_runtime_startup.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/tests/test_schedule_startup.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/tests/test_schedule_task_index_sync.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/tests/test_start_tab_overlay.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/tests/test_task_executor_queue.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/tests/test_task_ui.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/tests/test_template_tab.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/tests/test_touch_scroll.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/tests/test_translation_fallback.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/tests/test_ui_config.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/tests/test_web_app.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/tests/test_web_i18n.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/tests/test_web_server.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/tests/test_web_task_tabs.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/tests/test_web_ui_pages.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/tests/test_web_ui_tasks.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/tests/test_windows_schedule_target_parse.py +0 -0
- {ok_script-2.0.8 → ok_script-2.0.10}/tests/test_windows_schedule_xml.py +0 -0
|
@@ -12,7 +12,7 @@ logger = Logger.get_logger(__name__)
|
|
|
12
12
|
|
|
13
13
|
class StartController:
|
|
14
14
|
STARTED_WINDOW_MIN_SIZE = (100, 100)
|
|
15
|
-
STARTED_WINDOW_STABLE_SECONDS =
|
|
15
|
+
STARTED_WINDOW_STABLE_SECONDS = 5
|
|
16
16
|
STARTED_WINDOW_POLL_INTERVAL = 0.2
|
|
17
17
|
|
|
18
18
|
def __init__(self, app_config, exit_event):
|
|
@@ -21,6 +21,8 @@ class StartController:
|
|
|
21
21
|
self.handler = Handler(exit_event, __name__)
|
|
22
22
|
self.start_timeout = app_config.get('start_timeout', 60)
|
|
23
23
|
windows_config = app_config.get('windows') or {}
|
|
24
|
+
self.window_stable_seconds = windows_config.get(
|
|
25
|
+
'window_stable_seconds', self.STARTED_WINDOW_STABLE_SECONDS)
|
|
24
26
|
self.start_exe = windows_config.get('start_exe', True)
|
|
25
27
|
self.start_method = windows_config.get('start_method', WINDOWS_START_METHOD_START)
|
|
26
28
|
self.starting = False
|
|
@@ -161,8 +163,8 @@ class StartController:
|
|
|
161
163
|
logger.info(f'waiting for started window to stabilize, current size {size[0]}x{size[1]}')
|
|
162
164
|
stable_size = size
|
|
163
165
|
stable_since = now
|
|
164
|
-
elif now - stable_since >= self.
|
|
165
|
-
logger.info(f'started window size stable for {self.
|
|
166
|
+
elif now - stable_since >= self.window_stable_seconds:
|
|
167
|
+
logger.info(f'started window size stable for {self.window_stable_seconds}s: {size[0]}x{size[1]}')
|
|
166
168
|
return True
|
|
167
169
|
else:
|
|
168
170
|
stable_size = None
|
|
@@ -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,11 +163,15 @@ class WindowsGraphicsCaptureMethod(BaseWindowsCaptureMethod):
|
|
|
157
163
|
return 0
|
|
158
164
|
|
|
159
165
|
def start_or_stop(self, capture_cursor=False):
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
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')
|
|
165
175
|
try:
|
|
166
176
|
return self._start_or_stop(capture_cursor)
|
|
167
177
|
finally:
|
|
@@ -306,16 +316,37 @@ class WindowsGraphicsCaptureMethod(BaseWindowsCaptureMethod):
|
|
|
306
316
|
self.capture_target_signature = None
|
|
307
317
|
|
|
308
318
|
def do_get_frame(self):
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
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')
|
|
313
326
|
try:
|
|
314
327
|
return self._do_get_frame()
|
|
315
328
|
finally:
|
|
316
329
|
self.get_frame_lock.release()
|
|
317
330
|
|
|
318
|
-
def
|
|
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()
|
|
348
|
+
|
|
349
|
+
def _do_get_frame(self, frame_deadline=None):
|
|
319
350
|
if self.exit_event.is_set():
|
|
320
351
|
return None
|
|
321
352
|
if self.start_or_stop():
|
|
@@ -324,7 +355,7 @@ class WindowsGraphicsCaptureMethod(BaseWindowsCaptureMethod):
|
|
|
324
355
|
logger.warning('no frame for 10 sec, try to restart')
|
|
325
356
|
self.close()
|
|
326
357
|
self.last_frame_time = time.time()
|
|
327
|
-
return self._do_get_frame()
|
|
358
|
+
return self._do_get_frame(frame_deadline=frame_deadline)
|
|
328
359
|
|
|
329
360
|
# A frame left by a request that timed out is not necessarily the
|
|
330
361
|
# latest frame anymore. Every call starts a fresh request instead of
|
|
@@ -336,7 +367,9 @@ class WindowsGraphicsCaptureMethod(BaseWindowsCaptureMethod):
|
|
|
336
367
|
self.frame_event.clear()
|
|
337
368
|
self.frame_requested.set()
|
|
338
369
|
|
|
339
|
-
deadline =
|
|
370
|
+
deadline = frame_deadline
|
|
371
|
+
if deadline is None:
|
|
372
|
+
deadline = time.monotonic() + WGC_FRAME_WAIT_TIMEOUT
|
|
340
373
|
while frame is None:
|
|
341
374
|
if self.exit_event.is_set():
|
|
342
375
|
with self.lock:
|
|
@@ -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
|
|
@@ -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()
|
|
@@ -40,7 +40,7 @@ class TestStartController(unittest.TestCase):
|
|
|
40
40
|
controller.start_timeout = 20
|
|
41
41
|
controller.config = {}
|
|
42
42
|
controller.start_method = 'start'
|
|
43
|
-
controller.
|
|
43
|
+
controller.window_stable_seconds = 2
|
|
44
44
|
controller.STARTED_WINDOW_POLL_INTERVAL = 1
|
|
45
45
|
controller.starting = False
|
|
46
46
|
return controller
|
|
@@ -94,7 +94,7 @@ class TestStartController(unittest.TestCase):
|
|
|
94
94
|
|
|
95
95
|
def test_started_window_wait_does_not_restart_countdown(self):
|
|
96
96
|
controller = self.make_controller()
|
|
97
|
-
controller.
|
|
97
|
+
controller.window_stable_seconds = 1
|
|
98
98
|
controller.STARTED_WINDOW_POLL_INTERVAL = 0.2
|
|
99
99
|
window = FakeWindow([(120, 120)] * 6)
|
|
100
100
|
clock = FakeClock()
|
|
@@ -10,6 +10,7 @@ import ok.device.capture_methods.windows_graphics as windows_graphics_module
|
|
|
10
10
|
from ok.device.capture_methods.browser import BrowserWindowAdapter
|
|
11
11
|
from ok.device.capture_methods.hwnd_window import HwndWindow
|
|
12
12
|
from ok.device.capture_methods.windows_graphics import WindowsGraphicsCaptureMethod
|
|
13
|
+
from ok.task.exceptions import CaptureBusyException
|
|
13
14
|
|
|
14
15
|
|
|
15
16
|
class _FakeFrame:
|
|
@@ -68,7 +69,7 @@ class TestWindowsGraphicsCaptureLifecycle(unittest.TestCase):
|
|
|
68
69
|
method.last_start_failure_time = time.time()
|
|
69
70
|
return method
|
|
70
71
|
|
|
71
|
-
def
|
|
72
|
+
def test_busy_target_change_is_deferred_without_holding_capture_lock(self):
|
|
72
73
|
method = self._method()
|
|
73
74
|
pool = method.frame_pool
|
|
74
75
|
results = []
|
|
@@ -94,15 +95,24 @@ class TestWindowsGraphicsCaptureLifecycle(unittest.TestCase):
|
|
|
94
95
|
|
|
95
96
|
self.assertTrue(acquired, 'startup held the capture lock while waiting for a frame request')
|
|
96
97
|
self.assertFalse(worker.is_alive())
|
|
97
|
-
self.assertEqual([],
|
|
98
|
-
self.assertEqual(
|
|
98
|
+
self.assertEqual([], results)
|
|
99
|
+
self.assertEqual(1, len(errors))
|
|
100
|
+
self.assertIsInstance(errors[0], CaptureBusyException)
|
|
101
|
+
pool.Close.assert_not_called()
|
|
102
|
+
self.assertIs(pool, method.frame_pool)
|
|
103
|
+
|
|
104
|
+
# Once the request owner releases its lock, the refresh can safely
|
|
105
|
+
# close the old target and retry the new one.
|
|
106
|
+
self.assertFalse(method.start_or_stop())
|
|
99
107
|
pool.Close.assert_called_once()
|
|
100
108
|
self.assertIsNone(method.frame_pool)
|
|
101
109
|
|
|
102
|
-
def
|
|
110
|
+
def test_busy_capture_reports_retryable_busy_without_entering_capture(self):
|
|
103
111
|
for operation in ('start_or_stop', 'do_get_frame'):
|
|
104
112
|
with self.subTest(operation=operation):
|
|
105
113
|
method = self._method()
|
|
114
|
+
method._start_or_stop = Mock()
|
|
115
|
+
method._do_get_frame = Mock()
|
|
106
116
|
errors = []
|
|
107
117
|
|
|
108
118
|
def call():
|
|
@@ -117,8 +127,41 @@ class TestWindowsGraphicsCaptureLifecycle(unittest.TestCase):
|
|
|
117
127
|
worker.join(.5)
|
|
118
128
|
self.assertFalse(worker.is_alive())
|
|
119
129
|
self.assertEqual(1, len(errors))
|
|
120
|
-
self.assertIsInstance(errors[0],
|
|
130
|
+
self.assertIsInstance(errors[0], CaptureBusyException)
|
|
121
131
|
self.assertIn('Windows Graphics Capture is busy', str(errors[0]))
|
|
132
|
+
method._start_or_stop.assert_not_called()
|
|
133
|
+
method._do_get_frame.assert_not_called()
|
|
134
|
+
|
|
135
|
+
def test_busy_frame_probe_propagates_busy_without_entering_capture(self):
|
|
136
|
+
method = self._method()
|
|
137
|
+
method._do_get_frame = Mock()
|
|
138
|
+
errors = []
|
|
139
|
+
|
|
140
|
+
def probe():
|
|
141
|
+
try:
|
|
142
|
+
method.get_frame_for_probe(.01)
|
|
143
|
+
except Exception as error:
|
|
144
|
+
errors.append(error)
|
|
145
|
+
|
|
146
|
+
with method.get_frame_lock:
|
|
147
|
+
worker = threading.Thread(target=probe, daemon=True)
|
|
148
|
+
worker.start()
|
|
149
|
+
worker.join(.5)
|
|
150
|
+
self.assertFalse(worker.is_alive())
|
|
151
|
+
|
|
152
|
+
self.assertEqual(1, len(errors))
|
|
153
|
+
self.assertIsInstance(errors[0], CaptureBusyException)
|
|
154
|
+
method._do_get_frame.assert_not_called()
|
|
155
|
+
|
|
156
|
+
def test_busy_window_setter_defers_refresh(self):
|
|
157
|
+
method = self._method()
|
|
158
|
+
method.start_or_stop = Mock(side_effect=CaptureBusyException('busy'))
|
|
159
|
+
window = object()
|
|
160
|
+
|
|
161
|
+
method.hwnd_window = window
|
|
162
|
+
|
|
163
|
+
self.assertIs(window, method.hwnd_window)
|
|
164
|
+
method.start_or_stop.assert_called_once()
|
|
122
165
|
|
|
123
166
|
def test_frame_request_can_restart_changed_target_without_deadlocking_itself(self):
|
|
124
167
|
method = self._method()
|
|
@@ -331,6 +374,24 @@ class TestWindowsGraphicsCaptureGetFrame(unittest.TestCase):
|
|
|
331
374
|
self.assertFalse(method.frame_requested.is_set())
|
|
332
375
|
self.assertIsNone(method.last_frame)
|
|
333
376
|
|
|
377
|
+
def test_probe_uses_outer_deadline_after_waiting_for_request_lock(self):
|
|
378
|
+
method = self._method(_FakeFrame())
|
|
379
|
+
method.get_frame_lock = Mock()
|
|
380
|
+
method.get_frame_lock.acquire.return_value = True
|
|
381
|
+
method.frame_event.wait = Mock()
|
|
382
|
+
|
|
383
|
+
# The lock consumes 0.1s of the 0.25s budget. The frame loop must
|
|
384
|
+
# still expire at 10.25, rather than starting a new four-second wait.
|
|
385
|
+
with patch.object(windows_graphics_module.time, 'monotonic',
|
|
386
|
+
side_effect=[10.0, 10.1, 10.25]):
|
|
387
|
+
result = method.get_frame_for_probe(.25)
|
|
388
|
+
|
|
389
|
+
self.assertIsNone(result)
|
|
390
|
+
method.get_frame_lock.acquire.assert_called_once_with(timeout=.25)
|
|
391
|
+
method.get_frame_lock.release.assert_called_once()
|
|
392
|
+
method.frame_event.wait.assert_called_once_with(.05)
|
|
393
|
+
self.assertFalse(method.frame_requested.is_set())
|
|
394
|
+
|
|
334
395
|
def test_exit_event_interrupts_pending_frame_wait(self):
|
|
335
396
|
method = self._method(_FakeFrame())
|
|
336
397
|
method.last_frame = None
|
|
@@ -373,26 +434,28 @@ class TestWindowsGraphicsCaptureGetFrame(unittest.TestCase):
|
|
|
373
434
|
values = iter((2, 3))
|
|
374
435
|
method.convert_dx_frame = lambda _frame: np.full((2, 2, 3), next(values), dtype=np.uint8)
|
|
375
436
|
|
|
376
|
-
def deliver_frames():
|
|
377
|
-
for _ in range(2):
|
|
378
|
-
if not method.frame_requested.wait(1):
|
|
379
|
-
return
|
|
380
|
-
method.frame_arrived_callback()
|
|
381
|
-
|
|
382
|
-
producer = threading.Thread(target=deliver_frames)
|
|
383
|
-
producer.start()
|
|
384
437
|
results = []
|
|
385
438
|
with patch.object(windows_graphics_module, 'composite_hwnds', side_effect=lambda captured, *_: captured):
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
439
|
+
consumer = threading.Thread(target=lambda: results.append(method.do_get_frame()))
|
|
440
|
+
consumer.start()
|
|
441
|
+
self.assertTrue(method.frame_requested.wait(1))
|
|
442
|
+
|
|
443
|
+
# Normal consumers retry when busy without cancelling or consuming
|
|
444
|
+
# the request already owned by the first caller.
|
|
445
|
+
self.assertIsNone(method.get_frame())
|
|
446
|
+
self.assertTrue(method.frame_requested.is_set())
|
|
447
|
+
method.frame_arrived_callback()
|
|
448
|
+
consumer.join(1)
|
|
449
|
+
self.assertFalse(consumer.is_alive())
|
|
450
|
+
|
|
451
|
+
producer = threading.Thread(target=lambda: (
|
|
452
|
+
method.frame_requested.wait(1) and method.frame_arrived_callback()))
|
|
453
|
+
producer.start()
|
|
454
|
+
results.append(method.do_get_frame())
|
|
455
|
+
producer.join(1)
|
|
392
456
|
|
|
393
|
-
self.assertTrue(all(not consumer.is_alive() for consumer in consumers))
|
|
394
457
|
self.assertFalse(producer.is_alive())
|
|
395
|
-
self.assertEqual([2, 3],
|
|
458
|
+
self.assertEqual([2, 3], [int(result[0, 0, 0]) for result in results])
|
|
396
459
|
|
|
397
460
|
if __name__ == '__main__':
|
|
398
461
|
unittest.main()
|