ascript 1.3.27__py3-none-win_amd64.whl

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 (177) hide show
  1. ascript/__init__.py +8 -0
  2. ascript/hooks/__init__.py +0 -0
  3. ascript/hooks/hook-ascript.py +2 -0
  4. ascript/windows/__init__.py +29 -0
  5. ascript/windows/daos/__init__.py +0 -0
  6. ascript/windows/daos/screen.py +143 -0
  7. ascript/windows/hardware/__init__.py +5 -0
  8. ascript/windows/hardware/keyboard.py +279 -0
  9. ascript/windows/hardware/logitech_driver.py +179 -0
  10. ascript/windows/hardware/mouse.py +308 -0
  11. ascript/windows/license/__init__.py +16 -0
  12. ascript/windows/license/achttp.cp310-win_amd64.pyd +0 -0
  13. ascript/windows/license/achttp.cp311-win_amd64.pyd +0 -0
  14. ascript/windows/license/achttp.cp312-win_amd64.pyd +0 -0
  15. ascript/windows/license/achttp.cp313-win_amd64.pyd +0 -0
  16. ascript/windows/license/achttp.cp314-win_amd64.pyd +0 -0
  17. ascript/windows/license/achttp.cp38-win_amd64.pyd +0 -0
  18. ascript/windows/license/achttp.cp39-win_amd64.pyd +0 -0
  19. ascript/windows/media/__init__.py +0 -0
  20. ascript/windows/resources/__init__.py +0 -0
  21. ascript/windows/resources/libs/logitech/x64/LogitechGkeyEnginesWrapper.dll +0 -0
  22. ascript/windows/resources/libs/logitech/x86/LogitechGkeyEnginesWrapper.dll +0 -0
  23. ascript/windows/resources/templates/__init__.py +0 -0
  24. ascript/windows/resources/templates/__init__py.win.template +51 -0
  25. ascript/windows/resources/templates/build.as.win.template +14 -0
  26. ascript/windows/resources/templates/build.py +71 -0
  27. ascript/windows/resources/templates/logo_windows.ico +0 -0
  28. ascript/windows/resources/templates/windows/main.py +50 -0
  29. ascript/windows/resources/templates/windows/pyproject.toml +44 -0
  30. ascript/windows/resources/templates/windows/res/img/logo.ico +0 -0
  31. ascript/windows/screen/__init__.py +13 -0
  32. ascript/windows/screen/as_cv.py +382 -0
  33. ascript/windows/screen/canny.py +128 -0
  34. ascript/windows/screen/code_scanner.py +72 -0
  35. ascript/windows/screen/color_algorithms.py +277 -0
  36. ascript/windows/screen/find_colors.py +251 -0
  37. ascript/windows/screen/find_images.py +217 -0
  38. ascript/windows/screen/ocr/__init__.py +4 -0
  39. ascript/windows/screen/ocr/ocr.py +223 -0
  40. ascript/windows/screen/ocr/rapidocr_hook.py +301 -0
  41. ascript/windows/screen/ocrx.py +169 -0
  42. ascript/windows/screen/screen_core.py +139 -0
  43. ascript/windows/store/__init__.py +21 -0
  44. ascript/windows/system/__init__.py +8 -0
  45. ascript/windows/system/device.py +355 -0
  46. ascript/windows/system/easy_print.py +115 -0
  47. ascript/windows/system/env.py +492 -0
  48. ascript/windows/system/exception/__init__.py +1 -0
  49. ascript/windows/system/key_value.py +145 -0
  50. ascript/windows/system/pip.py +175 -0
  51. ascript/windows/system/r.py +165 -0
  52. ascript/windows/system/runtime.py +62 -0
  53. ascript/windows/tools/__init__.py +27 -0
  54. ascript/windows/tools/__main__.py +21 -0
  55. ascript/windows/tools/action.json +33 -0
  56. ascript/windows/tools/action.py +168 -0
  57. ascript/windows/tools/colors_tool.py +391 -0
  58. ascript/windows/tools/config.py +26 -0
  59. ascript/windows/tools/dumptool.py +18 -0
  60. ascript/windows/tools/eel_api.py +495 -0
  61. ascript/windows/tools/gpplug/__init__.py +0 -0
  62. ascript/windows/tools/gpplug/plug.py +70 -0
  63. ascript/windows/tools/mouse_catch.py +168 -0
  64. ascript/windows/tools/plug_manager.py +38 -0
  65. ascript/windows/tools/tool_api.py +906 -0
  66. ascript/windows/tools/tool_window.py +56 -0
  67. ascript/windows/tools/uia_worker.py +365 -0
  68. ascript/windows/tools/web/app_store_window.html +481 -0
  69. ascript/windows/tools/web/colors.html +532 -0
  70. ascript/windows/tools/web/css/screen.css +1342 -0
  71. ascript/windows/tools/web/css/viewtree.css +357 -0
  72. ascript/windows/tools/web/flot_control.html +195 -0
  73. ascript/windows/tools/web/img/ico/favicon.png +0 -0
  74. ascript/windows/tools/web/img/ico/paintpalette.png +0 -0
  75. ascript/windows/tools/web/img/svg/find_colors.svg +1 -0
  76. ascript/windows/tools/web/img/svg/find_images.svg +1 -0
  77. ascript/windows/tools/web/img/svg/illustration-6.svg +89 -0
  78. ascript/windows/tools/web/img/svg/img_default.svg +1 -0
  79. ascript/windows/tools/web/img/svg/ocr.svg +1 -0
  80. ascript/windows/tools/web/js/screen/colors.js +466 -0
  81. ascript/windows/tools/web/js/screen/gp_plug.js +108 -0
  82. ascript/windows/tools/web/js/screen/image_mouse.js +464 -0
  83. ascript/windows/tools/web/js/screen/img_view.js +558 -0
  84. ascript/windows/tools/web/js/screen/plug.js +246 -0
  85. ascript/windows/tools/web/js/screen/screen.js +690 -0
  86. ascript/windows/tools/web/js/screen/screen_api.js +778 -0
  87. ascript/windows/tools/web/js/screen/screen_maker.js +10 -0
  88. ascript/windows/tools/web/js/utils/map.js +73 -0
  89. ascript/windows/tools/web/js/utils/upload.js +157 -0
  90. ascript/windows/tools/web/js/viewtree/niv_js.js +27 -0
  91. ascript/windows/tools/web/js/viewtree/vtree.js +1510 -0
  92. ascript/windows/tools/web/libs/bootstrap/css/bootstrap.min.css +6 -0
  93. ascript/windows/tools/web/libs/bootstrap/js/bootstrap.bundle.min.js +7 -0
  94. ascript/windows/tools/web/libs/bootstrap-icons/0-circle.svg +4 -0
  95. ascript/windows/tools/web/libs/bootstrap-icons/0-square.svg +4 -0
  96. ascript/windows/tools/web/libs/bootstrap-icons/font/bootstrap-icons.css +2078 -0
  97. ascript/windows/tools/web/libs/bootstrap-icons/font/bootstrap-icons.json +2052 -0
  98. ascript/windows/tools/web/libs/bootstrap-icons/font/bootstrap-icons.min.css +5 -0
  99. ascript/windows/tools/web/libs/bootstrap-icons/font/bootstrap-icons.scss +2090 -0
  100. ascript/windows/tools/web/libs/bootstrap-icons/font/fonts/bootstrap-icons.woff +0 -0
  101. ascript/windows/tools/web/libs/bootstrap-icons/font/fonts/bootstrap-icons.woff2 +0 -0
  102. ascript/windows/tools/web/libs/feather-icons/dist/feather.min.js +13 -0
  103. ascript/windows/tools/web/libs/feather-icons/dist/icons.json +1 -0
  104. ascript/windows/tools/web/libs/jquery/core.js +399 -0
  105. ascript/windows/tools/web/libs/jquery/jquery.js +10598 -0
  106. ascript/windows/tools/web/libs/jquery/jquery.min.js +4 -0
  107. ascript/windows/tools/web/libs/jquery/jquery.min.js.zip +0 -0
  108. ascript/windows/tools/web/libs/jquery/jquery.slim.js +8495 -0
  109. ascript/windows/tools/web/libs/jquery/jquery.slim.min.js +2 -0
  110. ascript/windows/tools/web/libs/jquery-menu/jquery.contextMenu.js +2134 -0
  111. ascript/windows/tools/web/libs/jquery-menu/jquery.contextMenu.min.css +16 -0
  112. ascript/windows/tools/web/libs/jquery-zTree/css/zTreeStyle.css +97 -0
  113. ascript/windows/tools/web/libs/jquery-zTree/img/diy/1_close.png +0 -0
  114. ascript/windows/tools/web/libs/jquery-zTree/img/diy/1_open.png +0 -0
  115. ascript/windows/tools/web/libs/jquery-zTree/img/diy/2.png +0 -0
  116. ascript/windows/tools/web/libs/jquery-zTree/img/diy/3.png +0 -0
  117. ascript/windows/tools/web/libs/jquery-zTree/img/diy/4.png +0 -0
  118. ascript/windows/tools/web/libs/jquery-zTree/img/diy/5.png +0 -0
  119. ascript/windows/tools/web/libs/jquery-zTree/img/diy/6.png +0 -0
  120. ascript/windows/tools/web/libs/jquery-zTree/img/diy/7.png +0 -0
  121. ascript/windows/tools/web/libs/jquery-zTree/img/diy/8.png +0 -0
  122. ascript/windows/tools/web/libs/jquery-zTree/img/diy/9.png +0 -0
  123. ascript/windows/tools/web/libs/jquery-zTree/img/line_conn.gif +0 -0
  124. ascript/windows/tools/web/libs/jquery-zTree/img/loading.gif +0 -0
  125. ascript/windows/tools/web/libs/jquery-zTree/img/tree-node-btn.png +0 -0
  126. ascript/windows/tools/web/libs/jquery-zTree/img/zTreeStandard.gif +0 -0
  127. ascript/windows/tools/web/libs/jquery-zTree/img/zTreeStandard.png +0 -0
  128. ascript/windows/tools/web/libs/jquery-zTree/js/jquery.ztree.all.min.js +3 -0
  129. ascript/windows/tools/web/libs/treeview/css/jquery.treeview.css +79 -0
  130. ascript/windows/tools/web/libs/treeview/img/file.png +0 -0
  131. ascript/windows/tools/web/libs/treeview/img/ico_loading.png +0 -0
  132. ascript/windows/tools/web/libs/treeview/img/icon4.png +0 -0
  133. ascript/windows/tools/web/libs/treeview/img/icon5.png +0 -0
  134. ascript/windows/tools/web/libs/treeview/img/icon6.png +0 -0
  135. ascript/windows/tools/web/libs/treeview/img/py.png +0 -0
  136. ascript/windows/tools/web/libs/treeview/img/treeview-black-line.gif +0 -0
  137. ascript/windows/tools/web/libs/treeview/img/treeview-black.gif +0 -0
  138. ascript/windows/tools/web/libs/treeview/img/treeview-default-line.gif +0 -0
  139. ascript/windows/tools/web/libs/treeview/img/treeview-default.gif +0 -0
  140. ascript/windows/tools/web/libs/treeview/img/treeview-famfamfam-line.gif +0 -0
  141. ascript/windows/tools/web/libs/treeview/img/treeview-famfamfam.gif +0 -0
  142. ascript/windows/tools/web/libs/treeview/img/treeview-gray-line.gif +0 -0
  143. ascript/windows/tools/web/libs/treeview/img/treeview-gray.gif +0 -0
  144. ascript/windows/tools/web/libs/treeview/img/treeview-red-line.gif +0 -0
  145. ascript/windows/tools/web/libs/treeview/img/treeview-red.gif +0 -0
  146. ascript/windows/tools/web/libs/treeview/js/jquery.treeview.edit.js +37 -0
  147. ascript/windows/tools/web/libs/treeview/js/jquery.treeview.js +250 -0
  148. ascript/windows/tools/web/license_window.html +255 -0
  149. ascript/windows/tools/web/plugs/a.html +653 -0
  150. ascript/windows/tools/web/plugs/demo.html +52 -0
  151. ascript/windows/tools/web/plugs/find_colors.html +629 -0
  152. ascript/windows/tools/web/plugs/find_images.html +699 -0
  153. ascript/windows/tools/web/plugs/rapidocr.html +954 -0
  154. ascript/windows/tools/web/vtree.html +496 -0
  155. ascript/windows/tools/webview/assets/index-HymBPl-I.css +1 -0
  156. ascript/windows/tools/webview/assets/index-PqA_m8tL.js +17 -0
  157. ascript/windows/tools/webview/index.html +13 -0
  158. ascript/windows/ui/__init__.py +6 -0
  159. ascript/windows/ui/app_store_window.py +272 -0
  160. ascript/windows/ui/draw_window.py +231 -0
  161. ascript/windows/ui/flot_test.py +297 -0
  162. ascript/windows/ui/flot_window.py +488 -0
  163. ascript/windows/ui/license_window.py +111 -0
  164. ascript/windows/ui/web_window.py +466 -0
  165. ascript/windows/utils/__init__.py +0 -0
  166. ascript/windows/utils/node_utils.py +20 -0
  167. ascript/windows/utils/screen_utils.py +280 -0
  168. ascript/windows/window/Selector.py +1015 -0
  169. ascript/windows/window/Window.py +747 -0
  170. ascript/windows/window/__init__.py +5 -0
  171. ascript/windows/window/launcher.py +213 -0
  172. ascript/windows/window/uia_runtime.py +26 -0
  173. ascript-1.3.27.dist-info/METADATA +41 -0
  174. ascript-1.3.27.dist-info/RECORD +177 -0
  175. ascript-1.3.27.dist-info/WHEEL +5 -0
  176. ascript-1.3.27.dist-info/entry_points.txt +2 -0
  177. ascript-1.3.27.dist-info/top_level.txt +1 -0
@@ -0,0 +1,89 @@
1
+ <svg width="1543px" height="1282px" viewBox="0 0 1543 1282" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
2
+ <!-- Generator: Sketch 63.1 (92452) - https://sketch.com -->
3
+ <title>Page 1</title>
4
+ <desc>Created with Sketch.</desc>
5
+ <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
6
+ <g id="design-team-(1)">
7
+ <rect id="Rectangle" fill="#CED5E5" fill-rule="nonzero" x="0.3" y="0.6" width="1542.6" height="57.8" rx="3"></rect>
8
+ <path d="M405.6,63.1 L405.6,859.1 L1484.7,859.1 C1516.6,859.1 1542.5,833.2 1542.5,801.3 L1542.5,63.1 L405.6,63.1 Z" id="Path" fill="#F1F2F7" fill-rule="nonzero"></path>
9
+ <path d="M0.3,64.4 L0.3,802.5 L0.3,802.5 C0.3,834.4 26.2,860.3 58.1,860.3 L400,860.3 L400,64.3 L0.3,64.3 L0.3,64.4 Z" id="Path" fill="#CED5E5" fill-rule="nonzero"></path>
10
+ <g id="Group" transform="translate(590.000000, 310.000000)" fill="#F8972D" fill-rule="nonzero">
11
+ <path d="M104.5,135.8 L104.5,135.8 C161.7,135.8 208.1,182.2 208.1,239.4 L208.1,300.8 L0.9,300.8 L0.9,239.4 C0.9,182.2 47.3,135.8 104.5,135.8 Z" id="Path"></path>
12
+ <circle id="Oval" cx="104.5" cy="53.8" r="53.8"></circle>
13
+ </g>
14
+ <path d="M1248.1,610.9 L588.2,610.9 C565.7,610.9 547.4,592.6 547.4,570.1 L547.4,258.3 C547.4,235.8 565.7,217.5 588.2,217.5 L1248.1,217.5 C1270.6,217.5 1288.9,235.8 1288.9,258.3 L1288.9,570 C1288.9,592.6 1270.6,610.9 1248.1,610.9 Z" id="Path" stroke="#FFFFFF" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"></path>
15
+ <line x1="22.1" y1="1181.1" x2="331.9" y2="1181.1" id="Path" stroke="#CED5E5" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"></line>
16
+ <line x1="736.7" y1="1181.1" x2="1514.8" y2="1181.1" id="Path" stroke="#CED5E5" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"></line>
17
+ <polygon id="Path" fill="#FFDFD7" fill-rule="nonzero" points="537.1 902.6 588.9 1197 621 1189.8 605.9 884.4"></polygon>
18
+ <path d="M627,492.1 L655.8,446.2 C655.8,446.2 663.5,444.1 660.8,453.9 C658.2,463.7 653.9,471.9 653.9,471.9 C653.9,471.9 667.1,481.1 668.7,489.3 C670.3,497.5 649.5,504.3 649.5,504.3 L627,492.1 Z" id="Path" fill="#FFDFD7" fill-rule="nonzero"></path>
19
+ <path d="M507.8,602.2 C507.8,602.2 593.2,543.6 626,490.3 L651.9,504.2 C651.9,504.2 584.7,615.9 530.1,648.7 L505,621.6 L507.8,602.2 Z" id="Path" fill="#008AFF" fill-rule="nonzero"></path>
20
+ <path d="M130.1,1020.3 C130.1,1020.3 76.8,978.3 91.5,930.7 C106.2,883.1 147.6,870.6 88.9,766.3 C30.2,662 102.8,589.4 158.4,590.6 C214,591.7 226.4,690.4 201.5,742.5 C176.6,794.6 252.5,795.8 253.1,860.4 C253.7,925 220.8,955.6 210.6,1020.3 L130.1,1020.3 L130.1,1020.3 Z" id="Path" fill="#51CB96" fill-rule="nonzero"></path>
21
+ <path d="M1225.9,330.3 L902.7,330.3 C895.8,330.3 890.1,324.7 890.1,317.7 L890.1,317.7 C890.1,310.8 895.7,305.1 902.7,305.1 L1225.9,305.1 C1232.8,305.1 1238.5,310.7 1238.5,317.7 L1238.5,317.7 C1238.4,324.6 1232.8,330.3 1225.9,330.3 Z" id="Path" fill="#CED5E5" fill-rule="nonzero"></path>
22
+ <path d="M1225.9,384.2 L902.7,384.2 C895.8,384.2 890.1,378.6 890.1,371.6 L890.1,371.6 C890.1,364.7 895.7,359 902.7,359 L1225.9,359 C1232.8,359 1238.5,364.6 1238.5,371.6 L1238.5,371.6 C1238.4,378.6 1232.8,384.2 1225.9,384.2 Z" id="Path" fill="#CED5E5" fill-rule="nonzero"></path>
23
+ <path d="M1225.9,438.2 L902.7,438.2 C895.8,438.2 890.1,432.6 890.1,425.6 L890.1,425.6 C890.1,418.7 895.7,413 902.7,413 L1225.9,413 C1232.8,413 1238.5,418.6 1238.5,425.6 L1238.5,425.6 C1238.4,432.6 1232.8,438.2 1225.9,438.2 Z" id="Path" fill="#CED5E5" fill-rule="nonzero"></path>
24
+ <path d="M1225.9,492.2 L902.7,492.2 C895.8,492.2 890.1,486.6 890.1,479.6 L890.1,479.6 C890.1,472.7 895.7,467 902.7,467 L1225.9,467 C1232.8,467 1238.5,472.6 1238.5,479.6 L1238.5,479.6 C1238.4,486.6 1232.8,492.2 1225.9,492.2 Z" id="Path" fill="#CED5E5" fill-rule="nonzero"></path>
25
+ <path d="M1225.9,546.2 L902.7,546.2 C895.8,546.2 890.1,540.6 890.1,533.6 L890.1,533.6 C890.1,526.7 895.7,521 902.7,521 L1225.9,521 C1232.8,521 1238.5,526.6 1238.5,533.6 L1238.5,533.6 C1238.4,540.6 1232.8,546.2 1225.9,546.2 Z" id="Path" fill="#CED5E5" fill-rule="nonzero"></path>
26
+ <path d="M967.1,727 C967.1,727 964.3,718.2 971.6,711.1 C978.9,703.9 985.4,697.7 998.9,690.2 L1032.2,678.8 L1046.9,706.5 L967.1,727 Z" id="Path" fill="#FCDD8B" fill-rule="nonzero"></path>
27
+ <g id="Group" transform="translate(948.000000, 284.000000)" fill="#283444" fill-rule="nonzero">
28
+ <path d="M12.8,997.4 L12.8,997.4 C5.9,997.4 0.4,991.7 0.6,984.8 L31.6,12.5 C31.8,5.9 37.2,0.7 43.8,0.7 L43.8,0.7 C50.7,0.7 56.2,6.4 56,13.3 L25,985.6 C24.7,992.2 19.3,997.4 12.8,997.4 Z" id="Path"></path>
29
+ <path d="M267.2,997.4 L267.2,997.4 C274.1,997.4 279.6,991.7 279.4,984.8 L248.4,12.5 C248.2,5.9 242.8,0.7 236.2,0.7 L236.2,0.7 C229.3,0.7 223.8,6.4 224,13.3 L255,985.6 C255.2,992.2 260.6,997.4 267.2,997.4 Z" id="Path"></path>
30
+ <rect id="Rectangle" x="44.4" y="17.7" width="190.5" height="16.4"></rect>
31
+ <rect id="Rectangle" x="40.8" y="153.6" width="197.7" height="16.4"></rect>
32
+ <rect id="Rectangle" x="33.8" y="289.5" width="211.7" height="16.4"></rect>
33
+ <rect id="Rectangle" x="32.5" y="425.4" width="214.3" height="16.4"></rect>
34
+ <rect id="Rectangle" x="26.1" y="561.2" width="227.1" height="16.4"></rect>
35
+ <rect id="Rectangle" x="22.3" y="697.1" width="234.7" height="16.4"></rect>
36
+ <rect id="Rectangle" x="17.4" y="833" width="244.5" height="16.4"></rect>
37
+ </g>
38
+ <polygon id="Path" fill="#FFC933" fill-rule="nonzero" points="606 869.7 630.4 1150.1 569.6 1154.1 524.4 880"></polygon>
39
+ <polygon id="Path" fill="#FFDFD7" fill-rule="nonzero" points="481.3 906.7 501.5 1213.3 535.1 1209.5 553.5 895.8"></polygon>
40
+ <polygon id="Path" fill="#FFC933" fill-rule="nonzero" points="468.5 884.7 485.9 1158 549.5 1155.2 554.7 867.1"></polygon>
41
+ <polygon id="Path" fill="#FFC933" fill-rule="nonzero" points="481.3 1158 553.5 1154.1 553.5 1170.9 483.6 1174.6"></polygon>
42
+ <path d="M498.3,1192.3 L495.7,1228.8 L587.4,1233.6 C587.4,1233.6 567.5,1209 534.6,1203.2 L537.7,1187.1 L498.3,1192.3 Z" id="Path" fill="#283444" fill-rule="nonzero"></path>
43
+ <path d="M485.9,610.9 C485.9,610.9 463.3,636.6 461.5,667.6 C459.7,698.6 458.1,885.5 458.1,885.5 C458.1,885.5 597.4,880.9 612,866.3 C612,866.3 564.4,714.3 553.5,676.1 C542.6,637.9 511.4,617 511.4,617 L485.9,610.9 Z" id="Path" fill="#008AFF" fill-rule="nonzero"></path>
44
+ <path d="M490.6,587.6 L485.9,610.9 C485.9,610.9 494.8,618.6 511.4,617 L507.4,591 C507.4,590.9 501.4,580.9 490.6,587.6 Z" id="Path" fill="#FFDFD7" fill-rule="nonzero"></path>
45
+ <path d="M505,500.8 C505,500.8 532.9,567.8 519.6,584.8 C506.2,601.9 472.3,577.6 472.3,577.6 C472.3,577.6 422.5,549.7 428.6,515.7 C434.7,481.7 497,479.2 505,500.8 Z" id="Path" fill="#FFDFD7" fill-rule="nonzero"></path>
46
+ <polygon id="Path" fill="#FFC933" fill-rule="nonzero" points="566.3 1153.1 633.2 1148.5 633.8 1165.6 568.3 1169"></polygon>
47
+ <path d="M587.5,1188.8 L587.5,1224.4 L676.8,1222.8 C676.8,1222.8 655.8,1200.3 623.5,1196.9 L625.4,1181.1 L587.5,1188.8 Z" id="Path" fill="#283444" fill-rule="nonzero"></path>
48
+ <path d="M502.4,496.5 C502.4,496.5 515.9,478.6 498.7,471.7 C481.5,464.8 471.4,480.2 471.4,480.2 C471.4,480.2 464.1,467.7 449.1,473.7 C434.1,479.8 438.6,491.1 438.6,491.1 C438.6,491.1 426.5,485.3 418.8,497.9 C411.1,510.4 418,520.3 424.9,522.7 C424.9,522.7 410.1,530.6 421.7,548.2 C431.3,562.9 449.1,585.4 482.7,584 C487.3,583.8 483.3,562 480.3,550.5 C477.4,539 476,534.6 479,528.6 C481.1,524.4 483.6,524 485.9,524.4 C492.1,525.4 496,544 496,544 L501.9,538.1 C501.9,538.1 491.5,515.1 494.4,505.3 C496.7,502.5 499.4,499.6 502.4,496.5 Z" id="Path" fill="#283444" fill-rule="nonzero"></path>
49
+ <polygon id="Path" fill="#008AFF" fill-rule="nonzero" points="507.4 676.8 490 914.4 455.6 914.4 461.6 667.5"></polygon>
50
+ <path d="M457.2,914.4 C457.2,914.4 450.5,956.7 452.3,965.6 C454.1,974.5 460,983.6 466.7,984.6 C473.4,985.6 483.2,984.7 483.8,978 C484.7,967.7 484.5,939 484.5,939 C484.5,939 487.5,965 491.6,964.6 C495.9,964.2 493.6,944.1 492.4,931.7 C491.2,919.4 488.2,914.3 488.2,914.3 L457.2,914.3 L457.2,914.4 Z" id="Path" fill="#FFDFD7" fill-rule="nonzero"></path>
51
+ <path d="M507.4,676.8 L492.2,883.8 C492.2,883.8 598.4,878.8 612,866.2" id="Path" stroke="#027FE9" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"></path>
52
+ <path d="M537.7,643.7 C537.7,643.7 529.2,631.5 511.4,617 C511.4,617 499.3,620.4 485.9,610.9" id="Path" stroke="#027FE9" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"></path>
53
+ <line x1="552.1" y1="1048.1" x2="554.7" y2="925.3" id="Path" stroke="#FFBB23" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"></line>
54
+ <line x1="481.3" y1="1158" x2="553.5" y2="1154.1" id="Path" stroke="#FFBB23" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"></line>
55
+ <line x1="566.3" y1="1153.1" x2="633.2" y2="1148.5" id="Path" stroke="#FFBB23" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"></line>
56
+ <polyline id="Path" stroke="#FFFFFF" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" points="163.6 1012.5 186.5 875.8 136.3 732.3 144.8 654.6"></polyline>
57
+ <line x1="174.1" y1="949.7" x2="140.6" y2="910.3" id="Path" stroke="#FFFFFF" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"></line>
58
+ <line x1="186.5" y1="875.8" x2="213.7" y2="841.7" id="Path" stroke="#FFFFFF" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"></line>
59
+ <line x1="136.3" y1="732.3" x2="106.6" y2="703.1" id="Path" stroke="#FFFFFF" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"></line>
60
+ <path d="M229.6,1057.7 L247.7,1011.8 L92.1,1011.8 L110.2,1057.7 L90.8,1106.3 C83.8,1123.8 85.9,1143.6 96.3,1159.3 L96.3,1159.3 C105,1172.3 119.6,1180.2 135.3,1180.2 L204.5,1180.2 C220.2,1180.2 234.8,1172.4 243.5,1159.3 L243.5,1159.3 C254,1143.6 256,1123.8 249,1106.3 L229.6,1057.7 Z" id="Path" fill="#C7C7C7" fill-rule="nonzero"></path>
61
+ <line x1="150.1" y1="771.5" x2="169" y2="732.3" id="Path" stroke="#FFFFFF" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"></line>
62
+ <circle id="Oval" fill="#FFFFFF" fill-rule="nonzero" cx="634.7" cy="709.4" r="35"></circle>
63
+ <circle id="Oval" fill="#FFFFFF" fill-rule="nonzero" cx="759.7" cy="709.4" r="35"></circle>
64
+ <circle id="Oval" fill="#FFFFFF" fill-rule="nonzero" cx="884.7" cy="709.4" r="35"></circle>
65
+ <rect id="Rectangle" fill="#CED5E5" fill-rule="nonzero" x="1501.7" y="196" width="15" height="513.4"></rect>
66
+ <g id="Group" transform="translate(1502.000000, 175.000000)" fill="#CED5E5" fill-rule="nonzero">
67
+ <path d="M6.34433261,0.755395683 L0.180773222,12.7697842 C-0.332856727,13.7769784 0.309180709,15 1.33644061,15 L13.6635594,15 C14.6908193,15 15.3328567,13.7769784 14.8192268,12.7697842 L8.65566739,0.755395683 C8.14203744,-0.251798561 6.85796256,-0.251798561 6.34433261,0.755395683 Z" id="Path"></path>
68
+ <path d="M8.65566739,555.244604 L14.8192268,543.230216 C15.3328567,542.223022 14.6908193,541 13.6635594,541 L1.33644061,541 C0.309180709,541 -0.332856727,542.223022 0.180773222,543.230216 L6.34433261,555.244604 C6.85796256,556.251799 8.14203744,556.251799 8.65566739,555.244604 Z" id="Path"></path>
69
+ </g>
70
+ <path d="M873,192.1 C873,192.1 860.1,174.1 851.6,169.7 C841.8,164.6 834.5,157.1 822.9,158 C816.5,158.5 822.3,172.4 833.3,185.8 C842.4,196.8 855.6,207.4 862.4,209.8 C877.3,214.9 873,192.1 873,192.1 Z" id="Path" fill="#FFDFD7" fill-rule="nonzero"></path>
71
+ <polygon id="Path" fill="#292A29" fill-rule="nonzero" points="1161.2 484.5 1164.5 819.6 1131.5 819.6 1077.1 508.3 1153.8 480.6"></polygon>
72
+ <path d="M1079.3,845.2 C1079.3,845.2 1080.8,837.2 1091.1,833.3 C1101.3,829.4 1114.7,822 1131.6,819.6 L1164.5,819.6 L1167.1,845.3 L1079.3,845.3 L1079.3,845.2 Z" id="Path" fill="#FCDD8B" fill-rule="nonzero"></path>
73
+ <path d="M1027.7,465.7 C1027.7,465.7 919.9,537.9 908.6,557.2 C899.5,572.7 998.8,690.1 998.8,690.1 L1032.1,678.7 L970.7,573.4 C970.7,573.4 1105,519.7 1149.8,486.7 L1027.7,465.7 Z" id="Path" fill="#363736" fill-rule="nonzero"></path>
74
+ <path d="M1064.9,155.3 C1064.9,155.3 1052.6,194 1054.3,218.2 C1056.1,242.4 1089.8,220 1100.8,211.2 C1111.9,202.4 1110.1,160.9 1110.1,160.9 C1110.1,160.9 1094.3,133.4 1064.9,155.3 Z" id="Path" fill="#FFDFD7" fill-rule="nonzero"></path>
75
+ <polygon id="Path" fill="#FFDFD7" fill-rule="nonzero" points="1083.3 220 1080.4 255.8 1096.4 258.5 1106.5 255.8 1098.2 207.3"></polygon>
76
+ <path d="M1062.5,161 C1062.5,161 1055.4,150.2 1072.7,138.4 C1090,126.6 1120.8,132.1 1139.4,156.8 C1158,181.5 1160.8,170.2 1182.4,186 C1204,201.8 1230.4,228.3 1213.3,252 C1198.9,272.1 1165,279.7 1132.3,251.6 C1102.3,225.8 1097.7,216.5 1086.4,182.8 C1080.8,166.1 1075.7,169 1062.5,161 Z" id="Path" fill="#272626" fill-rule="nonzero"></path>
77
+ <path d="M1043.9,315 L1022.5,463.9 C1022.5,463.9 1099.9,493.2 1164.5,485.8 C1164.5,485.8 1151.5,321.5 1106.1,253.3 C1106.1,253.3 1094.5,259.8 1080.4,254.1 C1080.4,254 1057.5,281.1 1043.9,315 Z" id="Path" fill="#FFFFFF" fill-rule="nonzero"></path>
78
+ <path d="M1093.5,280.4 C1093.5,280.4 1012.9,265 979.8,253.2 C961.4,246.6 877.2,189.4 877.2,189.4 C877.2,189.4 861.7,196.5 861.7,216.5 L946.5,284.7 L1064,334.3 L1087.1,307.3 L1093.5,280.4 Z" id="Path" fill="#FFFFFF" fill-rule="nonzero"></path>
79
+ <path d="M324.7,209.7 L75.5,209.7 C67.1,209.7 60.2,202.9 60.2,194.4 L60.2,194.4 C60.2,186 67,179.1 75.5,179.1 L324.8,179.1 C333.2,179.1 340.1,185.9 340.1,194.4 L340.1,194.4 C340,202.9 333.2,209.7 324.7,209.7 Z" id="Path" fill="#FFFFFF" fill-rule="nonzero"></path>
80
+ <path d="M324.7,300 L75.5,300 C67.1,300 60.2,293.2 60.2,284.7 L60.2,284.7 C60.2,276.3 67,269.4 75.5,269.4 L324.8,269.4 C333.2,269.4 340.1,276.2 340.1,284.7 L340.1,284.7 C340,293.2 333.2,300 324.7,300 Z" id="Path" fill="#FFFFFF" fill-rule="nonzero"></path>
81
+ <path d="M324.7,390.2 L75.5,390.2 C67.1,390.2 60.2,383.4 60.2,374.9 L60.2,374.9 C60.2,366.5 67,359.6 75.5,359.6 L324.8,359.6 C333.2,359.6 340.1,366.4 340.1,374.9 L340.1,374.9 C340,383.4 333.2,390.2 324.7,390.2 Z" id="Path" fill="#FFFFFF" fill-rule="nonzero"></path>
82
+ <line x1="842.1" y1="217.5" x2="842.1" y2="610.9" id="Path" stroke="#FFFFFF" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"></line>
83
+ <path d="M1120.8,280.8 L1160,353.9 C1160,353.9 1162.4,320.2 1172,287.8 C1172,287.8 1174.2,290.3 1181.2,292 C1188.2,293.7 1193.5,292.9 1193.5,292.9 C1193.5,292.9 1193.9,378.7 1182.9,399.2 C1179.5,405.6 1164.5,401.1 1152.5,396.2 C1143.7,392.6 1136.4,388.7 1136.4,388.7 L1121.3,284.7 L1120.8,280.8 Z" id="Path" fill="#FFFFFF" fill-rule="nonzero"></path>
84
+ <path d="M1152.5,396.2 C1148.8,375.6 1147.8,374 1144.9,361.3" id="Path" stroke="#F1F2F7" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"></path>
85
+ <path d="M1172.4,288.4 C1172.4,288.4 1171.7,282.6 1177,280.9 C1182.3,279.2 1198.6,281.5 1199.6,287.1 C1200.6,292.7 1196.5,294.4 1195.4,292.3 C1194.3,290.2 1192.6,293 1192.6,293 C1192.6,293 1177.6,297.1 1172.4,288.4 Z" id="Path" fill="#FFDFD7" fill-rule="nonzero"></path>
86
+ </g>
87
+ <circle id="Oval" stroke="#979797" fill="#FFFFFF" cx="36" cy="32" r="10"></circle>
88
+ </g>
89
+ </svg>
@@ -0,0 +1 @@
1
+ <?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1769534320180" class="icon" viewBox="0 0 1161 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4631" xmlns:xlink="http://www.w3.org/1999/xlink" width="226.7578125" height="200"><path d="M1111.033201 0H44.876494C20.398406 0 0 20.398406 0 44.876494v934.247012c0 24.478088 20.398406 44.876494 44.876494 44.876494h1067.5166c24.478088 0 44.876494-20.398406 44.876494-44.876494V44.876494C1155.909695 20.398406 1135.511288 0 1111.033201 0z" fill="#E6E6E9" p-id="4632"></path><path d="M356.292165 422.926959c48.956175 0 88.393094-39.436919 88.393094-88.393094S405.24834 246.14077 356.292165 246.14077s-88.393094 39.436919-88.393095 88.393095c-1.359894 47.596282 38.077025 88.393094 88.393095 88.393094z m399.808765-55.755644L492.281541 738.422311l-135.989376-189.025233L133.269588 867.612218h889.370518L756.10093 367.171315z" fill="#B5B5B6" p-id="4633"></path></svg>
@@ -0,0 +1 @@
1
+ <?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1769496468116" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3618" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M168.8 117.6h93.6c15.2 0 27.2-12 27.2-27.2s-12-27.2-27.2-27.2H168C110.4 64 64 110.4 64 168v95.2c0 15.2 12 26.4 27.2 26.4s27.2-12 27.2-27.2V168c-0.8-27.2 22.4-50.4 50.4-50.4zM856 117.6H762.4c-15.2 0-27.2-12-27.2-27.2s12-27.2 27.2-27.2L856 64c57.6 0 104 46.4 104 104v95.2c0 15.2-12 26.4-27.2 26.4s-27.2-12-27.2-27.2V168c0.8-27.2-21.6-50.4-49.6-50.4zM168.8 906.4h93.6c15.2 0 27.2 12 27.2 27.2s-12 27.2-27.2 27.2H168c-57.6 0-104-46.4-104-104V761.6c0-15.2 12-26.4 27.2-26.4s27.2 12 27.2 27.2v94.4c-0.8 26.4 22.4 49.6 50.4 49.6zM856 906.4H761.6c-15.2 0-27.2 12-27.2 27.2s12 27.2 27.2 27.2H856c57.6 0 104-46.4 104-104V761.6c0-15.2-12-26.4-27.2-26.4s-27.2 12-27.2 27.2v94.4c0.8 26.4-21.6 49.6-49.6 49.6z" fill="#8a8a8a" p-id="3619"></path><path d="M723.2 228H244c-48 0-87.2 39.2-87.2 87.2s39.2 87.2 87.2 87.2h152v343.2c0 48 39.2 87.2 87.2 87.2s87.2-39.2 87.2-87.2V402.4h152c48 0 87.2-39.2 87.2-87.2 0.8-48-38.4-87.2-86.4-87.2z" fill="#8a8a8a" p-id="3620"></path><path d="M843.2 576H652c-19.2 0-34.4 15.2-34.4 34.4s15.2 34.4 34.4 34.4h60.8v136.8c0 19.2 15.2 34.4 34.4 34.4s34.4-15.2 34.4-34.4v-136h60.8c19.2 0 34.4-15.2 34.4-34.4 0.8-20-14.4-35.2-33.6-35.2z" fill="#8a8a8a" p-id="3621"></path></svg>
@@ -0,0 +1,466 @@
1
+
2
+
3
+ /**
4
+ * 选择窗口
5
+ */
6
+ function selectWindow(displayText, hwnd, window_title) {
7
+ // 1. 更新全局变量
8
+ window.hwnd = hwnd;
9
+ window.window_title = window_title;
10
+ window.gp.window.hwnd = hwnd;
11
+ window.gp.window.title = window_title;
12
+
13
+ // 2. 更新主按钮 UI
14
+ $('#windowSelector').attr('data-current-hwnd', hwnd);
15
+ $('#windowSelector_content').text(displayText);
16
+
17
+ // 3. 更新列表中的 active 状态
18
+ $('#windowList .dropdown-item').removeClass('active');
19
+ $(`#windowList .dropdown-item[data-hwnd="${hwnd}"]`).addClass('active');
20
+
21
+ // 4. 执行截图逻辑
22
+ capture_window_image();
23
+ }
24
+
25
+ let captureInFlight = false;
26
+
27
+ function withTimeout(promise, timeoutMs, message) {
28
+ return Promise.race([
29
+ promise,
30
+ new Promise((_, reject) => {
31
+ setTimeout(() => reject(new Error(message)), timeoutMs);
32
+ })
33
+ ]);
34
+ }
35
+
36
+ async function capture_window_image() {
37
+ if (captureInFlight) {
38
+ return;
39
+ }
40
+ captureInFlight = true;
41
+ const loader = document.getElementById('imagelist_loading');
42
+ const startTime = Date.now(); // 记录开始时间
43
+
44
+ // 1. 显示 Loading
45
+ loader.classList.remove('d-none');
46
+
47
+ try {
48
+ const imageElement = document.getElementById('img_preview');
49
+ // 执行截图操作
50
+ let res = await withTimeout(
51
+ eel.colors_tool_screenshot(window.hwnd)(),
52
+ 15000,
53
+ '截图请求超时,请重试'
54
+ );
55
+
56
+ if (res.status === "success") {
57
+ showImg(res.save_info.path);
58
+
59
+ if (typeof getImgList === "function") {
60
+ getImgList();
61
+ }
62
+ } else {
63
+ throw new Error(res.message || "截图失败");
64
+ }
65
+ } catch (error) {
66
+ window.gp.info.error("截图失败", "请确保目标窗口存在且未被最小化。\n错误详情已记录到控制台。\n"+error);
67
+ console.error("截图失败:", error);
68
+ } finally {
69
+ captureInFlight = false;
70
+ // 2. 延时取消 Loading
71
+ const minLoadingTime = 300; // 设置最小等待时长 (毫秒)
72
+ const elapsedTime = Date.now() - startTime;
73
+ const remainingTime = Math.max(0, minLoadingTime - elapsedTime);
74
+
75
+ setTimeout(() => {
76
+ loader.classList.add('d-none');
77
+ }, remainingTime);
78
+ }
79
+ }
80
+
81
+ /**
82
+ * 调用 Python 打开本地文件夹
83
+ * @param {string} path 文件夹的路径
84
+ */
85
+ function openLocalFolder(path) {
86
+ if (eel) {
87
+ // 直接调用 Python 中定义的 open_folder
88
+ eel.open_folder(path)((success) => {
89
+ if (success) {
90
+ console.log("文件夹已成功打开");
91
+ } else {
92
+ console.error("打开文件夹失败,请检查路径");
93
+ alert("无法打开文件夹:" + path);
94
+ }
95
+ });
96
+ }
97
+ }
98
+
99
+ // 监听点击事件
100
+ $('#cache_imgs_path').on('click', function (e) {
101
+ e.preventDefault(); // 阻止默认的超链接跳转行为
102
+ // 获取当前标签里的文字(即路径 C://abc)
103
+ // 或者你可以直接写死路径,取决于你的需求
104
+ let folderPath = $(this).text();
105
+
106
+ // 调用 Python 暴露给 Eel 的方法
107
+ if (typeof eel !== 'undefined') {
108
+ eel.open_folder(folderPath)((success) => {
109
+ if (!success) {
110
+ console.error("无法打开文件夹:", folderPath);
111
+ }
112
+ });
113
+ }
114
+ });
115
+
116
+ $('#toolbar_img_delall').on('click', async function () {
117
+ const $btn = $(this);
118
+ const $text = $('#delall_text');
119
+ const $spinner = $('#delall_spinner');
120
+ const pathToDelete = $('#cache_imgs_path').text(); // 获取当前显示的路径
121
+
122
+ if (!pathToDelete || pathToDelete === "C://abc") {
123
+ alert("无效的路径");
124
+ return;
125
+ }
126
+
127
+ if (confirm("确定要永久删除该文件夹下的所有内容吗?")) {
128
+ // --- 1. 进入 Loading 状态 ---
129
+ $btn.prop('disabled', true); // 禁用按钮防止重复点击
130
+ $text.text('处理中...');
131
+ $spinner.show();
132
+
133
+ try {
134
+ // --- 2. 调用 Python 后端 ---
135
+ const success = await eel.file_delete(pathToDelete)();
136
+
137
+ if (success) {
138
+ // --- 3. 成功处理 ---
139
+ $(".screen-img-list").empty(); // 清空前端图片网格
140
+ $('.imglist_size').text('0'); // 重置计数
141
+ console.log("清理成功");
142
+ } else {
143
+ alert("删除失败,请检查文件是否被占用。");
144
+ }
145
+ } catch (err) {
146
+ console.error("调用 Python 出错:", err);
147
+ } finally {
148
+ // --- 4. 恢复按钮状态 ---
149
+ $btn.prop('disabled', false);
150
+ $text.text('清空');
151
+ $spinner.hide();
152
+ }
153
+ }
154
+ });
155
+
156
+ /**
157
+ * 更新右侧的临时通知 (类似 PyCharm 风格)
158
+ * @param {string} msg 消息内容
159
+ * @param {boolean} isError 是否为错误提示
160
+ */
161
+ let bottomNotifTimer = null;
162
+
163
+ function showBottomNotif(msg, isError = false) {
164
+ const $notif = $('#status_notification');
165
+ const $dot = $('#status_dot');
166
+
167
+ if (bottomNotifTimer) clearTimeout(bottomNotifTimer);
168
+
169
+ // 1. 设置内容
170
+ $notif.text(msg);
171
+
172
+ // 2. 切换到活跃颜色 (适配主题)
173
+ if (isError) {
174
+ $notif.removeClass('status-active').addClass('status-error');
175
+ $dot.show().removeClass('text-primary').addClass('text-danger');
176
+ } else {
177
+ $notif.removeClass('status-error').addClass('status-active');
178
+ $dot.show().removeClass('text-danger').addClass('text-primary');
179
+ }
180
+
181
+ // 3. 3秒后恢复到 VSCode 风格的低调灰色
182
+ bottomNotifTimer = setTimeout(() => {
183
+ $notif.text('就绪').removeClass('status-active status-error');
184
+ $dot.fadeOut(500); // 圆点慢慢消失
185
+ }, 3000);
186
+ }
187
+
188
+ /**
189
+ * 拷贝文本到剪贴板
190
+ * @param {string} text 需要拷贝的内容
191
+ * @param {string} successMsg 成功后的提示文字(可选)
192
+ */
193
+ async function copyToClipboard(text, successMsg = "已复制到剪贴板") {
194
+ // 1. 优先使用现代 Clipboard API
195
+ if (navigator.clipboard && window.isSecureContext) {
196
+ try {
197
+ await navigator.clipboard.writeText(text);
198
+ showBottomNotif(text + successMsg, false); // 调用你之前的消息通知函数
199
+ return true;
200
+ } catch (err) {
201
+ console.error("Clipboard API 失败,尝试降级方案", err);
202
+ }
203
+ }
204
+
205
+ // 2. 降级方案:创建隐藏的 textarea 使用 execCommand
206
+ const textArea = document.createElement("textarea");
207
+ textArea.value = text;
208
+
209
+ // 确保 textarea 在移动端和各种布局下不可见
210
+ textArea.style.position = "fixed";
211
+ textArea.style.left = "-9999px";
212
+ textArea.style.top = "0";
213
+ document.body.appendChild(textArea);
214
+
215
+ textArea.focus();
216
+ textArea.select();
217
+
218
+ try {
219
+ const successful = document.execCommand('copy');
220
+ if (successful) {
221
+ showBottomNotif(successMsg, false);
222
+ } else {
223
+ showBottomNotif("复制失败", true);
224
+ }
225
+ } catch (err) {
226
+ showBottomNotif("无法访问剪贴板", true);
227
+ console.error("降级方案也失败了:", err);
228
+ }
229
+
230
+ document.body.removeChild(textArea);
231
+ }
232
+
233
+
234
+ // 全局存储当前在线的 HWND 列表,方便对比
235
+ let currentOnlineHwnds = new Set();
236
+
237
+ $(document).ready(function () {
238
+ const $backdrop = $('#dropdownBackdrop');
239
+ const $selectorBtn = $('#windowSelector');
240
+ const $dropdownParent = $selectorBtn.parent();
241
+
242
+ // --- A. 初始化:监听下拉框状态 ---
243
+ $dropdownParent.on('show.bs.dropdown', function () {
244
+ $backdrop.addClass('show').fadeIn(200);
245
+ refreshWindowsInPlace();
246
+ });
247
+
248
+ $dropdownParent.on('hide.bs.dropdown', function () {
249
+ $backdrop.removeClass('show').fadeOut(200);
250
+ });
251
+
252
+ // --- B. 关键点:进入页面自动弹出 ---
253
+ // 我们先静默刷新一次,然后显示。
254
+ // 使用 setTimeout 确保 DOM 和 Eel 已经完全准备就绪
255
+ // setTimeout(() => {
256
+ // const dropdownInstance = new bootstrap.Dropdown($selectorBtn[0]);
257
+ // dropdownInstance.show();
258
+ // }, 300); // 300ms 延迟可以避免页面加载时的闪烁
259
+
260
+ });
261
+
262
+ async function refreshWindowsInPlace() {
263
+ let response = await eel.get_online_windows()();
264
+
265
+ if (response.status === "success") {
266
+ const $menu = $('#windowList');
267
+ const newData = response.data;
268
+ const newHwnds = newData.map(win => String(win.hwnd));
269
+
270
+ // 获取除了“全屏”以外的所有项
271
+ const domItems = $menu.find('.dropdown-item').not('[data-hwnd="null"]');
272
+
273
+ // 1. 处理已消失项 (跳过全屏项)
274
+ domItems.each(function () {
275
+ const $item = $(this);
276
+ const itemHwnd = String($item.attr('data-hwnd'));
277
+ if (!newHwnds.includes(itemHwnd)) {
278
+ $item.addClass('inst-disabled text-decoration-line-through');
279
+ $item.find('.win-title-text').html($item.attr('data-display') + ' <small>(已消失)</small>');
280
+ }
281
+ });
282
+
283
+ // 2. 检查全屏项是否存在,不存在则初始化
284
+ if ($menu.find('[data-hwnd="null"]').length === 0) {
285
+ const fullScreenHtml = generateWindowItemHtml({ display: '全屏截图', hwnd: 'null', title: 'Full Screen' });
286
+ $menu.prepend(fullScreenHtml + '<li><hr class="dropdown-divider"></li>');
287
+ }
288
+
289
+ // 3. 更新/同步现有项
290
+ let hasNewHeader = false;
291
+ newData.forEach(win => {
292
+ const winHwnd = String(win.hwnd);
293
+ const $existingItem = $menu.find(`[data-hwnd="${winHwnd}"]`);
294
+
295
+ if ($existingItem.length === 0) {
296
+ if (!hasNewHeader && domItems.length > 0) {
297
+ $menu.append('<li><hr class="dropdown-divider"></li>');
298
+ $menu.append('<li><h6 class="dropdown-header text-primary">新增窗口</h6></li>');
299
+ hasNewHeader = true;
300
+ }
301
+ $menu.append(generateWindowItemHtml(win, false));
302
+ } else {
303
+ $existingItem.removeClass('inst-disabled text-decoration-line-through');
304
+ $existingItem.find('.win-title-text').text(win.display);
305
+
306
+ // 处理 Active 状态 (支持 null 的比较)
307
+ const currentSelection = window.hwnd === null ? "null" : String(window.hwnd);
308
+ if (winHwnd === currentSelection) {
309
+ $existingItem.addClass('active');
310
+ } else {
311
+ $existingItem.removeClass('active');
312
+ }
313
+ }
314
+ });
315
+
316
+ // 额外处理:如果当前选中的是全屏,确保全屏项 active
317
+ if (window.hwnd === null) {
318
+ $menu.find('[data-hwnd="null"]').addClass('active');
319
+ } else {
320
+ $menu.find('[data-hwnd="null"]').removeClass('active');
321
+ }
322
+ }
323
+ }
324
+
325
+
326
+ function generateWindowItemHtml(win, isDisabled = false) {
327
+ const isMatched = (window.hwnd && String(win.hwnd) === String(window.hwnd));
328
+ const activeClass = isMatched ? 'active' : '';
329
+ const disabledClass = isDisabled ? 'inst-disabled text-decoration-line-through' : '';
330
+ const statusText = isDisabled ? ' <small>(已消失)</small>' : '';
331
+
332
+ return `
333
+ <li>
334
+ <a class="dropdown-item ${activeClass} ${disabledClass} window-item-link"
335
+ href="javascript:void(0)"
336
+ data-hwnd="${win.hwnd}"
337
+ data-display="${win.display}"
338
+ onclick="selectWindow('${win.display}', ${win.hwnd}, '${win.title}')">
339
+
340
+ <span class="win-title-text">${win.display}${statusText}</span>
341
+ <span class="win-hwnd-num">${win.hwnd}</span>
342
+ </a>
343
+ </li>`;
344
+ }
345
+ /**
346
+ * 彻底刷新:当列表关闭后,重新构建干净的列表,以便下次打开是整洁的
347
+ */
348
+ async function cleanUpWindowList() {
349
+ let response = await eel.get_online_windows()();
350
+ if (response.status === "success") {
351
+ const $menu = $('#windowList');
352
+ $menu.empty();
353
+ $menu.append('<li><h6 class="dropdown-header">运行中的应用</h6></li>');
354
+
355
+ response.data.forEach(win => {
356
+ let isMatched = (window.hwnd && String(win.hwnd) === String(window.hwnd));
357
+ let item = `<li>
358
+ <a class="dropdown-item ${isMatched ? 'active' : ''}"
359
+ href="javascript:void(0)"
360
+ data-hwnd="${win.hwnd}"
361
+ data-display="${win.display}"
362
+ onclick="selectWindow('${win.display}', ${win.hwnd}, '${win.title}')">
363
+ ${win.display}
364
+ </a>
365
+ </li>`;
366
+ $menu.append(item);
367
+ });
368
+ }
369
+ }
370
+
371
+ $(document).ready(function () {
372
+ const $container = $('.screen-img-container');
373
+ const $handle = $('.touch_slide');
374
+ let isResizing = false;
375
+
376
+ $handle.on('mousedown', function (e) {
377
+ isResizing = true;
378
+ $handle.addClass('active');
379
+
380
+ // 防止拖拽过程中选中文字
381
+ $('body').css('user-select', 'none');
382
+
383
+ // 记录初始位置(如果需要计算 offset 可以用,这里直接用 clientX 即可)
384
+ $(document).on('mousemove', handleMouseMove);
385
+ $(document).on('mouseup', stopResizing);
386
+ });
387
+
388
+ function handleMouseMove(e) {
389
+ if (!isResizing) return;
390
+
391
+ // 关键修正:鼠标位置 - 容器左边缘距离视口的距离 = 容器内部的实际宽度
392
+ const containerOffsetLeft = $container[0].getBoundingClientRect().left;
393
+ let newWidthPx = e.clientX - containerOffsetLeft;
394
+
395
+ // 设定限制范围
396
+ const minWidth = 300;
397
+ const maxWidth = window.innerWidth * 0.8;
398
+
399
+ if (newWidthPx >= minWidth && newWidthPx <= maxWidth) {
400
+ $container.css('width', newWidthPx + 'px');
401
+
402
+ // 这里的联动很重要:如果左侧有 left: -40px 这种偏移,
403
+ // 宽度太小时需要处理,防止 UI 溢出
404
+ }
405
+ }
406
+
407
+ function stopResizing() {
408
+ if (isResizing) {
409
+ isResizing = false;
410
+ $handle.removeClass('active');
411
+ $('body').css('user-select', '');
412
+ $(document).off('mousemove', handleMouseMove);
413
+ $(document).off('mouseup', stopResizing);
414
+
415
+ // 拖拽停止后,可能需要强制让图片自适应一次
416
+ if (typeof resetViewToFit === 'function') {
417
+ resetViewToFit(0);
418
+ }
419
+ }
420
+ }
421
+ });
422
+
423
+ function showError(title, content) {
424
+ const modalElement = document.getElementById('errorModal');
425
+ const msgElement = document.getElementById('errorModalMsg');
426
+ const titleElement = document.getElementById('codeWindowTitle');
427
+
428
+ // 更新模拟窗口的标题栏文字
429
+ titleElement.innerText = (title || "SYSTEM ERROR").toUpperCase();
430
+
431
+ // 判断内容类型
432
+ const isSimple = content && content.length < 60 && !content.includes('\n');
433
+
434
+ if (isSimple) {
435
+ msgElement.classList.add('simple-msg');
436
+ msgElement.innerText = content;
437
+ } else {
438
+ msgElement.classList.remove('simple-msg');
439
+ msgElement.innerText = content || "No error details found.";
440
+ }
441
+
442
+ bootstrap.Modal.getOrCreateInstance(modalElement).show();
443
+ }
444
+
445
+ // 顺便写个复制功能,方便用户反馈 Bug
446
+ function copyTraceback() {
447
+ const text = document.getElementById('errorModalMsg').innerText;
448
+ navigator.clipboard.writeText(text).then(() => {
449
+ // alert("已复制到剪贴板");
450
+ bootstrap.Modal.getInstance(document.getElementById('errorModal')).hide();
451
+ window.gp.info.noti("错误信息已复制到剪贴板", false);
452
+ });
453
+ }
454
+
455
+
456
+
457
+ /**
458
+ * 当用户按下全局快捷键时,Python 会调用此函数
459
+ */
460
+ function triggerScreenshotUI() {
461
+ console.log("快捷键已触发:准备截图");
462
+
463
+ capture_window_image();
464
+ }
465
+
466
+ eel.expose(triggerScreenshotUI);