ok-script 0.0.332__tar.gz → 0.0.334__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.
Files changed (202) hide show
  1. {ok_script-0.0.332/ok_script.egg-info → ok_script-0.0.334}/PKG-INFO +1 -1
  2. ok_script-0.0.334/ok/Capture.cp312-win_amd64.pyd +0 -0
  3. ok_script-0.0.334/ok/OK.cp312-win_amd64.pyd +0 -0
  4. ok_script-0.0.334/ok/Task.cp312-win_amd64.pyd +0 -0
  5. ok_script-0.0.334/ok/Util.cp312-win_amd64.pyd +0 -0
  6. {ok_script-0.0.332 → ok_script-0.0.334}/ok/analytics/Analytics.py +1 -1
  7. {ok_script-0.0.332 → ok_script-0.0.334}/ok/feature/Box.py +7 -5
  8. {ok_script-0.0.332 → ok_script-0.0.334}/ok/gui/Communicate.py +1 -0
  9. {ok_script-0.0.332 → ok_script-0.0.334}/ok/gui/MainWindow.py +7 -0
  10. {ok_script-0.0.332 → ok_script-0.0.334}/ok/gui/StartController.py +3 -3
  11. {ok_script-0.0.332 → ok_script-0.0.334}/ok/gui/debug/DebugTab.py +1 -1
  12. {ok_script-0.0.332 → ok_script-0.0.334}/ok/gui/debug/Screenshot.py +20 -22
  13. ok_script-0.0.334/ok/gui/widget/SortingTableWidgetItem.py +34 -0
  14. {ok_script-0.0.332 → ok_script-0.0.334}/ok/gui/widget/Tab.py +8 -1
  15. {ok_script-0.0.332 → ok_script-0.0.334}/ok/interaction/ADBInteraction.py +5 -1
  16. {ok_script-0.0.332 → ok_script-0.0.334}/ok/interaction/BaseInteraction.py +5 -2
  17. {ok_script-0.0.332 → ok_script-0.0.334}/ok/interaction/PostMessageInteraction.py +4 -3
  18. {ok_script-0.0.332 → ok_script-0.0.334}/ok/interaction/PyDirectInteraction.py +10 -5
  19. {ok_script-0.0.332 → ok_script-0.0.334}/ok/logging/Logger.py +1 -1
  20. ok_script-0.0.334/ok/test/OKTestRunner.py +23 -0
  21. ok_script-0.0.334/ok/test/RunTests.py +17 -0
  22. ok_script-0.0.334/ok/test/TaskTestCase.py +39 -0
  23. ok_script-0.0.334/ok/test/__init__.py +18 -0
  24. {ok_script-0.0.332 → ok_script-0.0.334/ok_script.egg-info}/PKG-INFO +1 -1
  25. {ok_script-0.0.332 → ok_script-0.0.334}/ok_script.egg-info/SOURCES.txt +4 -0
  26. {ok_script-0.0.332 → ok_script-0.0.334}/setup.py +1 -1
  27. ok_script-0.0.334/tests/test_box.py +30 -0
  28. ok_script-0.0.332/ok/Capture.cp312-win_amd64.pyd +0 -0
  29. ok_script-0.0.332/ok/OK.cp312-win_amd64.pyd +0 -0
  30. ok_script-0.0.332/ok/Task.cp312-win_amd64.pyd +0 -0
  31. ok_script-0.0.332/ok/Util.cp312-win_amd64.pyd +0 -0
  32. ok_script-0.0.332/ok/test/TaskTestCase.py +0 -43
  33. ok_script-0.0.332/ok/util/__init__.py +0 -0
  34. {ok_script-0.0.332 → ok_script-0.0.334}/LICENSE.txt +0 -0
  35. {ok_script-0.0.332 → ok_script-0.0.334}/MANIFEST.in +0 -0
  36. {ok_script-0.0.332 → ok_script-0.0.334}/README.md +0 -0
  37. {ok_script-0.0.332 → ok_script-0.0.334}/ok/__init__.py +0 -0
  38. {ok_script-0.0.332 → ok_script-0.0.334}/ok/alas/__init__.py +0 -0
  39. {ok_script-0.0.332 → ok_script-0.0.334}/ok/alas/emulator_base.py +0 -0
  40. {ok_script-0.0.332 → ok_script-0.0.334}/ok/alas/emulator_windows.py +0 -0
  41. {ok_script-0.0.332 → ok_script-0.0.334}/ok/alas/platform_base.py +0 -0
  42. {ok_script-0.0.332 → ok_script-0.0.334}/ok/alas/platform_windows.py +0 -0
  43. {ok_script-0.0.332 → ok_script-0.0.334}/ok/alas/utils.py +0 -0
  44. {ok_script-0.0.332 → ok_script-0.0.334}/ok/analytics/__init__.py +0 -0
  45. {ok_script-0.0.332 → ok_script-0.0.334}/ok/capture/__init__.py +0 -0
  46. {ok_script-0.0.332 → ok_script-0.0.334}/ok/capture/adb/__init__.py +0 -0
  47. {ok_script-0.0.332 → ok_script-0.0.334}/ok/capture/adb/nemu_ipc.py +0 -0
  48. {ok_script-0.0.332 → ok_script-0.0.334}/ok/capture/adb/nemu_utils.py +0 -0
  49. {ok_script-0.0.332 → ok_script-0.0.334}/ok/capture/windows/__init__.py +0 -0
  50. {ok_script-0.0.332 → ok_script-0.0.334}/ok/capture/windows/d3d11.py +0 -0
  51. {ok_script-0.0.332 → ok_script-0.0.334}/ok/capture/windows/dump.py +0 -0
  52. {ok_script-0.0.332 → ok_script-0.0.334}/ok/capture/windows/utils.py +0 -0
  53. {ok_script-0.0.332 → ok_script-0.0.334}/ok/capture/windows/window.py +0 -0
  54. {ok_script-0.0.332 → ok_script-0.0.334}/ok/color/Color.py +0 -0
  55. {ok_script-0.0.332 → ok_script-0.0.334}/ok/color/__init__.py +0 -0
  56. {ok_script-0.0.332 → ok_script-0.0.334}/ok/config/Config.py +0 -0
  57. {ok_script-0.0.332 → ok_script-0.0.334}/ok/config/ConfigOption.py +0 -0
  58. {ok_script-0.0.332 → ok_script-0.0.334}/ok/config/GlobalConfig.py +0 -0
  59. {ok_script-0.0.332 → ok_script-0.0.334}/ok/config/InfoDict.py +0 -0
  60. {ok_script-0.0.332 → ok_script-0.0.334}/ok/config/__init__.py +0 -0
  61. {ok_script-0.0.332 → ok_script-0.0.334}/ok/display/__init__.py +0 -0
  62. {ok_script-0.0.332 → ok_script-0.0.334}/ok/display/custom_types.py +0 -0
  63. {ok_script-0.0.332 → ok_script-0.0.334}/ok/display/display.py +0 -0
  64. {ok_script-0.0.332 → ok_script-0.0.334}/ok/display/display_adapters.py +0 -0
  65. {ok_script-0.0.332 → ok_script-0.0.334}/ok/display/display_monitors.py +0 -0
  66. {ok_script-0.0.332 → ok_script-0.0.334}/ok/display/windows_types.py +0 -0
  67. {ok_script-0.0.332 → ok_script-0.0.334}/ok/feature/CompressCoco.py +0 -0
  68. {ok_script-0.0.332 → ok_script-0.0.334}/ok/feature/Feature.py +0 -0
  69. {ok_script-0.0.332 → ok_script-0.0.334}/ok/feature/FeatureSet.py +0 -0
  70. {ok_script-0.0.332 → ok_script-0.0.334}/ok/feature/FindFeature.py +0 -0
  71. {ok_script-0.0.332 → ok_script-0.0.334}/ok/feature/__init__.py +0 -0
  72. {ok_script-0.0.332 → ok_script-0.0.334}/ok/gui/App.py +0 -0
  73. {ok_script-0.0.332 → ok_script-0.0.334}/ok/gui/MessageWindow.py +0 -0
  74. {ok_script-0.0.332 → ok_script-0.0.334}/ok/gui/TabTitles.py +0 -0
  75. {ok_script-0.0.332 → ok_script-0.0.334}/ok/gui/__init__.py +0 -0
  76. {ok_script-0.0.332 → ok_script-0.0.334}/ok/gui/about/AboutTab.py +0 -0
  77. {ok_script-0.0.332 → ok_script-0.0.334}/ok/gui/about/HttpTextEdit.py +0 -0
  78. {ok_script-0.0.332 → ok_script-0.0.334}/ok/gui/about/VersionCard.py +0 -0
  79. {ok_script-0.0.332 → ok_script-0.0.334}/ok/gui/about/__init__.py +0 -0
  80. {ok_script-0.0.332 → ok_script-0.0.334}/ok/gui/common/OKIcon.py +0 -0
  81. {ok_script-0.0.332 → ok_script-0.0.334}/ok/gui/common/__init__.py +0 -0
  82. {ok_script-0.0.332 → ok_script-0.0.334}/ok/gui/common/config.py +0 -0
  83. {ok_script-0.0.332 → ok_script-0.0.334}/ok/gui/common/style_sheet.py +0 -0
  84. {ok_script-0.0.332 → ok_script-0.0.334}/ok/gui/debug/FrameWidget.py +0 -0
  85. {ok_script-0.0.332 → ok_script-0.0.334}/ok/gui/debug/LogWindow.py +0 -0
  86. {ok_script-0.0.332 → ok_script-0.0.334}/ok/gui/debug/__init__.py +0 -0
  87. {ok_script-0.0.332 → ok_script-0.0.334}/ok/gui/i18n/GettextTranslator.py +0 -0
  88. {ok_script-0.0.332 → ok_script-0.0.334}/ok/gui/i18n/__init__.py +0 -0
  89. {ok_script-0.0.332 → ok_script-0.0.334}/ok/gui/i18n/path.py +0 -0
  90. {ok_script-0.0.332 → ok_script-0.0.334}/ok/gui/i18n/update.py +0 -0
  91. {ok_script-0.0.332 → ok_script-0.0.334}/ok/gui/icon/__init__.py +0 -0
  92. {ok_script-0.0.332 → ok_script-0.0.334}/ok/gui/icon/icon.py +0 -0
  93. {ok_script-0.0.332 → ok_script-0.0.334}/ok/gui/launcher/DownloadBar.py +0 -0
  94. {ok_script-0.0.332 → ok_script-0.0.334}/ok/gui/launcher/Launcher.py +0 -0
  95. {ok_script-0.0.332 → ok_script-0.0.334}/ok/gui/launcher/LauncherWindow.py +0 -0
  96. {ok_script-0.0.332 → ok_script-0.0.334}/ok/gui/launcher/LinksBar.py +0 -0
  97. {ok_script-0.0.332 → ok_script-0.0.334}/ok/gui/launcher/RunBar.py +0 -0
  98. {ok_script-0.0.332 → ok_script-0.0.334}/ok/gui/launcher/UpdateBar.py +0 -0
  99. {ok_script-0.0.332 → ok_script-0.0.334}/ok/gui/launcher/__init__.py +0 -0
  100. {ok_script-0.0.332 → ok_script-0.0.334}/ok/gui/overlay/OverlayWindow.py +0 -0
  101. {ok_script-0.0.332 → ok_script-0.0.334}/ok/gui/overlay/__init__.py +0 -0
  102. {ok_script-0.0.332 → ok_script-0.0.334}/ok/gui/qss/__init__.py +0 -0
  103. {ok_script-0.0.332 → ok_script-0.0.334}/ok/gui/resources.py +0 -0
  104. {ok_script-0.0.332 → ok_script-0.0.334}/ok/gui/settings/GlobalConfigCard.py +0 -0
  105. {ok_script-0.0.332 → ok_script-0.0.334}/ok/gui/settings/SettingTab.py +0 -0
  106. {ok_script-0.0.332 → ok_script-0.0.334}/ok/gui/settings/__init__.py +0 -0
  107. {ok_script-0.0.332 → ok_script-0.0.334}/ok/gui/start/SelectCaptureListView.py +0 -0
  108. {ok_script-0.0.332 → ok_script-0.0.334}/ok/gui/start/StartCard.py +0 -0
  109. {ok_script-0.0.332 → ok_script-0.0.334}/ok/gui/start/StartTab.py +0 -0
  110. {ok_script-0.0.332 → ok_script-0.0.334}/ok/gui/start/__init__.py +0 -0
  111. {ok_script-0.0.332 → ok_script-0.0.334}/ok/gui/tasks/ConfigCard.py +0 -0
  112. {ok_script-0.0.332 → ok_script-0.0.334}/ok/gui/tasks/ConfigItemFactory.py +0 -0
  113. {ok_script-0.0.332 → ok_script-0.0.334}/ok/gui/tasks/ConfigLabelAndWidget.py +0 -0
  114. {ok_script-0.0.332 → ok_script-0.0.334}/ok/gui/tasks/LabelAndDoubleSpinBox.py +0 -0
  115. {ok_script-0.0.332 → ok_script-0.0.334}/ok/gui/tasks/LabelAndDropDown.py +0 -0
  116. {ok_script-0.0.332 → ok_script-0.0.334}/ok/gui/tasks/LabelAndLineEdit.py +0 -0
  117. {ok_script-0.0.332 → ok_script-0.0.334}/ok/gui/tasks/LabelAndList.py +0 -0
  118. {ok_script-0.0.332 → ok_script-0.0.334}/ok/gui/tasks/LabelAndMultiSelection.py +0 -0
  119. {ok_script-0.0.332 → ok_script-0.0.334}/ok/gui/tasks/LabelAndSpinBox.py +0 -0
  120. {ok_script-0.0.332 → ok_script-0.0.334}/ok/gui/tasks/LabelAndSwitchButton.py +0 -0
  121. {ok_script-0.0.332 → ok_script-0.0.334}/ok/gui/tasks/LabelAndWidget.py +0 -0
  122. {ok_script-0.0.332 → ok_script-0.0.334}/ok/gui/tasks/ModifyListDialog.py +0 -0
  123. {ok_script-0.0.332 → ok_script-0.0.334}/ok/gui/tasks/ModifyListItem.py +0 -0
  124. {ok_script-0.0.332 → ok_script-0.0.334}/ok/gui/tasks/OneTimeTaskTab.py +0 -0
  125. {ok_script-0.0.332 → ok_script-0.0.334}/ok/gui/tasks/StartButton.py +0 -0
  126. {ok_script-0.0.332 → ok_script-0.0.334}/ok/gui/tasks/TaskCard.py +0 -0
  127. {ok_script-0.0.332 → ok_script-0.0.334}/ok/gui/tasks/TaskOpButton.py +0 -0
  128. {ok_script-0.0.332 → ok_script-0.0.334}/ok/gui/tasks/TaskTab.py +0 -0
  129. {ok_script-0.0.332 → ok_script-0.0.334}/ok/gui/tasks/TooltipTableWidget.py +0 -0
  130. {ok_script-0.0.332 → ok_script-0.0.334}/ok/gui/tasks/TriggerTaskTab.py +0 -0
  131. {ok_script-0.0.332 → ok_script-0.0.334}/ok/gui/tasks/__init__.py +0 -0
  132. {ok_script-0.0.332 → ok_script-0.0.334}/ok/gui/util/Alert.py +0 -0
  133. {ok_script-0.0.332 → ok_script-0.0.334}/ok/gui/util/InitWorker.py +0 -0
  134. {ok_script-0.0.332 → ok_script-0.0.334}/ok/gui/util/__init__.py +0 -0
  135. {ok_script-0.0.332 → ok_script-0.0.334}/ok/gui/util/app.py +0 -0
  136. {ok_script-0.0.332 → ok_script-0.0.334}/ok/gui/util/pip_util.py +0 -0
  137. {ok_script-0.0.332 → ok_script-0.0.334}/ok/gui/widget/BaseWindow.py +0 -0
  138. {ok_script-0.0.332 → ok_script-0.0.334}/ok/gui/widget/Card.py +0 -0
  139. {ok_script-0.0.332 → ok_script-0.0.334}/ok/gui/widget/EmptyCard.py +0 -0
  140. {ok_script-0.0.332 → ok_script-0.0.334}/ok/gui/widget/FlowLayout.py +0 -0
  141. {ok_script-0.0.332 → ok_script-0.0.334}/ok/gui/widget/FramelessDialog.py +0 -0
  142. {ok_script-0.0.332 → ok_script-0.0.334}/ok/gui/widget/ListTableWidgetItem.py +0 -0
  143. {ok_script-0.0.332 → ok_script-0.0.334}/ok/gui/widget/NumericTableWidgetItem.py +0 -0
  144. {ok_script-0.0.332 → ok_script-0.0.334}/ok/gui/widget/StartLoadingDialog.py +0 -0
  145. {ok_script-0.0.332 → ok_script-0.0.334}/ok/gui/widget/StatusBar.py +0 -0
  146. {ok_script-0.0.332 → ok_script-0.0.334}/ok/gui/widget/TabWidget.py +0 -0
  147. {ok_script-0.0.332 → ok_script-0.0.334}/ok/gui/widget/UpdateConfigWidgetItem.py +0 -0
  148. {ok_script-0.0.332 → ok_script-0.0.334}/ok/gui/widget/YesNonWidgetItem.py +0 -0
  149. {ok_script-0.0.332 → ok_script-0.0.334}/ok/gui/widget/__init__.py +0 -0
  150. {ok_script-0.0.332 → ok_script-0.0.334}/ok/interaction/DoNothingInteraction.py +0 -0
  151. {ok_script-0.0.332 → ok_script-0.0.334}/ok/interaction/__init__.py +0 -0
  152. {ok_script-0.0.332 → ok_script-0.0.334}/ok/logging/LogTailer.py +0 -0
  153. {ok_script-0.0.332 → ok_script-0.0.334}/ok/logging/__init__.py +0 -0
  154. {ok_script-0.0.332 → ok_script-0.0.334}/ok/ocr/OCR.py +0 -0
  155. {ok_script-0.0.332 → ok_script-0.0.334}/ok/ocr/__init__.py +0 -0
  156. {ok_script-0.0.332 → ok_script-0.0.334}/ok/ocr/download_paddle_model.py +0 -0
  157. {ok_script-0.0.332 → ok_script-0.0.334}/ok/rotypes/Windows/Foundation/Collections.py +0 -0
  158. {ok_script-0.0.332 → ok_script-0.0.334}/ok/rotypes/Windows/Foundation/__init__.py +0 -0
  159. {ok_script-0.0.332 → ok_script-0.0.334}/ok/rotypes/Windows/Globalization/__init__.py +0 -0
  160. {ok_script-0.0.332 → ok_script-0.0.334}/ok/rotypes/Windows/Graphics/Capture/__init__.py +0 -0
  161. {ok_script-0.0.332 → ok_script-0.0.334}/ok/rotypes/Windows/Graphics/DirectX/Direct3D11/__init__.py +0 -0
  162. {ok_script-0.0.332 → ok_script-0.0.334}/ok/rotypes/Windows/Graphics/DirectX/__init__.py +0 -0
  163. {ok_script-0.0.332 → ok_script-0.0.334}/ok/rotypes/Windows/Graphics/Imaging/__init__.py +0 -0
  164. {ok_script-0.0.332 → ok_script-0.0.334}/ok/rotypes/Windows/Graphics/__init__.py +0 -0
  165. {ok_script-0.0.332 → ok_script-0.0.334}/ok/rotypes/Windows/Media/Ocr/__init__.py +0 -0
  166. {ok_script-0.0.332 → ok_script-0.0.334}/ok/rotypes/Windows/Media/__init__.py +0 -0
  167. {ok_script-0.0.332 → ok_script-0.0.334}/ok/rotypes/Windows/Security/Cryptography/__init__.py +0 -0
  168. {ok_script-0.0.332 → ok_script-0.0.334}/ok/rotypes/Windows/Security/__init__.py +0 -0
  169. {ok_script-0.0.332 → ok_script-0.0.334}/ok/rotypes/Windows/Storage/Streams/__init__.py +0 -0
  170. {ok_script-0.0.332 → ok_script-0.0.334}/ok/rotypes/Windows/Storage/__init__.py +0 -0
  171. {ok_script-0.0.332 → ok_script-0.0.334}/ok/rotypes/Windows/__init__.py +0 -0
  172. {ok_script-0.0.332 → ok_script-0.0.334}/ok/rotypes/__init__.py +0 -0
  173. {ok_script-0.0.332 → ok_script-0.0.334}/ok/rotypes/delegate.py +0 -0
  174. {ok_script-0.0.332 → ok_script-0.0.334}/ok/rotypes/export.py +0 -0
  175. {ok_script-0.0.332 → ok_script-0.0.334}/ok/rotypes/idldsl.py +0 -0
  176. {ok_script-0.0.332 → ok_script-0.0.334}/ok/rotypes/inspectable.py +0 -0
  177. {ok_script-0.0.332 → ok_script-0.0.334}/ok/rotypes/roapi.py +0 -0
  178. {ok_script-0.0.332 → ok_script-0.0.334}/ok/rotypes/types.py +0 -0
  179. {ok_script-0.0.332 → ok_script-0.0.334}/ok/rotypes/winstring.py +0 -0
  180. {ok_script-0.0.332 → ok_script-0.0.334}/ok/scene/FeatureScene.py +0 -0
  181. {ok_script-0.0.332 → ok_script-0.0.334}/ok/scene/Scene.py +0 -0
  182. {ok_script-0.0.332 → ok_script-0.0.334}/ok/scene/__init__.py +0 -0
  183. {ok_script-0.0.332 → ok_script-0.0.334}/ok/stats/StreamStats.py +0 -0
  184. {ok_script-0.0.332 → ok_script-0.0.334}/ok/stats/__init__.py +0 -0
  185. {ok_script-0.0.332 → ok_script-0.0.334}/ok/update/DownloadMonitor.py +0 -0
  186. {ok_script-0.0.332 → ok_script-0.0.334}/ok/update/GitUpdater.py +0 -0
  187. {ok_script-0.0.332 → ok_script-0.0.334}/ok/update/GithubMultiDownloader.py +0 -0
  188. {ok_script-0.0.332/ok/test → ok_script-0.0.334/ok/update}/__init__.py +0 -0
  189. {ok_script-0.0.332 → ok_script-0.0.334}/ok/update/copy_ok_folder.py +0 -0
  190. {ok_script-0.0.332 → ok_script-0.0.334}/ok/update/gen_md5.py +0 -0
  191. {ok_script-0.0.332 → ok_script-0.0.334}/ok/update/init_launcher_env.py +0 -0
  192. {ok_script-0.0.332 → ok_script-0.0.334}/ok/update/package_full_with_profile.py +0 -0
  193. {ok_script-0.0.332 → ok_script-0.0.334}/ok/update/package_launcher.py +0 -0
  194. {ok_script-0.0.332 → ok_script-0.0.334}/ok/update/push_repos.py +0 -0
  195. {ok_script-0.0.332 → ok_script-0.0.334}/ok/update/python_env.py +0 -0
  196. {ok_script-0.0.332/ok/update → ok_script-0.0.334/ok/util}/__init__.py +0 -0
  197. {ok_script-0.0.332 → ok_script-0.0.334}/ok_script.egg-info/dependency_links.txt +0 -0
  198. {ok_script-0.0.332 → ok_script-0.0.334}/ok_script.egg-info/requires.txt +0 -0
  199. {ok_script-0.0.332 → ok_script-0.0.334}/ok_script.egg-info/top_level.txt +0 -0
  200. {ok_script-0.0.332 → ok_script-0.0.334}/setup.cfg +0 -0
  201. {ok_script-0.0.332 → ok_script-0.0.334}/tests/__init__.py +0 -0
  202. {ok_script-0.0.332 → ok_script-0.0.334}/tests/test_updater.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ok-script
3
- Version: 0.0.332
3
+ Version: 0.0.334
4
4
  Summary: Automation with Computer Vision for Python
5
5
  Home-page: https://github.com/ok-oldking/ok-script
6
6
  Author: ok-oldking
@@ -6,11 +6,11 @@ import uuid
6
6
 
7
7
  import requests
8
8
  import wmi
9
+ from ok.Util import Handler
9
10
 
10
11
  import ok.gui
11
12
  from ok.config.Config import Config
12
13
  from ok.logging.Logger import get_logger
13
- from ok.Util import Handler
14
14
 
15
15
  logger = get_logger(__name__)
16
16
 
@@ -151,9 +151,9 @@ class Box:
151
151
  else:
152
152
  return float('inf')
153
153
 
154
- filtered_boxes = sorted(boxes, key=distance_criteria)
154
+ boxes.sort(key=distance_criteria)
155
155
 
156
- for box in filtered_boxes:
156
+ for box in boxes:
157
157
  if distance_criteria(box) != float('inf'):
158
158
  return box
159
159
  return None
@@ -186,7 +186,8 @@ def sort_boxes(boxes: List[Box]) -> List[Box]:
186
186
 
187
187
  return cmp
188
188
 
189
- return sorted(boxes, key=cmp_to_key(compare_boxes))
189
+ boxes.sort(key=cmp_to_key(compare_boxes))
190
+ return boxes
190
191
 
191
192
 
192
193
  def find_box_by_name(boxes, names) -> Box:
@@ -222,7 +223,7 @@ def get_bounding_box(boxes):
222
223
  return bounding_box
223
224
 
224
225
 
225
- def find_boxes_within_boundary(boxes, boundary_box):
226
+ def find_boxes_within_boundary(boxes, boundary_box, sort=True):
226
227
  """
227
228
  Find all boxes that are entirely within the specified boundary box.
228
229
 
@@ -242,7 +243,8 @@ def find_boxes_within_boundary(boxes, boundary_box):
242
243
  box.x + box.width <= boundary_box.x + boundary_box.width and
243
244
  box.y + box.height <= boundary_box.y + boundary_box.height):
244
245
  within_boundary.append(box)
245
-
246
+ if sort:
247
+ within_boundary = sort_boxes(within_boundary)
246
248
  return within_boundary
247
249
 
248
250
 
@@ -8,6 +8,7 @@ class Communicate(QObject):
8
8
  scene = Signal(str)
9
9
  draw_box = Signal(str, object, str, object)
10
10
  task = Signal(object)
11
+ task_done = Signal(object)
11
12
  window = Signal(bool, int, int, int, int, int, int, float)
12
13
  loading_progress = Signal(str)
13
14
  notification = Signal(str, str, bool, bool)
@@ -1,5 +1,6 @@
1
1
  from PySide6.QtCore import QObject, Signal, Qt, QEvent
2
2
  from PySide6.QtWidgets import QMenu, QSystemTrayIcon
3
+ from ok.Util import init_class_by_name
3
4
  from qfluentwidgets import FluentIcon, NavigationItemPosition, MSFluentWindow, InfoBar, InfoBarPosition
4
5
 
5
6
  import ok.gui
@@ -53,6 +54,11 @@ class MainWindow(MSFluentWindow):
53
54
  self.first_task_tab = self.trigger_tab
54
55
  self.addSubInterface(self.trigger_tab, FluentIcon.ROBOT, self.tr('Triggers'))
55
56
 
57
+ if custom_tabs := config.get('custom_tabs'):
58
+ for tab in custom_tabs:
59
+ tab_obj = init_class_by_name(tab[0], tab[1])
60
+ self.addSubInterface(tab_obj, tab_obj.icon, tab_obj.name)
61
+
56
62
  if debug:
57
63
  debug_tab = DebugTab(config, exit_event)
58
64
  self.addSubInterface(debug_tab, FluentIcon.DEVELOPER_TOOLS, self.tr('Debug'),
@@ -76,6 +82,7 @@ class MainWindow(MSFluentWindow):
76
82
 
77
83
  communicate.executor_paused.connect(self.executor_paused)
78
84
  communicate.tab.connect(self.navigate_tab)
85
+ communicate.task_done.connect(self.activateWindow)
79
86
 
80
87
  # Create a context menu for the tray
81
88
  menu = QMenu()
@@ -113,12 +113,12 @@ class StartController(QObject):
113
113
  'supported_resolution', {})
114
114
  supported_ratio = supported_resolution.get('ratio')
115
115
  min_size = supported_resolution.get('min_size')
116
- resize_to_ratio = supported_resolution.get('resize_to_ratio')
116
+ resize_to = supported_resolution.get('resize_to')
117
117
  supported, resolution = ok.gui.executor.check_frame_and_resolution(supported_ratio, min_size)
118
118
  if not supported:
119
119
  resize_success = False
120
- if resize_to_ratio and isinstance(ok.gui.device_manager.capture_method, BaseWindowsCaptureMethod):
121
- resize_success = ok.gui.device_manager.capture_method.hwnd_window.try_resize_to(supported_ratio)
120
+ if resize_to and isinstance(ok.gui.device_manager.capture_method, BaseWindowsCaptureMethod):
121
+ resize_success = ok.gui.device_manager.capture_method.hwnd_window.try_resize_to(resize_to)
122
122
  if not resize_success:
123
123
  error = self.tr(
124
124
  'Resolution {resolution} check failed, some tasks might not work correctly!').format(
@@ -6,6 +6,7 @@ from PySide6.QtCore import Qt, Signal, QCoreApplication
6
6
  from PySide6.QtWidgets import QWidget, QFileDialog, QCompleter, QVBoxLayout, QHBoxLayout
7
7
  from _ctypes import byref
8
8
  from ok.Capture import ImageCaptureMethod
9
+ from ok.Util import Handler
9
10
  from qfluentwidgets import PushButton, FlowLayout, ComboBox, SearchLineEdit, TextEdit
10
11
 
11
12
  import ok.gui
@@ -17,7 +18,6 @@ from ok.gui.widget.Tab import Tab
17
18
  from ok.interaction.DoNothingInteraction import DoNothingInteraction
18
19
  from ok.logging.Logger import get_logger, exception_to_str
19
20
  from ok.ocr.OCR import OCR
20
- from ok.Util import Handler
21
21
 
22
22
  logger = get_logger(__name__)
23
23
 
@@ -8,13 +8,13 @@ import cv2
8
8
  from PIL import Image, ImageFont, ImageDraw
9
9
  from PySide6.QtCore import QObject
10
10
  from PySide6.QtGui import QColor
11
+ from ok.Util import find_first_existing_file, clear_folder, sanitize_filename, \
12
+ get_relative_path
11
13
 
12
14
  import ok.gui
13
15
  from ok.feature.Box import Box
14
16
  from ok.gui.Communicate import communicate
15
17
  from ok.logging.Logger import get_logger
16
- from ok.Util import find_first_existing_file, clear_folder, sanitize_filename, \
17
- get_relative_path
18
18
 
19
19
  logger = get_logger(__name__)
20
20
 
@@ -113,29 +113,27 @@ class Screenshot(QObject):
113
113
 
114
114
  originl_name = self.save_pil_image(name + '_original', folder, pil_image)
115
115
 
116
- if folder == self.click_screenshot_folder:
117
- # Ensure no fill
116
+ if len(ui_dict) > 0:
118
117
  draw = ImageDraw.Draw(pil_image)
119
118
 
120
119
  frame_ratio = 1
121
- if len(ui_dict) > 0:
122
- for key, value in ui_dict.items():
123
- boxes = value[0]
124
- color = tuple([int(x) for x in value[2].getRgb()]) # Convert QColor to BGR tuple
125
- for box in boxes:
126
- width = int(box.width * frame_ratio)
127
- height = int(box.height * frame_ratio)
128
- if width <= 0 or height <= 0:
129
- logger.error(f"box height and width <=0 {box}")
130
- continue
131
- x = int(box.x * frame_ratio)
132
- y = int(box.y * frame_ratio)
133
- # Draw a rectangle. Arguments are (x, y, width, height).
134
- # Adjust these values according to the desired size and position.
135
- draw.rectangle([x, y, x + width, y + height], outline=color, width=2)
136
- # Put text
137
- draw.text((x, y + height + 8), f"{box.name or key}_{round(box.confidence * 100)}", fill=color,
138
- font=self.pil_font)
120
+ for key, value in ui_dict.items():
121
+ boxes = value[0]
122
+ color = tuple([int(x) for x in value[2].getRgb()]) # Convert QColor to BGR tuple
123
+ for box in boxes:
124
+ width = int(box.width * frame_ratio)
125
+ height = int(box.height * frame_ratio)
126
+ if width <= 0 or height <= 0:
127
+ logger.error(f"box height and width <=0 {box}")
128
+ continue
129
+ x = int(box.x * frame_ratio)
130
+ y = int(box.y * frame_ratio)
131
+ # Draw a rectangle. Arguments are (x, y, width, height).
132
+ # Adjust these values according to the desired size and position.
133
+ draw.rectangle([x, y, x + width, y + height], outline=color, width=2)
134
+ # Put text
135
+ draw.text((x, y + height + 8), f"{box.name or key}_{round(box.confidence * 100)}", fill=color,
136
+ font=self.pil_font)
139
137
  self.save_pil_image(name + '_boxed', folder, pil_image)
140
138
  return originl_name
141
139
 
@@ -0,0 +1,34 @@
1
+ from PySide6.QtCore import Qt
2
+ from PySide6.QtWidgets import QTableWidgetItem
3
+
4
+
5
+ class SortingTableWidgetItem(QTableWidgetItem):
6
+
7
+ def __init__(self, name=None):
8
+ super().__init__()
9
+ self.setFlags(self.flags() & ~Qt.ItemIsEditable)
10
+ if name:
11
+ self.setText(str(name))
12
+
13
+ def __lt__(self, other):
14
+ try:
15
+ # Convert both items to comparable float values
16
+ self_value = self.convert_to_float(self.text())
17
+ other_value = other.convert_to_float(other.text())
18
+ return self_value < other_value
19
+ except ValueError:
20
+ # If conversion fails, fall back to default string comparison
21
+ return self.text() < other.text()
22
+
23
+ @staticmethod
24
+ def convert_to_float(value):
25
+ """
26
+ Convert the given value to float. Supports:
27
+ - Float strings (e.g., "3.14")
28
+ - Integer strings (e.g., "42")
29
+ - Percentage strings (e.g., "45%")
30
+ """
31
+ if value.endswith('%'):
32
+ return float(value.rstrip('%')) / 100
33
+ else:
34
+ return float(value)
@@ -1,7 +1,8 @@
1
1
  from PySide6.QtCore import Qt
2
2
  from PySide6.QtWidgets import QVBoxLayout, QWidget, QSizePolicy
3
- from qfluentwidgets import ScrollArea
3
+ from qfluentwidgets import ScrollArea, FluentIcon
4
4
 
5
+ import ok
5
6
  from ok.gui.common.style_sheet import StyleSheet
6
7
  from ok.gui.widget.Card import Card
7
8
 
@@ -9,6 +10,8 @@ from ok.gui.widget.Card import Card
9
10
  class Tab(ScrollArea):
10
11
  def __init__(self):
11
12
  super().__init__()
13
+ self.name = ""
14
+ self.icon = FluentIcon.GAME
12
15
  self.view = QWidget(self)
13
16
  self.vBoxLayout = QVBoxLayout(self.view)
14
17
 
@@ -27,6 +30,10 @@ class Tab(ScrollArea):
27
30
  self.setObjectName(self.__class__.__name__)
28
31
  StyleSheet.TAB.apply(self)
29
32
 
33
+ @property
34
+ def exit_event(self):
35
+ return ok.gui.ok.exit_event
36
+
30
37
  def addCard(self, title, widget, stretch=0, parent=None):
31
38
  container = Card(title, widget)
32
39
  self.addWidget(container, stretch)
@@ -1,3 +1,5 @@
1
+ import time
2
+
1
3
  from ok.interaction.BaseInteraction import BaseInteraction
2
4
  from ok.logging.Logger import get_logger
3
5
 
@@ -20,8 +22,10 @@ class ADBBaseInteraction(BaseInteraction):
20
22
  super().send_key(key, down_time)
21
23
  self.device_manager.device.shell(f"input keyevent {key}")
22
24
 
23
- def swipe(self, from_x, from_y, to_x, to_y, duration):
25
+ def swipe(self, from_x, from_y, to_x, to_y, duration, settle_time=0.1):
24
26
  self.device_manager.device.shell(f"input swipe {from_x} {from_y} {to_x} {to_y} {duration}")
27
+ if settle_time > 0:
28
+ time.sleep(settle_time)
25
29
 
26
30
  def click(self, x=-1, y=-1, move_back=False, name=None, down_time=0.01, move=True):
27
31
  super().click(x, y, name=name)
@@ -23,14 +23,14 @@ class BaseInteraction:
23
23
  def move(self, x, y):
24
24
  pass
25
25
 
26
- def swipe(self, from_x, from_y, to_x, to_y, duration):
26
+ def swipe(self, from_x, from_y, to_x, to_y, duration, settle_time):
27
27
  pass
28
28
 
29
29
  def middle_click(self, x=-1, y=-1, move_back=False, name=None, down_time=0.05):
30
30
  logger.debug(f"middle_click {x, y}")
31
31
  pass
32
32
 
33
- def click(self, x=-1, y=-1, name=None):
33
+ def click(self, x=-1, y=-1, move_back=False, name=None, move=move, down_time=0.05):
34
34
  if name is None:
35
35
  logger.debug(f"click {x, y}")
36
36
  else:
@@ -41,3 +41,6 @@ class BaseInteraction:
41
41
  logger.debug(f"right_click {x, y}")
42
42
  else:
43
43
  logger.debug(f"right_click {name} {x, y}")
44
+
45
+ def on_run(self):
46
+ pass
@@ -78,7 +78,7 @@ class PostMessageInteraction(BaseInteraction):
78
78
  def post(self, message, wParam=0, lParam=0):
79
79
  win32gui.PostMessage(self.hwnd, message, wParam, lParam)
80
80
 
81
- def swipe(self, x1, y1, x2, y2, duration=3):
81
+ def swipe(self, x1, y1, x2, y2, duration=3, settle_time=0.1):
82
82
  # Move the mouse to the start point (x1, y1)
83
83
  self.move(x1, y1)
84
84
  time.sleep(0.1) # Pause for a moment
@@ -100,8 +100,9 @@ class PostMessageInteraction(BaseInteraction):
100
100
  # Move the mouse to the end point (x2, y2) in small steps
101
101
  for i in range(steps):
102
102
  self.move(x1 + int(i * step_dx), y1 + int(i * step_dy), down_btn=win32con.MK_LBUTTON)
103
- time.sleep(0.1) # Sleep for 10ms
104
-
103
+ time.sleep(0.01) # Sleep for 10ms
104
+ if settle_time > 0:
105
+ time.sleep(settle_time)
105
106
  # Release the left mouse button
106
107
  self.mouse_up()
107
108
 
@@ -1,11 +1,11 @@
1
1
  import time
2
2
 
3
3
  import pydirectinput
4
-
5
4
  from ok.Capture import BaseCaptureMethod
5
+ from ok.Util import is_admin
6
+
6
7
  from ok.interaction.BaseInteraction import BaseInteraction
7
8
  from ok.logging.Logger import get_logger
8
- from ok.Util import is_admin
9
9
 
10
10
  logger = get_logger(__name__)
11
11
 
@@ -16,6 +16,7 @@ class PyDirectInteraction(BaseInteraction):
16
16
 
17
17
  def __init__(self, capture: BaseCaptureMethod, hwnd_window):
18
18
  super().__init__(capture)
19
+ self.hwnd_window = hwnd_window
19
20
  if not is_admin():
20
21
  logger.error(f"You must be an admin to use Win32Interaction")
21
22
 
@@ -45,7 +46,7 @@ class PyDirectInteraction(BaseInteraction):
45
46
  x, y = self.capture.get_abs_cords(x, y)
46
47
  pydirectinput.moveTo(x, y)
47
48
 
48
- def swipe(self, x1, y1, x2, y2, duration):
49
+ def swipe(self, x1, y1, x2, y2, duration, settle_time=0.1):
49
50
  # Convert coordinates to integers
50
51
  x1, y1 = self.capture.get_abs_cords(x1, y1)
51
52
  x2, y2 = self.capture.get_abs_cords(x2, y2)
@@ -71,8 +72,9 @@ class PyDirectInteraction(BaseInteraction):
71
72
  # Move the mouse to the end point (x2, y2) in small steps
72
73
  for i in range(steps):
73
74
  pydirectinput.moveTo(x1 + int(i * step_dx), y1 + int(i * step_dy))
74
- time.sleep(0.1) # Sleep for 10ms
75
-
75
+ time.sleep(0.01) # Sleep for 10ms
76
+ if settle_time > 0:
77
+ time.sleep(settle_time)
76
78
  # Release the left mouse button
77
79
  pydirectinput.mouseUp()
78
80
 
@@ -136,3 +138,6 @@ class PyDirectInteraction(BaseInteraction):
136
138
 
137
139
  def should_capture(self):
138
140
  return self.capture.clickable()
141
+
142
+ def on_run(self):
143
+ self.hwnd_window.bring_to_front()
@@ -119,7 +119,7 @@ class Logger:
119
119
  def exception_to_str(exception):
120
120
  if exception is not None:
121
121
  try:
122
- stack_trace_str = traceback.format_exc().replace("\\\\", "\\")
122
+ stack_trace_str = traceback.format_exc()
123
123
  except Exception as e:
124
124
  stack_trace_str = f"Error formatting exception: {e}"
125
125
  else:
@@ -0,0 +1,23 @@
1
+ import unittest
2
+
3
+ from ok.test import ok
4
+
5
+
6
+ class OKTestResult(unittest.TestResult):
7
+ def __init__(self, stream=None, descriptions=None, verbosity=None):
8
+ super().__init__(stream, descriptions, verbosity)
9
+
10
+ def startTestRun(self):
11
+ super().startTestRun()
12
+ print("Before all tests run!")
13
+
14
+ def stopTestRun(self):
15
+ super().stopTestRun()
16
+ ok.quit()
17
+
18
+ print("All unit tests are done!")
19
+
20
+
21
+ class OKTestRunner(unittest.TextTestRunner):
22
+ def _makeResult(self):
23
+ return OKTestResult(self.stream, self.descriptions, self.verbosity)
@@ -0,0 +1,17 @@
1
+ import unittest
2
+
3
+
4
+ # Define a test suite
5
+ def suite():
6
+ loader = unittest.TestLoader()
7
+ test_suite = loader.discover('tests')
8
+ return test_suite
9
+
10
+
11
+ if __name__ == "__main__":
12
+ runner = unittest.TextTestRunner()
13
+ runner.run(suite())
14
+
15
+ from ok.test import ok
16
+
17
+ ok.quit()
@@ -0,0 +1,39 @@
1
+ import unittest
2
+
3
+ from ok.logging.Logger import get_logger
4
+ from ok.test import init_ok
5
+
6
+ logger = get_logger(__name__)
7
+
8
+
9
+ class TaskTestCase(unittest.TestCase):
10
+ task_class = None
11
+ task = None
12
+ config = None
13
+ ok_map = {}
14
+
15
+ def __init__(self, *args, **kwargs):
16
+ super().__init__(*args, **kwargs)
17
+
18
+ @classmethod
19
+ def setUpClass(cls):
20
+ init_ok(cls.config)
21
+ # if cls._ok is None:
22
+ logger.info(f'set up cls start {cls}')
23
+ cls.task = cls.task_class()
24
+ from ok.test import ok
25
+ cls.task.feature_set = ok.feature_set
26
+ cls.task._executor = ok.task_executor
27
+
28
+ def set_image(self, image):
29
+ from ok.test import ok
30
+ ok.device_manager.capture_method.set_images([image])
31
+ self.task.next_frame()
32
+
33
+ def set_images(self, *images):
34
+ from ok.test import ok
35
+ ok.device_manager.capture_method.set_images(images)
36
+ self.task.next_frame()
37
+
38
+ def tearDown(self):
39
+ self.task.reset_scene()
@@ -0,0 +1,18 @@
1
+ from ok.Capture import ImageCaptureMethod
2
+
3
+ from ok.interaction.DoNothingInteraction import DoNothingInteraction
4
+
5
+ ok = None
6
+
7
+
8
+ def init_ok(config):
9
+ global ok
10
+ if ok is None:
11
+ from ok.OK import OK
12
+ config['debug'] = True
13
+ ok = OK(config)
14
+ ok.task_executor.debug_mode = True
15
+ ok.device_manager.capture_method = ImageCaptureMethod(
16
+ ok.device_manager.exit_event, [])
17
+ ok.device_manager.interaction = DoNothingInteraction(
18
+ ok.device_manager.capture_method)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ok-script
3
- Version: 0.0.332
3
+ Version: 0.0.334
4
4
  Summary: Automation with Computer Vision for Python
5
5
  Home-page: https://github.com/ok-oldking/ok-script
6
6
  Author: ok-oldking
@@ -120,6 +120,7 @@ ok/gui/widget/FlowLayout.py
120
120
  ok/gui/widget/FramelessDialog.py
121
121
  ok/gui/widget/ListTableWidgetItem.py
122
122
  ok/gui/widget/NumericTableWidgetItem.py
123
+ ok/gui/widget/SortingTableWidgetItem.py
123
124
  ok/gui/widget/StartLoadingDialog.py
124
125
  ok/gui/widget/StatusBar.py
125
126
  ok/gui/widget/Tab.py
@@ -167,6 +168,8 @@ ok/scene/Scene.py
167
168
  ok/scene/__init__.py
168
169
  ok/stats/StreamStats.py
169
170
  ok/stats/__init__.py
171
+ ok/test/OKTestRunner.py
172
+ ok/test/RunTests.py
170
173
  ok/test/TaskTestCase.py
171
174
  ok/test/__init__.py
172
175
  ok/update/DownloadMonitor.py
@@ -187,4 +190,5 @@ ok_script.egg-info/dependency_links.txt
187
190
  ok_script.egg-info/requires.txt
188
191
  ok_script.egg-info/top_level.txt
189
192
  tests/__init__.py
193
+ tests/test_box.py
190
194
  tests/test_updater.py
@@ -47,7 +47,7 @@ extensions = find_pyx_packages(base_dir)
47
47
 
48
48
  setuptools.setup(
49
49
  name="ok-script",
50
- version="0.0.332",
50
+ version="0.0.334",
51
51
  author="ok-oldking",
52
52
  author_email="firedcto@gmail.com",
53
53
  description="Automation with Computer Vision for Python",
@@ -0,0 +1,30 @@
1
+ import unittest
2
+
3
+ from ok.feature.Box import Box, sort_boxes
4
+ from ok.logging.Logger import get_logger
5
+
6
+ logger = get_logger(__name__)
7
+
8
+
9
+ class TestUpdater(unittest.TestCase):
10
+
11
+ def test_sort_box(self):
12
+ logger.debug("start test_check_for_updates")
13
+ # Create an Updater instance with a mocked config
14
+ box1 = Box(0, 10, 10, 10)
15
+ box2 = Box(10, 10, 10, 10)
16
+ box_list = [box2, box1]
17
+ box_list_sorted = sort_boxes(box_list)
18
+
19
+ # Assert the function returned the expected result
20
+ self.assertEqual([box1, box2], box_list_sorted)
21
+
22
+ box1 = Box(120, 740, 147, 38, name='41乐进', confidence=0.9998183)
23
+ box2 = Box(461, 736, 149, 41, name='41左慈', confidence=0.99900174)
24
+ box_list = [box2, box1]
25
+ box_list_sorted = sort_boxes(box_list)
26
+ self.assertEqual([box1, box2], box_list_sorted)
27
+
28
+
29
+ if __name__ == '__main__':
30
+ unittest.main()
Binary file
@@ -1,43 +0,0 @@
1
- from ok.Capture import ImageCaptureMethod
2
-
3
- import unittest
4
- from ok.interaction.DoNothingInteraction import DoNothingInteraction
5
- from ok.logging.Logger import get_logger
6
-
7
- logger = get_logger(__name__)
8
-
9
-
10
- class TaskTestCase(unittest.TestCase):
11
- _ok = None
12
- task_class = None
13
- task = None
14
- config = None
15
-
16
- def __init__(self, *args, **kwargs):
17
- super().__init__(*args, **kwargs)
18
-
19
- if TaskTestCase._ok is None:
20
- from ok.OK import OK
21
-
22
- TaskTestCase._ok = OK(self.config)
23
- TaskTestCase._ok.task_executor.debug_mode = True
24
- TaskTestCase._ok.device_manager.capture_method = ImageCaptureMethod(
25
- TaskTestCase._ok.device_manager.exit_event, [])
26
- TaskTestCase._ok.device_manager.interaction = DoNothingInteraction(
27
- TaskTestCase._ok.device_manager.capture_method)
28
-
29
- self.task = self.task_class()
30
- self.task.feature_set = TaskTestCase._ok.feature_set
31
- self.task._executor = TaskTestCase._ok.task_executor
32
-
33
- @classmethod
34
- def tearDownClass(cls):
35
- # This method will run once after all tests in this class
36
- TaskTestCase._ok.quit()
37
- logger.debug('All tests finished, resources cleaned up.')
38
-
39
- def set_image(self, image):
40
- self._ok.device_manager.capture_method.set_images([image])
41
-
42
- def tearDown(self):
43
- self.task.reset_scene()
File without changes
File without changes
File without changes
File without changes
File without changes