ok-script 3.0.2__tar.gz → 3.0.4__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-3.0.2 → ok_script-3.0.4}/PKG-INFO +1 -1
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/ui/qt/MainWindow.py +15 -4
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/ui/qt/kit/__init__.py +2 -1
- ok_script-3.0.4/ok/ui/qt/kit/motion.py +201 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/ui/qt/kit/navigation.py +134 -10
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/ui/qt/kit/qss.py +6 -5
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/ui/qt/kit/tabs.py +57 -3
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/ui/qt/plugins/imported_tabs.py +3 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/ui/qt/tasks/tasks_page.py +3 -2
- {ok_script-3.0.2 → ok_script-3.0.4}/ok_script.egg-info/PKG-INFO +1 -1
- {ok_script-3.0.2 → ok_script-3.0.4}/ok_script.egg-info/SOURCES.txt +1 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/tests/test_plugin_tabs.py +2 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/.agents/skills/develop/SKILL.md +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/.agents/skills/develop/agents/openai.yaml +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/.agents/skills/develop/references/windows-input.md +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/.agents/skills/generate-templates/SKILL.md +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/.agents/skills/reload-tasks/SKILL.md +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/.agents/skills/reload-tasks/agents/openai.yaml +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/.agents/skills/setup-env/SKILL.md +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/.agents/skills/setup-env/agents/openai.yaml +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/.agents/skills/setup-env/assets/ok-script-develop/SKILL.md +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/.agents/skills/setup-project/SKILL.md +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/.agents/skills/setup-project/agents/openai.yaml +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/.agents/skills/use_venv/SKILL.md +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/.agents/skills/write-test/SKILL.md +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/.agents/skills/write-test/agents/openai.yaml +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/LICENSE.txt +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/MANIFEST.in +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/README.md +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/diagnostics/qq_trace.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/docs/agent-setup.md +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/docs/feature-crops.md +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/docs/mcp.md +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/examples/mcp_observe.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/__init__.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/__main__.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/alas/__init__.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/alas/emulator_base.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/alas/emulator_windows.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/alas/platform_windows.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/alas/utils.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/assets/default-icon.png +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/capture/__init__.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/capture/adb/__init__.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/capture/adb/deep.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/capture/adb/minitouch.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/capture/adb/nemu_ipc.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/capture/adb/nemu_utils.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/capture/adb/pool.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/capture/adb/timer.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/capture/adb/util.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/capture/windows/__init__.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/capture/windows/d3d11.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/capture/windows/dump.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/cli.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/core/__init__.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/core/capture_labels.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/core/code_runner.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/core/config_schema.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/core/downloads.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/core/events.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/core/icons.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/core/mcp_runner.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/core/mcp_server.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/core/notifications.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/core/plugin_staging.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/core/plugins.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/core/screenshot.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/core/script_editing.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/core/script_packager.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/core/script_templates.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/core/skills.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/core/start_controller.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/core/task_manager.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/core/template_store.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/core/translation.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/core/ui_config.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/device/DeviceManager.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/device/__init__.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/device/capture.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/device/capture_methods/__init__.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/device/capture_methods/adb.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/device/capture_methods/base.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/device/capture_methods/bitblt.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/device/capture_methods/bitblt_utils.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/device/capture_methods/browser.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/device/capture_methods/desktop_duplication.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/device/capture_methods/hwnd_window.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/device/capture_methods/image.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/device/capture_methods/nemu_ipc.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/device/capture_methods/types.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/device/capture_methods/update.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/device/capture_methods/windows_graphics.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/device/capture_methods/windows_graphics_hdr.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/device/interaction.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/device/interaction_methods/__init__.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/device/interaction_methods/adb.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/device/interaction_methods/base.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/device/interaction_methods/browser.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/device/interaction_methods/do_nothing.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/device/interaction_methods/foreground_post_message.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/device/interaction_methods/genshin.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/device/interaction_methods/keys.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/device/interaction_methods/post_message.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/device/interaction_methods/pydirect.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/device/interaction_methods/pynput.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/device/interaction_methods/swipe.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/device/intercation.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/feature/Box.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/feature/Feature.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/feature/FeatureSet.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/feature/__init__.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/gui/__init__.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/gui/util/pyappify_startup.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/notification/__init__.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/notification/manager.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/notification/messenger_images.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/notification/pipeline.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/notification/ppocr.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/notification/providers.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/notification/system.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/notification/windows_messenger.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/ocr/__init__.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/ocr/download_paddle_model.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/rotypes/Windows/Foundation/Collections.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/rotypes/Windows/Foundation/__init__.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/rotypes/Windows/Globalization/__init__.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/rotypes/Windows/Graphics/Capture/__init__.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/rotypes/Windows/Graphics/DirectX/Direct3D11/__init__.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/rotypes/Windows/Graphics/DirectX/__init__.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/rotypes/Windows/Graphics/Imaging/__init__.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/rotypes/Windows/Graphics/__init__.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/rotypes/Windows/Media/Ocr/__init__.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/rotypes/Windows/Media/__init__.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/rotypes/Windows/Security/Cryptography/__init__.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/rotypes/Windows/Security/__init__.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/rotypes/Windows/Storage/Streams/__init__.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/rotypes/Windows/Storage/__init__.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/rotypes/Windows/UI/ViewManagement/__init__.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/rotypes/Windows/UI/__init__.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/rotypes/Windows/__init__.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/rotypes/__init__.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/rotypes/delegate.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/rotypes/export.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/rotypes/idldsl.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/rotypes/inspectable.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/rotypes/roapi.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/rotypes/types.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/rotypes/winstring.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/task/DiagnosisTask.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/task/TaskExecutor.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/task/__init__.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/task/exceptions.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/task/task.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/test/OKTestRunner.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/test/RunTests.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/test/TaskTestCase.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/test/__init__.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/third_party/__init__.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/third_party/paperclip.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/ui/__init__.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/ui/overlay/__init__.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/ui/overlay/win32_gdi.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/ui/qt/Communicate.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/ui/qt/MessageWindow.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/ui/qt/StartController.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/ui/qt/__init__.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/ui/qt/about/AboutTab.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/ui/qt/about/UpdateCard.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/ui/qt/about/__init__.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/ui/qt/common/__init__.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/ui/qt/common/config.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/ui/qt/debug/OverlayWidget.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/ui/qt/debug/Screenshot.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/ui/qt/debug/__init__.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/ui/qt/debug/diagnosis_page.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/ui/qt/events.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/ui/qt/i18n/GettextTranslator.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/ui/qt/i18n/__init__.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/ui/qt/i18n/en_US.qm +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/ui/qt/i18n/en_US.ts +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/ui/qt/i18n/es_ES.qm +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/ui/qt/i18n/es_ES.ts +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/ui/qt/i18n/ja_JP.qm +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/ui/qt/i18n/ja_JP.ts +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/ui/qt/i18n/ko_KR.qm +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/ui/qt/i18n/ko_KR.ts +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/ui/qt/i18n/path.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/ui/qt/i18n/update.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/ui/qt/i18n/zh_CN.qm +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/ui/qt/i18n/zh_CN.ts +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/ui/qt/i18n/zh_TW.qm +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/ui/qt/i18n/zh_TW.ts +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/ui/qt/kit/buttons.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/ui/qt/kit/cards.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/ui/qt/kit/dialogs.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/ui/qt/kit/feedback.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/ui/qt/kit/gallery.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/ui/qt/kit/icons.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/ui/qt/kit/inputs.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/ui/qt/kit/labels.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/ui/qt/kit/layout.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/ui/qt/kit/mica.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/ui/qt/kit/options.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/ui/qt/kit/popover.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/ui/qt/kit/switch.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/ui/qt/kit/theme.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/ui/qt/kit/window.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/ui/qt/overlay/OverlayWindow.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/ui/qt/overlay/__init__.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/ui/qt/plugins/PluginTab.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/ui/qt/plugins/__init__.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/ui/qt/qt.qrc +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/ui/qt/resources.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/ui/qt/settings/GlobalConfigTab.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/ui/qt/settings/__init__.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/ui/qt/settings/config_section.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/ui/qt/settings/settings_page.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/ui/qt/shell/__init__.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/ui/qt/shell/connection.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/ui/qt/shell/diagnostics.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/ui/qt/shell/lazy_page.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/ui/qt/shell/log_page.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/ui/qt/shell/nav_icons.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/ui/qt/shell/run_bar.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/ui/qt/start/__init__.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/ui/qt/tasks/EditTaskTab.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/ui/qt/tasks/MarkUpWindow.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/ui/qt/tasks/ModifyListDialog.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/ui/qt/tasks/PythonHighlighter.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/ui/qt/tasks/RecordScript.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/ui/qt/tasks/ScheduleTaskTab.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/ui/qt/tasks/ScriptPackager.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/ui/qt/tasks/TaskManger.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/ui/qt/tasks/TaskOpButton.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/ui/qt/tasks/TemplateFactory.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/ui/qt/tasks/TemplateTab.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/ui/qt/tasks/__init__.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/ui/qt/tasks/config_editors.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/ui/qt/tasks/config_form.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/ui/qt/tasks/mouse_buttons.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/ui/qt/tasks/schedule_index_sync.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/ui/qt/util/Alert.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/ui/qt/util/InitWorker.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/ui/qt/util/__init__.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/ui/qt/util/app.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/ui/qt/util/download.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/ui/qt/util/pip_util.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/ui/qt/util/pyappify_startup.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/ui/qt/util/touch_scroll.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/ui/qt/util/windows_thumbnail.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/ui/qt/widget/Card.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/ui/qt/widget/CustomTab.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/ui/qt/widget/FlowLayout.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/ui/qt/widget/ImageWidget.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/ui/qt/widget/ImportWarningDialog.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/ui/qt/widget/ListTableWidgetItem.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/ui/qt/widget/NumericTableWidgetItem.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/ui/qt/widget/SortingTableWidgetItem.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/ui/qt/widget/StartLoadingDialog.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/ui/qt/widget/Tab.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/ui/qt/widget/TabWidget.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/ui/qt/widget/UpdateConfigWidgetItem.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/ui/qt/widget/YesNonWidgetItem.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/ui/qt/widget/__init__.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/update/__init__.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/update/copy_ok_folder.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/update/inline_ok_requirements.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/util/Analytics.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/util/GlobalConfig.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/util/__init__.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/util/blur.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/util/clazz.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/util/collection.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/util/color.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/util/config.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/util/explorer.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/util/file.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/util/gpu_driver_settings.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/util/handler.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/util/i18n.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/util/logger.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/util/partial_sync_repo.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/util/print_hwnd.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/util/process.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/util/version.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/util/window.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok/util/windows_schedule.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok_script.egg-info/dependency_links.txt +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok_script.egg-info/entry_points.txt +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok_script.egg-info/not-zip-safe +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok_script.egg-info/requires.txt +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/ok_script.egg-info/top_level.txt +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/pyproject.toml +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/setup.cfg +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/setup.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/tests/test_app.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/tests/test_base_interaction.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/tests/test_blur.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/tests/test_box.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/tests/test_capture_update.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/tests/test_cli.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/tests/test_core_events.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/tests/test_core_ui_services.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/tests/test_device_manager.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/tests/test_diagnosis_page.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/tests/test_executor_jobs.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/tests/test_explorer.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/tests/test_global_config.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/tests/test_gpu_driver_settings.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/tests/test_handler.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/tests/test_headless_imports.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/tests/test_inline_ok_requirements.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/tests/test_kit.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/tests/test_lazy_page.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/tests/test_log_page.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/tests/test_logger.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/tests/test_main_window_notifications.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/tests/test_main_window_startup_tab.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/tests/test_main_window_system_theme.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/tests/test_markup_window.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/tests/test_mcp_cleanup.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/tests/test_mcp_runner.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/tests/test_mcp_server.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/tests/test_mcp_setting.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/tests/test_missing_frame.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/tests/test_mouse_buttons.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/tests/test_navigation_state.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/tests/test_nemu_ipc_capture.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/tests/test_notifications.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/tests/test_ok_mutex.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/tests/test_overlay_custom_draw.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/tests/test_overlay_lifecycle.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/tests/test_package_metadata.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/tests/test_plugin_staging.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/tests/test_plugins.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/tests/test_process.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/tests/test_process_mutex.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/tests/test_pyappify_startup_update.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/tests/test_qt_events.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/tests/test_qt_page_layout.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/tests/test_runtime_startup.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/tests/test_schedule_startup.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/tests/test_schedule_task_index_sync.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/tests/test_screenshot_naming.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/tests/test_screenshot_rendering.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/tests/test_settings_page.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/tests/test_shell.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/tests/test_skills.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/tests/test_start_controller.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/tests/test_task_executor_next_frame.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/tests/test_task_executor_queue.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/tests/test_task_reloading.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/tests/test_tasks_page.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/tests/test_template_compression.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/tests/test_template_generation.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/tests/test_template_tab.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/tests/test_touch_scroll.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/tests/test_translation_fallback.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/tests/test_ui_config.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/tests/test_version.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/tests/test_windows_graphics_capture.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/tests/test_windows_graphics_hdr.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/tests/test_windows_schedule_target_parse.py +0 -0
- {ok_script-3.0.2 → ok_script-3.0.4}/tests/test_windows_schedule_xml.py +0 -0
|
@@ -4,7 +4,7 @@ import threading
|
|
|
4
4
|
import pyappify
|
|
5
5
|
from PySide6.QtCore import QCoreApplication, QEvent, QObject, QSize, Qt, QTimer
|
|
6
6
|
from PySide6.QtGui import QColor
|
|
7
|
-
from PySide6.QtWidgets import QApplication, QHBoxLayout, QMenu,
|
|
7
|
+
from PySide6.QtWidgets import QApplication, QHBoxLayout, QMenu, QSystemTrayIcon, QVBoxLayout
|
|
8
8
|
|
|
9
9
|
_pyappify_stop_lock = threading.Lock()
|
|
10
10
|
|
|
@@ -31,8 +31,9 @@ from ok.util.config import Config
|
|
|
31
31
|
|
|
32
32
|
from ok.ui.qt.Communicate import communicate
|
|
33
33
|
from ok.ui.qt.common.config import cfg as ui_config
|
|
34
|
-
from ok.ui.qt.kit import ContentLayer, Dialog,
|
|
34
|
+
from ok.ui.qt.kit import AnimatedStackedWidget, ContentLayer, Dialog,KitWindow, NavigationView, Theme as KitTheme, set_toast_anchor, show_toast, \
|
|
35
35
|
theme as kit_theme
|
|
36
|
+
from ok.ui.qt.kit.navigation import NAV_INDICATOR_DURATION
|
|
36
37
|
from ok.ui.qt.kit.theme import set_style_property
|
|
37
38
|
from ok.ui.qt.shell.lazy_page import LazyPage
|
|
38
39
|
from ok.ui.qt.shell.nav_icons import nav_icon
|
|
@@ -124,7 +125,7 @@ class MainWindow(KitWindow):
|
|
|
124
125
|
self.navigation.add_section(SECTION_DEVELOP, QCoreApplication.translate("MainWindow", "Develop"))
|
|
125
126
|
self.navigation.current_changed.connect(lambda key: self.switch_to(self._pages[key]))
|
|
126
127
|
self.navigation.compact_changed.connect(self._save_navigation_state)
|
|
127
|
-
self.stack =
|
|
128
|
+
self.stack = AnimatedStackedWidget(Qt.Orientation.Vertical)
|
|
128
129
|
# The run bar is a toolbar fused to the title bar, so the executor state is always in view.
|
|
129
130
|
self.run_bar = RunBar(exit_event)
|
|
130
131
|
set_style_property(self.title_bar, "fused", True)
|
|
@@ -317,10 +318,20 @@ class MainWindow(KitWindow):
|
|
|
317
318
|
def switch_to(self, widget):
|
|
318
319
|
if self.stack.indexOf(widget) < 0:
|
|
319
320
|
return
|
|
320
|
-
|
|
321
|
+
defer_build = isinstance(widget, LazyPage) and not widget.is_built() and self.isVisible()
|
|
322
|
+
if isinstance(widget, LazyPage) and not defer_build:
|
|
321
323
|
widget.page()
|
|
322
324
|
self.stack.setCurrentWidget(widget)
|
|
323
325
|
self.navigation.set_current(widget.objectName())
|
|
326
|
+
if defer_build:
|
|
327
|
+
# Building blocks the event loop, so let the selection highlight land first.
|
|
328
|
+
QTimer.singleShot(NAV_INDICATOR_DURATION + 20, lambda: self._build_lazy_page(widget))
|
|
329
|
+
|
|
330
|
+
def _build_lazy_page(self, widget):
|
|
331
|
+
if widget.is_built() or self.stack.currentWidget() is not widget:
|
|
332
|
+
return # already built, or the user moved on; it builds on the next visit
|
|
333
|
+
widget.page()
|
|
334
|
+
self.stack.animate_current()
|
|
324
335
|
|
|
325
336
|
def current_page(self):
|
|
326
337
|
return self.stack.currentWidget()
|
|
@@ -13,6 +13,7 @@ from ok.ui.qt.kit.icons import ICON_NAMES, icon, load_icon
|
|
|
13
13
|
from ok.ui.qt.kit.inputs import ComboBox, NumberBox
|
|
14
14
|
from ok.ui.qt.kit.labels import Label
|
|
15
15
|
from ok.ui.qt.kit.layout import FlowLayout
|
|
16
|
+
from ok.ui.qt.kit.motion import AnimatedStackedWidget
|
|
16
17
|
from ok.ui.qt.kit.navigation import NavigationView, NavItem
|
|
17
18
|
from ok.ui.qt.kit.options import OptionCard, OptionGroup
|
|
18
19
|
from ok.ui.qt.kit.popover import Popover
|
|
@@ -22,7 +23,7 @@ from ok.ui.qt.kit.theme import Theme, theme
|
|
|
22
23
|
from ok.ui.qt.kit.window import ContentLayer, KitWindow, TitleBar
|
|
23
24
|
|
|
24
25
|
__all__ = [
|
|
25
|
-
"Button", "Card", "ComboBox", "ContentLayer", "Dialog", "FlowLayout", "ICON_NAMES", "KitWindow", "Label",
|
|
26
|
+
"AnimatedStackedWidget", "Button", "Card", "ComboBox", "ContentLayer", "Dialog", "FlowLayout", "ICON_NAMES", "KitWindow", "Label",
|
|
26
27
|
"NavItem",
|
|
27
28
|
"NavigationView", "NumberBox", "OptionCard", "OptionGroup", "Pill", "Popover", "ProgressRing", "SettingGroup",
|
|
28
29
|
"SettingRow", "StatusDot", "Switch", "TabItem", "TabStrip", "Theme", "TitleBar", "Toast", "confirm", "icon",
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
"""Selection and page transitions shared by the kit's navigation widgets.
|
|
2
|
+
|
|
3
|
+
Both follow the Fluent motion guidance: a short decelerating ease, the
|
|
4
|
+
selection indicator travels from the old item to the new one, and the
|
|
5
|
+
incoming page enters with a small slide plus fade.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from PySide6.QtCore import QAbstractAnimation, QEasingCurve, QRect, QRectF, Qt, QVariantAnimation
|
|
9
|
+
from PySide6.QtGui import QPainter
|
|
10
|
+
from PySide6.QtWidgets import QGraphicsOpacityEffect, QStackedWidget, QWidget
|
|
11
|
+
|
|
12
|
+
INDICATOR_DURATION = 250
|
|
13
|
+
PAGE_DURATION = 250
|
|
14
|
+
PAGE_DISTANCE = 24
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def _lerp(a: float, b: float, t: float) -> float:
|
|
18
|
+
return a + (b - a) * t
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def _lerp_rect(a: QRectF, b: QRectF, t: float) -> QRectF:
|
|
22
|
+
return QRectF(_lerp(a.x(), b.x(), t), _lerp(a.y(), b.y(), t),
|
|
23
|
+
_lerp(a.width(), b.width(), t), _lerp(a.height(), b.height(), t))
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
class SlidingIndicator:
|
|
27
|
+
"""Tracks the selected item of ``host`` and glides between items.
|
|
28
|
+
|
|
29
|
+
``rect_for(item)`` returns the indicator's rect in ``host`` coordinates.
|
|
30
|
+
It is called on every paint, so the indicator follows the item while it
|
|
31
|
+
moves or resizes (scrolling, a collapsing sidebar). The host draws the
|
|
32
|
+
rect returned by :meth:`rect` in its ``paintEvent``.
|
|
33
|
+
"""
|
|
34
|
+
|
|
35
|
+
def __init__(self, host: QWidget, rect_for, duration: int = INDICATOR_DURATION):
|
|
36
|
+
self._host = host
|
|
37
|
+
self._rect_for = rect_for
|
|
38
|
+
self._item = None
|
|
39
|
+
self._start = None
|
|
40
|
+
self._progress = 1.0
|
|
41
|
+
self._animation = QVariantAnimation(host)
|
|
42
|
+
self._animation.setDuration(duration)
|
|
43
|
+
self._animation.setEasingCurve(QEasingCurve.Type.OutCubic)
|
|
44
|
+
self._animation.setStartValue(0.0)
|
|
45
|
+
self._animation.setEndValue(1.0)
|
|
46
|
+
self._animation.valueChanged.connect(self._on_progress)
|
|
47
|
+
|
|
48
|
+
def item(self):
|
|
49
|
+
return self._item
|
|
50
|
+
|
|
51
|
+
def set_item(self, item, animate: bool = True) -> None:
|
|
52
|
+
"""Move the indicator to ``item``; ``None`` hides it."""
|
|
53
|
+
|
|
54
|
+
if item is self._item:
|
|
55
|
+
return
|
|
56
|
+
start = self.rect()
|
|
57
|
+
self._animation.stop()
|
|
58
|
+
self._item = item
|
|
59
|
+
if animate and item is not None and start is not None and self._host.isVisible():
|
|
60
|
+
self._start = start
|
|
61
|
+
self._progress = 0.0
|
|
62
|
+
self._animation.start()
|
|
63
|
+
else:
|
|
64
|
+
self._start = None
|
|
65
|
+
self._progress = 1.0
|
|
66
|
+
self._host.update()
|
|
67
|
+
|
|
68
|
+
def rect(self):
|
|
69
|
+
"""The indicator's current rect in host coordinates, or ``None``."""
|
|
70
|
+
|
|
71
|
+
item = self._item
|
|
72
|
+
if item is None:
|
|
73
|
+
return None
|
|
74
|
+
try:
|
|
75
|
+
if not item.isVisibleTo(self._host):
|
|
76
|
+
return None
|
|
77
|
+
target = self._rect_for(item)
|
|
78
|
+
except RuntimeError: # the item was deleted
|
|
79
|
+
self._item = None
|
|
80
|
+
return None
|
|
81
|
+
if target is None:
|
|
82
|
+
return None
|
|
83
|
+
target = QRectF(target)
|
|
84
|
+
if self._start is None or self._progress >= 1.0:
|
|
85
|
+
return target
|
|
86
|
+
return _lerp_rect(self._start, target, self._progress)
|
|
87
|
+
|
|
88
|
+
def is_animating(self) -> bool:
|
|
89
|
+
return self._animation.state() == QAbstractAnimation.State.Running
|
|
90
|
+
|
|
91
|
+
def _on_progress(self, value) -> None:
|
|
92
|
+
self._progress = float(value)
|
|
93
|
+
if self._progress >= 1.0:
|
|
94
|
+
self._start = None
|
|
95
|
+
self._host.update()
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
def paint_rounded(widget: QWidget, rect: QRectF, radius: float, fill, border=None) -> None:
|
|
99
|
+
painter = QPainter(widget)
|
|
100
|
+
painter.setRenderHint(QPainter.RenderHint.Antialiasing)
|
|
101
|
+
if border is not None:
|
|
102
|
+
painter.setPen(border)
|
|
103
|
+
rect = rect.adjusted(0.5, 0.5, -0.5, -0.5)
|
|
104
|
+
else:
|
|
105
|
+
painter.setPen(Qt.PenStyle.NoPen)
|
|
106
|
+
painter.setBrush(fill)
|
|
107
|
+
painter.drawRoundedRect(rect, radius, radius)
|
|
108
|
+
painter.end()
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
class AnimatedStackedWidget(QStackedWidget):
|
|
112
|
+
"""A stacked widget whose incoming page slides in and fades in.
|
|
113
|
+
|
|
114
|
+
``orientation`` is ``Qt.Orientation.Vertical`` for page navigation
|
|
115
|
+
(the page rises into place) or ``Qt.Orientation.Horizontal`` for tabs
|
|
116
|
+
(the page enters from the side of the newly selected tab).
|
|
117
|
+
"""
|
|
118
|
+
|
|
119
|
+
def __init__(self, orientation=Qt.Orientation.Vertical, distance: int = PAGE_DISTANCE,
|
|
120
|
+
duration: int = PAGE_DURATION, parent=None):
|
|
121
|
+
super().__init__(parent)
|
|
122
|
+
self._orientation = orientation
|
|
123
|
+
self._distance = distance
|
|
124
|
+
self._page = None
|
|
125
|
+
self._sign = 1
|
|
126
|
+
self._animation = QVariantAnimation(self)
|
|
127
|
+
self._animation.setDuration(duration)
|
|
128
|
+
self._animation.setEasingCurve(QEasingCurve.Type.OutCubic)
|
|
129
|
+
self._animation.setStartValue(0.0)
|
|
130
|
+
self._animation.setEndValue(1.0)
|
|
131
|
+
self._animation.valueChanged.connect(self._step)
|
|
132
|
+
self._animation.finished.connect(self._settle)
|
|
133
|
+
|
|
134
|
+
def setCurrentWidget(self, widget) -> None:
|
|
135
|
+
index = self.indexOf(widget)
|
|
136
|
+
if index >= 0:
|
|
137
|
+
self.setCurrentIndex(index)
|
|
138
|
+
|
|
139
|
+
def setCurrentIndex(self, index: int) -> None:
|
|
140
|
+
previous = self.currentIndex()
|
|
141
|
+
if index == previous or not 0 <= index < self.count():
|
|
142
|
+
super().setCurrentIndex(index)
|
|
143
|
+
return
|
|
144
|
+
self._settle()
|
|
145
|
+
super().setCurrentIndex(index)
|
|
146
|
+
if previous >= 0:
|
|
147
|
+
horizontal = self._orientation == Qt.Orientation.Horizontal
|
|
148
|
+
self._enter(-1 if horizontal and index < previous else 1)
|
|
149
|
+
|
|
150
|
+
def animate_current(self) -> None:
|
|
151
|
+
"""Play the entrance of the current page again, e.g. once it has finished loading."""
|
|
152
|
+
|
|
153
|
+
self._settle()
|
|
154
|
+
self._enter(self._sign)
|
|
155
|
+
|
|
156
|
+
def _enter(self, sign: int) -> None:
|
|
157
|
+
page = self.currentWidget()
|
|
158
|
+
if page is None or not self.isVisible() or self._animation.duration() <= 0:
|
|
159
|
+
return
|
|
160
|
+
if page.graphicsEffect() is not None:
|
|
161
|
+
return # never replace an effect the page owns
|
|
162
|
+
self._sign = sign
|
|
163
|
+
page.setGraphicsEffect(QGraphicsOpacityEffect(page))
|
|
164
|
+
self._page = page
|
|
165
|
+
self._step(0.0)
|
|
166
|
+
self._animation.start()
|
|
167
|
+
|
|
168
|
+
def is_animating(self) -> bool:
|
|
169
|
+
return self._page is not None
|
|
170
|
+
|
|
171
|
+
def _step(self, value) -> None:
|
|
172
|
+
page = self._page
|
|
173
|
+
if page is None:
|
|
174
|
+
return
|
|
175
|
+
progress = float(value)
|
|
176
|
+
offset = round((1.0 - progress) * self._distance) * self._sign
|
|
177
|
+
rect = self.contentsRect()
|
|
178
|
+
if self._orientation == Qt.Orientation.Horizontal:
|
|
179
|
+
rect.translate(offset, 0)
|
|
180
|
+
else:
|
|
181
|
+
rect.translate(0, offset)
|
|
182
|
+
try:
|
|
183
|
+
page.setGeometry(rect)
|
|
184
|
+
effect = page.graphicsEffect()
|
|
185
|
+
if isinstance(effect, QGraphicsOpacityEffect):
|
|
186
|
+
effect.setOpacity(progress)
|
|
187
|
+
except RuntimeError: # the page was deleted mid-transition
|
|
188
|
+
self._page = None
|
|
189
|
+
self._animation.stop()
|
|
190
|
+
|
|
191
|
+
def _settle(self) -> None:
|
|
192
|
+
page, self._page = self._page, None
|
|
193
|
+
self._animation.stop()
|
|
194
|
+
if page is None:
|
|
195
|
+
return
|
|
196
|
+
try:
|
|
197
|
+
page.setGeometry(QRect(self.contentsRect()))
|
|
198
|
+
if isinstance(page.graphicsEffect(), QGraphicsOpacityEffect):
|
|
199
|
+
page.setGraphicsEffect(None)
|
|
200
|
+
except RuntimeError:
|
|
201
|
+
pass
|
|
@@ -1,16 +1,59 @@
|
|
|
1
|
-
from PySide6.QtCore import QEasingCurve, QSize, Qt, QVariantAnimation, Signal
|
|
2
|
-
from PySide6.QtGui import QIcon
|
|
1
|
+
from PySide6.QtCore import QEasingCurve, QEvent, QPoint, QRect, QRectF, QSize, Qt, QVariantAnimation, Signal
|
|
2
|
+
from PySide6.QtGui import QColor, QIcon, QImage, QLinearGradient, QPainter, QPixmap
|
|
3
3
|
from PySide6.QtWidgets import (QButtonGroup, QFrame, QHBoxLayout, QLabel, QPushButton, QScrollArea, QSizePolicy,
|
|
4
4
|
QVBoxLayout, QWidget)
|
|
5
5
|
|
|
6
6
|
from ok.ui.qt.kit.icons import icon as kit_icon
|
|
7
7
|
from ok.ui.qt.kit.labels import Label
|
|
8
|
+
from ok.ui.qt.kit.motion import SlidingIndicator, paint_rounded
|
|
8
9
|
from ok.ui.qt.kit.theme import set_style_property, theme
|
|
9
10
|
|
|
11
|
+
_GEOMETRY_EVENTS = (QEvent.Type.Move, QEvent.Type.Resize, QEvent.Type.Show, QEvent.Type.Hide)
|
|
12
|
+
ICON_FILL_DURATION = 260
|
|
13
|
+
# Width of the soft edge of the icon color sweep, as a fraction of the diagonal.
|
|
14
|
+
ICON_FILL_EDGE = 0.35
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def _diagonal_blend(base: QPixmap, top: QPixmap, progress: float) -> QPixmap:
|
|
18
|
+
"""``top`` revealed over ``base`` from the bottom-left corner, ``progress`` in 0..1."""
|
|
19
|
+
|
|
20
|
+
width, height = top.width(), top.height()
|
|
21
|
+
end = progress * (1.0 + ICON_FILL_EDGE) # fully covered at progress 1
|
|
22
|
+
|
|
23
|
+
def coverage(position: float) -> float:
|
|
24
|
+
return min(1.0, max(0.0, (end - position) / ICON_FILL_EDGE))
|
|
25
|
+
|
|
26
|
+
mask = QLinearGradient(0, height, width, 0)
|
|
27
|
+
for position in sorted({0.0, 1.0, *(p for p in (end - ICON_FILL_EDGE, end) if 0.0 < p < 1.0)}):
|
|
28
|
+
mask.setColorAt(position, QColor(0, 0, 0, round(255 * coverage(position))))
|
|
29
|
+
|
|
30
|
+
# Paint in device pixels; the ratio is restored on the result.
|
|
31
|
+
revealed = top.toImage().convertToFormat(QImage.Format.Format_ARGB32_Premultiplied)
|
|
32
|
+
revealed.setDevicePixelRatio(1.0)
|
|
33
|
+
painter = QPainter(revealed)
|
|
34
|
+
painter.setCompositionMode(QPainter.CompositionMode.CompositionMode_DestinationIn)
|
|
35
|
+
painter.fillRect(revealed.rect(), mask)
|
|
36
|
+
painter.end()
|
|
37
|
+
|
|
38
|
+
result = base.toImage().convertToFormat(QImage.Format.Format_ARGB32_Premultiplied)
|
|
39
|
+
result.setDevicePixelRatio(1.0)
|
|
40
|
+
painter = QPainter(result)
|
|
41
|
+
painter.setCompositionMode(QPainter.CompositionMode.CompositionMode_DestinationOut)
|
|
42
|
+
painter.fillRect(result.rect(), mask)
|
|
43
|
+
painter.setCompositionMode(QPainter.CompositionMode.CompositionMode_Plus)
|
|
44
|
+
painter.drawImage(0, 0, revealed)
|
|
45
|
+
painter.end()
|
|
46
|
+
|
|
47
|
+
pixmap = QPixmap.fromImage(result)
|
|
48
|
+
pixmap.setDevicePixelRatio(top.devicePixelRatio())
|
|
49
|
+
return pixmap
|
|
50
|
+
|
|
10
51
|
EXPANDED_WIDTH = 216
|
|
11
52
|
COMPACT_WIDTH = 60
|
|
12
53
|
ICON_TEXT_SPACING = 8
|
|
13
54
|
COLLAPSE_DURATION = 180
|
|
55
|
+
# The sidebar highlight often travels far, so it moves faster than tab indicators.
|
|
56
|
+
NAV_INDICATOR_DURATION = 150
|
|
14
57
|
SIDEBAR_PADDING = 10
|
|
15
58
|
# Centers the 18px icon in a COMPACT_WIDTH rail, so the icon never moves.
|
|
16
59
|
ICON_LEFT = (COMPACT_WIDTH - 2 * SIDEBAR_PADDING - 18) // 2
|
|
@@ -50,6 +93,17 @@ class NavItem(QPushButton):
|
|
|
50
93
|
layout.addStretch(0)
|
|
51
94
|
layout.addWidget(self.dot)
|
|
52
95
|
|
|
96
|
+
# On selection the accent color sweeps across the icon from bottom left
|
|
97
|
+
# to top right.
|
|
98
|
+
self._fill_from = None
|
|
99
|
+
self._fill_to = None
|
|
100
|
+
self._fill = QVariantAnimation(self)
|
|
101
|
+
self._fill.setDuration(ICON_FILL_DURATION)
|
|
102
|
+
self._fill.setEasingCurve(QEasingCurve.Type.OutCubic)
|
|
103
|
+
self._fill.setStartValue(0.0)
|
|
104
|
+
self._fill.setEndValue(1.0)
|
|
105
|
+
self._fill.valueChanged.connect(self._paint_fill)
|
|
106
|
+
|
|
53
107
|
self.toggled.connect(self._on_toggled)
|
|
54
108
|
theme.changed.connect(self._refresh_icon)
|
|
55
109
|
self._refresh_icon()
|
|
@@ -73,18 +127,39 @@ class NavItem(QPushButton):
|
|
|
73
127
|
|
|
74
128
|
def _on_toggled(self, checked: bool) -> None:
|
|
75
129
|
set_style_property(self.text_label, "selected", checked)
|
|
76
|
-
self.
|
|
130
|
+
source = self._icon_source
|
|
131
|
+
if checked and isinstance(source, str) and self.isVisible() and self._fill.duration() > 0:
|
|
132
|
+
# Bundled icons are single-color, so they can be recolored; app icons keep theirs.
|
|
133
|
+
self._fill.stop()
|
|
134
|
+
self._fill_from = self._icon_pixmap(False)
|
|
135
|
+
self._fill_to = self._icon_pixmap(True)
|
|
136
|
+
self._paint_fill(0.0)
|
|
137
|
+
self._fill.start()
|
|
138
|
+
else:
|
|
139
|
+
self._refresh_icon()
|
|
77
140
|
|
|
78
|
-
def
|
|
141
|
+
def _icon_pixmap(self, selected: bool):
|
|
79
142
|
source = self._icon_source
|
|
80
|
-
if source
|
|
143
|
+
qicon = source if isinstance(source, QIcon) else kit_icon(source, "accent" if selected else "text_secondary", 1.7)
|
|
144
|
+
return qicon.pixmap(QSize(18, 18), self.devicePixelRatioF())
|
|
145
|
+
|
|
146
|
+
def _refresh_icon(self) -> None:
|
|
147
|
+
self._fill.stop()
|
|
148
|
+
self._fill_from = self._fill_to = None
|
|
149
|
+
if self._icon_source is None:
|
|
81
150
|
self.icon_label.clear()
|
|
82
151
|
return
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
152
|
+
self.icon_label.setPixmap(self._icon_pixmap(self.isChecked()))
|
|
153
|
+
|
|
154
|
+
def _paint_fill(self, value) -> None:
|
|
155
|
+
if self._fill_from is None:
|
|
156
|
+
return
|
|
157
|
+
progress = float(value)
|
|
158
|
+
if progress >= 1.0:
|
|
159
|
+
self.icon_label.setPixmap(self._fill_to)
|
|
160
|
+
self._fill_from = self._fill_to = None
|
|
161
|
+
return
|
|
162
|
+
self.icon_label.setPixmap(_diagonal_blend(self._fill_from, self._fill_to, progress))
|
|
88
163
|
|
|
89
164
|
|
|
90
165
|
class NavigationView(QWidget):
|
|
@@ -107,8 +182,15 @@ class NavigationView(QWidget):
|
|
|
107
182
|
self._group = QButtonGroup(self)
|
|
108
183
|
self._group.setExclusive(True)
|
|
109
184
|
self._group.buttonClicked.connect(lambda button: self.current_changed.emit(button.key))
|
|
185
|
+
# The selection highlight is painted here, under the items, so it can
|
|
186
|
+
# travel from the old item to the new one.
|
|
187
|
+
self._indicator = SlidingIndicator(self, self._indicator_rect, NAV_INDICATOR_DURATION)
|
|
188
|
+
self._group.buttonToggled.connect(self._on_item_toggled)
|
|
189
|
+
theme.changed.connect(self.update)
|
|
110
190
|
|
|
111
191
|
scroll = QScrollArea(self)
|
|
192
|
+
self._scroll = scroll
|
|
193
|
+
scroll.verticalScrollBar().valueChanged.connect(self.update)
|
|
112
194
|
scroll.setWidgetResizable(True)
|
|
113
195
|
scroll.setFrameShape(QFrame.Shape.NoFrame)
|
|
114
196
|
scroll.setHorizontalScrollBarPolicy(Qt.ScrollBarPolicy.ScrollBarAlwaysOff)
|
|
@@ -162,6 +244,7 @@ class NavigationView(QWidget):
|
|
|
162
244
|
header.setFixedHeight(header.sizeHint().height())
|
|
163
245
|
box_layout.addWidget(header)
|
|
164
246
|
box.hide()
|
|
247
|
+
box.installEventFilter(self)
|
|
165
248
|
self._sections[key] = (box, box_layout, header)
|
|
166
249
|
self._sections_layout.insertWidget(self._sections_layout.count() - 1, box)
|
|
167
250
|
|
|
@@ -172,6 +255,7 @@ class NavigationView(QWidget):
|
|
|
172
255
|
item.set_compact(self._compact)
|
|
173
256
|
self._items[key] = item
|
|
174
257
|
self._group.addButton(item)
|
|
258
|
+
item.installEventFilter(self)
|
|
175
259
|
if bottom:
|
|
176
260
|
self._bottom.addWidget(item)
|
|
177
261
|
else:
|
|
@@ -187,6 +271,8 @@ class NavigationView(QWidget):
|
|
|
187
271
|
if item is None:
|
|
188
272
|
return
|
|
189
273
|
self._group.removeButton(item)
|
|
274
|
+
if self._indicator.item() is item:
|
|
275
|
+
self._indicator.set_item(self._group.checkedButton(), animate=False)
|
|
190
276
|
container = item.parentWidget()
|
|
191
277
|
item.setParent(None)
|
|
192
278
|
item.deleteLater()
|
|
@@ -246,6 +332,44 @@ class NavigationView(QWidget):
|
|
|
246
332
|
if not self._compact:
|
|
247
333
|
self._show_text(True)
|
|
248
334
|
|
|
335
|
+
# --- selection highlight ----------------------------------------------------
|
|
336
|
+
|
|
337
|
+
def _on_item_toggled(self, button, checked: bool) -> None:
|
|
338
|
+
if checked:
|
|
339
|
+
self._indicator.set_item(button)
|
|
340
|
+
|
|
341
|
+
def _indicator_rect(self, item) -> QRectF:
|
|
342
|
+
return QRectF(QRect(item.mapTo(self, QPoint(0, 0)), item.size()))
|
|
343
|
+
|
|
344
|
+
def eventFilter(self, watched, event) -> bool:
|
|
345
|
+
if event.type() in _GEOMETRY_EVENTS:
|
|
346
|
+
self.update()
|
|
347
|
+
return super().eventFilter(watched, event)
|
|
348
|
+
|
|
349
|
+
def paintEvent(self, event) -> None:
|
|
350
|
+
super().paintEvent(event)
|
|
351
|
+
rect = self._indicator.rect()
|
|
352
|
+
if rect is None:
|
|
353
|
+
return
|
|
354
|
+
viewport = self._scroll.viewport()
|
|
355
|
+
top = viewport.mapTo(self, QPoint(0, 0)).y()
|
|
356
|
+
item = self._indicator.item()
|
|
357
|
+
if self._indicator.is_animating() or item.parentWidget() is self:
|
|
358
|
+
# In flight it may cross into the pinned bottom items; only the
|
|
359
|
+
# area above the list is off limits.
|
|
360
|
+
clip = QRectF(0, top, self.width(), self.height() - top)
|
|
361
|
+
else:
|
|
362
|
+
clip = QRectF(0, top, self.width(), viewport.height())
|
|
363
|
+
rect = rect.intersected(clip)
|
|
364
|
+
if rect.isEmpty():
|
|
365
|
+
return
|
|
366
|
+
accent = theme.color("accent")
|
|
367
|
+
fill = QColor(accent)
|
|
368
|
+
fill.setAlphaF(0.14)
|
|
369
|
+
border = QColor(accent)
|
|
370
|
+
border.setAlphaF(0.35)
|
|
371
|
+
paint_rounded(self, rect, 8, fill, border)
|
|
372
|
+
|
|
249
373
|
def _show_text(self, visible: bool) -> None:
|
|
250
374
|
for item in list(self._items.values()) + [self.collapse_button]:
|
|
251
375
|
item.set_compact(not visible)
|
|
@@ -95,11 +95,12 @@ TabItem {{
|
|
|
95
95
|
border-radius: 7px;
|
|
96
96
|
}}
|
|
97
97
|
TabItem:hover {{ background: {control_hover}; }}
|
|
98
|
-
/* One outline only: the strip's.
|
|
99
|
-
|
|
98
|
+
/* One outline only: the strip's. TabStrip paints the selected tab's fill (or
|
|
99
|
+
underline) so it can travel between tabs. */
|
|
100
|
+
TabItem:checked {{ background: transparent; }}
|
|
100
101
|
TabItem[look="underline"] {{ border: 0; border-radius: 0; border-bottom: 2px solid transparent; }}
|
|
101
102
|
TabItem[look="underline"]:hover {{ background: transparent; }}
|
|
102
|
-
TabItem[look="underline"]:checked {{ background: transparent;
|
|
103
|
+
TabItem[look="underline"]:checked {{ background: transparent; }}
|
|
103
104
|
TabItem QLabel#tabText {{ color: {text_secondary}; }}
|
|
104
105
|
TabItem QLabel#tabText[selected="true"] {{ color: {text}; font-weight: 600; }}
|
|
105
106
|
TabItem QLabel#tabCount {{
|
|
@@ -267,7 +268,8 @@ NavItem {{
|
|
|
267
268
|
border-radius: 8px;
|
|
268
269
|
}}
|
|
269
270
|
NavItem:hover {{ background: {control_hover}; }}
|
|
270
|
-
|
|
271
|
+
/* NavigationView paints the selection highlight so it can travel between items. */
|
|
272
|
+
NavItem:checked {{ background: transparent; border-color: transparent; }}
|
|
271
273
|
NavItem QLabel#navText {{ color: {text_nav}; font-size: 13.5px; }}
|
|
272
274
|
NavItem QLabel#navText[selected="true"] {{ color: {text}; font-weight: 600; }}
|
|
273
275
|
NavItem QLabel#navDot {{ background: {accent}; border-radius: 3px; }}
|
|
@@ -439,7 +441,6 @@ def build_stylesheet(manager) -> str:
|
|
|
439
441
|
accent_soft_strong=rgba(accent, 0.18),
|
|
440
442
|
accent_line=rgba(accent, 0.6),
|
|
441
443
|
accent_line_soft=rgba(accent, 0.55),
|
|
442
|
-
accent_line_nav=rgba(accent, 0.35),
|
|
443
444
|
accent_soft_weak=rgba(accent, 0.1),
|
|
444
445
|
text_nav=tokens["text"] if not dark else "#CFCFDA",
|
|
445
446
|
accent_count=rgba(accent, 0.45 if dark else 0.9),
|
|
@@ -1,11 +1,35 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import math
|
|
2
|
+
|
|
3
|
+
from PySide6.QtCore import QEvent, QRect, QRectF, QSize, Qt, Signal
|
|
4
|
+
from PySide6.QtGui import QColor, QFont, QFontMetrics, QFontMetricsF, QIcon
|
|
3
5
|
from PySide6.QtWidgets import QButtonGroup, QFrame, QHBoxLayout, QLabel, QPushButton, QSizePolicy
|
|
4
6
|
|
|
5
7
|
from ok.ui.qt.kit.icons import icon as kit_icon
|
|
8
|
+
from ok.ui.qt.kit.motion import SlidingIndicator, paint_rounded
|
|
6
9
|
from ok.ui.qt.kit.theme import set_style_property, theme
|
|
7
10
|
|
|
8
11
|
LOOKS = ("pill", "underline")
|
|
12
|
+
UNDERLINE_HEIGHT = 2
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class _TabText(QLabel):
|
|
16
|
+
"""A label sized for its selected (semibold) text, so selecting a tab never
|
|
17
|
+
changes its width and shifts its neighbors."""
|
|
18
|
+
|
|
19
|
+
def sizeHint(self) -> QSize:
|
|
20
|
+
hint = super().sizeHint()
|
|
21
|
+
font = QFont(self.font())
|
|
22
|
+
font.setWeight(QFont.Weight.DemiBold)
|
|
23
|
+
margins = self.contentsMargins()
|
|
24
|
+
# Measured like QLabel measures its own text, plus the fractional advance.
|
|
25
|
+
metrics = QFontMetrics(font)
|
|
26
|
+
text_width = max(metrics.boundingRect(QRect(0, 0, 4000, 4000), int(self.alignment()), self.text()).width(),
|
|
27
|
+
math.ceil(QFontMetricsF(font).horizontalAdvance(self.text())))
|
|
28
|
+
width = text_width + margins.left() + margins.right()
|
|
29
|
+
return QSize(max(hint.width(), width), hint.height())
|
|
30
|
+
|
|
31
|
+
def minimumSizeHint(self) -> QSize:
|
|
32
|
+
return self.sizeHint()
|
|
9
33
|
|
|
10
34
|
|
|
11
35
|
class TabItem(QPushButton):
|
|
@@ -22,8 +46,9 @@ class TabItem(QPushButton):
|
|
|
22
46
|
self.setFixedHeight(30 if look == "pill" else 40)
|
|
23
47
|
|
|
24
48
|
self.icon_label = QLabel(self)
|
|
25
|
-
self.text_label =
|
|
49
|
+
self.text_label = _TabText(text, self)
|
|
26
50
|
self.text_label.setObjectName("tabText")
|
|
51
|
+
self.text_label.setAlignment(Qt.AlignmentFlag.AlignCenter)
|
|
27
52
|
self.count_label = QLabel(self)
|
|
28
53
|
self.count_label.setObjectName("tabCount")
|
|
29
54
|
for label in (self.icon_label, self.text_label, self.count_label):
|
|
@@ -99,6 +124,31 @@ class TabStrip(QFrame):
|
|
|
99
124
|
if look == "underline":
|
|
100
125
|
layout.addStretch(1)
|
|
101
126
|
self._group.buttonToggled.connect(self._on_toggled)
|
|
127
|
+
self._indicator = SlidingIndicator(self, self._indicator_rect)
|
|
128
|
+
theme.changed.connect(self.update)
|
|
129
|
+
|
|
130
|
+
def _indicator_rect(self, item) -> QRectF:
|
|
131
|
+
rect = QRectF(item.geometry())
|
|
132
|
+
if self._look == "underline":
|
|
133
|
+
return QRectF(rect.left(), rect.bottom() + 1 - UNDERLINE_HEIGHT, rect.width(), UNDERLINE_HEIGHT)
|
|
134
|
+
return rect
|
|
135
|
+
|
|
136
|
+
def paintEvent(self, event) -> None:
|
|
137
|
+
super().paintEvent(event)
|
|
138
|
+
rect = self._indicator.rect()
|
|
139
|
+
if rect is None:
|
|
140
|
+
return
|
|
141
|
+
fill = QColor(theme.color("accent"))
|
|
142
|
+
if self._look == "underline":
|
|
143
|
+
paint_rounded(self, rect, 1, fill)
|
|
144
|
+
else:
|
|
145
|
+
fill.setAlphaF(0.18)
|
|
146
|
+
paint_rounded(self, rect, 7, fill)
|
|
147
|
+
|
|
148
|
+
def eventFilter(self, watched, event) -> bool:
|
|
149
|
+
if event.type() in (QEvent.Type.Move, QEvent.Type.Resize, QEvent.Type.Show, QEvent.Type.Hide):
|
|
150
|
+
self.update()
|
|
151
|
+
return super().eventFilter(watched, event)
|
|
102
152
|
|
|
103
153
|
def _insert(self, widget, alignment=Qt.AlignmentFlag(0)) -> None:
|
|
104
154
|
layout = self.layout()
|
|
@@ -111,6 +161,7 @@ class TabStrip(QFrame):
|
|
|
111
161
|
item = TabItem(key, text, count, icon, self._look, self)
|
|
112
162
|
self._items[key] = item
|
|
113
163
|
self._group.addButton(item)
|
|
164
|
+
item.installEventFilter(self)
|
|
114
165
|
self._insert(item)
|
|
115
166
|
if len(self._items) == 1:
|
|
116
167
|
item.setChecked(True)
|
|
@@ -128,6 +179,8 @@ class TabStrip(QFrame):
|
|
|
128
179
|
for item in self._items.values():
|
|
129
180
|
self._group.removeButton(item)
|
|
130
181
|
self._items.clear()
|
|
182
|
+
# Rebuilt tabs start at their selection rather than flying in.
|
|
183
|
+
self._indicator.set_item(None, animate=False)
|
|
131
184
|
layout = self.layout()
|
|
132
185
|
for index in reversed(range(layout.count())):
|
|
133
186
|
widget = layout.itemAt(index).widget()
|
|
@@ -153,4 +206,5 @@ class TabStrip(QFrame):
|
|
|
153
206
|
|
|
154
207
|
def _on_toggled(self, button, checked: bool) -> None:
|
|
155
208
|
if checked:
|
|
209
|
+
self._indicator.set_item(button)
|
|
156
210
|
self.current_changed.emit(button.key)
|
|
@@ -20,6 +20,9 @@ class ImportedTaskTab(TasksPage):
|
|
|
20
20
|
self.imported_file_name = namespace
|
|
21
21
|
self.state_name = f"tasks_page_{namespace}"
|
|
22
22
|
super().__init__(title=og.app.tr(name))
|
|
23
|
+
# TasksPage names itself "TasksPage", which is also the main Tasks
|
|
24
|
+
# page's navigation key; each imported tab needs its own key.
|
|
25
|
+
self.setObjectName(self.state_name)
|
|
23
26
|
|
|
24
27
|
def collect_tasks(self):
|
|
25
28
|
from ok.task.task import TriggerTask
|
|
@@ -14,7 +14,7 @@ import time
|
|
|
14
14
|
from PySide6.QtCore import QCoreApplication, QSize, Qt, QTimer, Signal
|
|
15
15
|
from PySide6.QtGui import QFontMetrics
|
|
16
16
|
from PySide6.QtWidgets import (QAbstractItemView, QFrame, QHBoxLayout, QHeaderView, QLabel, QMenu, QPushButton,
|
|
17
|
-
QScrollArea, QSizePolicy,
|
|
17
|
+
QScrollArea, QSizePolicy, QTableWidget, QTableWidgetItem, QVBoxLayout,
|
|
18
18
|
QWidget)
|
|
19
19
|
|
|
20
20
|
from ok import Logger, og
|
|
@@ -25,6 +25,7 @@ from ok.ui.qt.kit.dialogs import Dialog
|
|
|
25
25
|
from ok.ui.qt.kit.feedback import Pill
|
|
26
26
|
from ok.ui.qt.kit.icons import icon as kit_icon, tinted_icon
|
|
27
27
|
from ok.ui.qt.kit.labels import Label
|
|
28
|
+
from ok.ui.qt.kit.motion import AnimatedStackedWidget
|
|
28
29
|
from ok.ui.qt.kit.switch import Switch
|
|
29
30
|
from ok.ui.qt.kit.tabs import TabStrip
|
|
30
31
|
from ok.ui.qt.kit.theme import set_style_property, theme
|
|
@@ -531,7 +532,7 @@ class TaskDetail(QWidget):
|
|
|
531
532
|
self.info_table.verticalHeader().setDefaultSectionSize(40)
|
|
532
533
|
self.info_table.setEditTriggers(QAbstractItemView.EditTrigger.NoEditTriggers)
|
|
533
534
|
self.info_table.setSelectionMode(QAbstractItemView.SelectionMode.NoSelection)
|
|
534
|
-
self.pages =
|
|
535
|
+
self.pages = AnimatedStackedWidget(Qt.Orientation.Horizontal)
|
|
535
536
|
self.pages.addWidget(self.form_scroll)
|
|
536
537
|
self.pages.addWidget(self.info_table)
|
|
537
538
|
|