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.
- ascript/__init__.py +8 -0
- ascript/hooks/__init__.py +0 -0
- ascript/hooks/hook-ascript.py +2 -0
- ascript/windows/__init__.py +29 -0
- ascript/windows/daos/__init__.py +0 -0
- ascript/windows/daos/screen.py +143 -0
- ascript/windows/hardware/__init__.py +5 -0
- ascript/windows/hardware/keyboard.py +279 -0
- ascript/windows/hardware/logitech_driver.py +179 -0
- ascript/windows/hardware/mouse.py +308 -0
- ascript/windows/license/__init__.py +16 -0
- ascript/windows/license/achttp.cp310-win_amd64.pyd +0 -0
- ascript/windows/license/achttp.cp311-win_amd64.pyd +0 -0
- ascript/windows/license/achttp.cp312-win_amd64.pyd +0 -0
- ascript/windows/license/achttp.cp313-win_amd64.pyd +0 -0
- ascript/windows/license/achttp.cp314-win_amd64.pyd +0 -0
- ascript/windows/license/achttp.cp38-win_amd64.pyd +0 -0
- ascript/windows/license/achttp.cp39-win_amd64.pyd +0 -0
- ascript/windows/media/__init__.py +0 -0
- ascript/windows/resources/__init__.py +0 -0
- ascript/windows/resources/libs/logitech/x64/LogitechGkeyEnginesWrapper.dll +0 -0
- ascript/windows/resources/libs/logitech/x86/LogitechGkeyEnginesWrapper.dll +0 -0
- ascript/windows/resources/templates/__init__.py +0 -0
- ascript/windows/resources/templates/__init__py.win.template +51 -0
- ascript/windows/resources/templates/build.as.win.template +14 -0
- ascript/windows/resources/templates/build.py +71 -0
- ascript/windows/resources/templates/logo_windows.ico +0 -0
- ascript/windows/resources/templates/windows/main.py +50 -0
- ascript/windows/resources/templates/windows/pyproject.toml +44 -0
- ascript/windows/resources/templates/windows/res/img/logo.ico +0 -0
- ascript/windows/screen/__init__.py +13 -0
- ascript/windows/screen/as_cv.py +382 -0
- ascript/windows/screen/canny.py +128 -0
- ascript/windows/screen/code_scanner.py +72 -0
- ascript/windows/screen/color_algorithms.py +277 -0
- ascript/windows/screen/find_colors.py +251 -0
- ascript/windows/screen/find_images.py +217 -0
- ascript/windows/screen/ocr/__init__.py +4 -0
- ascript/windows/screen/ocr/ocr.py +223 -0
- ascript/windows/screen/ocr/rapidocr_hook.py +301 -0
- ascript/windows/screen/ocrx.py +169 -0
- ascript/windows/screen/screen_core.py +139 -0
- ascript/windows/store/__init__.py +21 -0
- ascript/windows/system/__init__.py +8 -0
- ascript/windows/system/device.py +355 -0
- ascript/windows/system/easy_print.py +115 -0
- ascript/windows/system/env.py +492 -0
- ascript/windows/system/exception/__init__.py +1 -0
- ascript/windows/system/key_value.py +145 -0
- ascript/windows/system/pip.py +175 -0
- ascript/windows/system/r.py +165 -0
- ascript/windows/system/runtime.py +62 -0
- ascript/windows/tools/__init__.py +27 -0
- ascript/windows/tools/__main__.py +21 -0
- ascript/windows/tools/action.json +33 -0
- ascript/windows/tools/action.py +168 -0
- ascript/windows/tools/colors_tool.py +391 -0
- ascript/windows/tools/config.py +26 -0
- ascript/windows/tools/dumptool.py +18 -0
- ascript/windows/tools/eel_api.py +495 -0
- ascript/windows/tools/gpplug/__init__.py +0 -0
- ascript/windows/tools/gpplug/plug.py +70 -0
- ascript/windows/tools/mouse_catch.py +168 -0
- ascript/windows/tools/plug_manager.py +38 -0
- ascript/windows/tools/tool_api.py +906 -0
- ascript/windows/tools/tool_window.py +56 -0
- ascript/windows/tools/uia_worker.py +365 -0
- ascript/windows/tools/web/app_store_window.html +481 -0
- ascript/windows/tools/web/colors.html +532 -0
- ascript/windows/tools/web/css/screen.css +1342 -0
- ascript/windows/tools/web/css/viewtree.css +357 -0
- ascript/windows/tools/web/flot_control.html +195 -0
- ascript/windows/tools/web/img/ico/favicon.png +0 -0
- ascript/windows/tools/web/img/ico/paintpalette.png +0 -0
- ascript/windows/tools/web/img/svg/find_colors.svg +1 -0
- ascript/windows/tools/web/img/svg/find_images.svg +1 -0
- ascript/windows/tools/web/img/svg/illustration-6.svg +89 -0
- ascript/windows/tools/web/img/svg/img_default.svg +1 -0
- ascript/windows/tools/web/img/svg/ocr.svg +1 -0
- ascript/windows/tools/web/js/screen/colors.js +466 -0
- ascript/windows/tools/web/js/screen/gp_plug.js +108 -0
- ascript/windows/tools/web/js/screen/image_mouse.js +464 -0
- ascript/windows/tools/web/js/screen/img_view.js +558 -0
- ascript/windows/tools/web/js/screen/plug.js +246 -0
- ascript/windows/tools/web/js/screen/screen.js +690 -0
- ascript/windows/tools/web/js/screen/screen_api.js +778 -0
- ascript/windows/tools/web/js/screen/screen_maker.js +10 -0
- ascript/windows/tools/web/js/utils/map.js +73 -0
- ascript/windows/tools/web/js/utils/upload.js +157 -0
- ascript/windows/tools/web/js/viewtree/niv_js.js +27 -0
- ascript/windows/tools/web/js/viewtree/vtree.js +1510 -0
- ascript/windows/tools/web/libs/bootstrap/css/bootstrap.min.css +6 -0
- ascript/windows/tools/web/libs/bootstrap/js/bootstrap.bundle.min.js +7 -0
- ascript/windows/tools/web/libs/bootstrap-icons/0-circle.svg +4 -0
- ascript/windows/tools/web/libs/bootstrap-icons/0-square.svg +4 -0
- ascript/windows/tools/web/libs/bootstrap-icons/font/bootstrap-icons.css +2078 -0
- ascript/windows/tools/web/libs/bootstrap-icons/font/bootstrap-icons.json +2052 -0
- ascript/windows/tools/web/libs/bootstrap-icons/font/bootstrap-icons.min.css +5 -0
- ascript/windows/tools/web/libs/bootstrap-icons/font/bootstrap-icons.scss +2090 -0
- ascript/windows/tools/web/libs/bootstrap-icons/font/fonts/bootstrap-icons.woff +0 -0
- ascript/windows/tools/web/libs/bootstrap-icons/font/fonts/bootstrap-icons.woff2 +0 -0
- ascript/windows/tools/web/libs/feather-icons/dist/feather.min.js +13 -0
- ascript/windows/tools/web/libs/feather-icons/dist/icons.json +1 -0
- ascript/windows/tools/web/libs/jquery/core.js +399 -0
- ascript/windows/tools/web/libs/jquery/jquery.js +10598 -0
- ascript/windows/tools/web/libs/jquery/jquery.min.js +4 -0
- ascript/windows/tools/web/libs/jquery/jquery.min.js.zip +0 -0
- ascript/windows/tools/web/libs/jquery/jquery.slim.js +8495 -0
- ascript/windows/tools/web/libs/jquery/jquery.slim.min.js +2 -0
- ascript/windows/tools/web/libs/jquery-menu/jquery.contextMenu.js +2134 -0
- ascript/windows/tools/web/libs/jquery-menu/jquery.contextMenu.min.css +16 -0
- ascript/windows/tools/web/libs/jquery-zTree/css/zTreeStyle.css +97 -0
- ascript/windows/tools/web/libs/jquery-zTree/img/diy/1_close.png +0 -0
- ascript/windows/tools/web/libs/jquery-zTree/img/diy/1_open.png +0 -0
- ascript/windows/tools/web/libs/jquery-zTree/img/diy/2.png +0 -0
- ascript/windows/tools/web/libs/jquery-zTree/img/diy/3.png +0 -0
- ascript/windows/tools/web/libs/jquery-zTree/img/diy/4.png +0 -0
- ascript/windows/tools/web/libs/jquery-zTree/img/diy/5.png +0 -0
- ascript/windows/tools/web/libs/jquery-zTree/img/diy/6.png +0 -0
- ascript/windows/tools/web/libs/jquery-zTree/img/diy/7.png +0 -0
- ascript/windows/tools/web/libs/jquery-zTree/img/diy/8.png +0 -0
- ascript/windows/tools/web/libs/jquery-zTree/img/diy/9.png +0 -0
- ascript/windows/tools/web/libs/jquery-zTree/img/line_conn.gif +0 -0
- ascript/windows/tools/web/libs/jquery-zTree/img/loading.gif +0 -0
- ascript/windows/tools/web/libs/jquery-zTree/img/tree-node-btn.png +0 -0
- ascript/windows/tools/web/libs/jquery-zTree/img/zTreeStandard.gif +0 -0
- ascript/windows/tools/web/libs/jquery-zTree/img/zTreeStandard.png +0 -0
- ascript/windows/tools/web/libs/jquery-zTree/js/jquery.ztree.all.min.js +3 -0
- ascript/windows/tools/web/libs/treeview/css/jquery.treeview.css +79 -0
- ascript/windows/tools/web/libs/treeview/img/file.png +0 -0
- ascript/windows/tools/web/libs/treeview/img/ico_loading.png +0 -0
- ascript/windows/tools/web/libs/treeview/img/icon4.png +0 -0
- ascript/windows/tools/web/libs/treeview/img/icon5.png +0 -0
- ascript/windows/tools/web/libs/treeview/img/icon6.png +0 -0
- ascript/windows/tools/web/libs/treeview/img/py.png +0 -0
- ascript/windows/tools/web/libs/treeview/img/treeview-black-line.gif +0 -0
- ascript/windows/tools/web/libs/treeview/img/treeview-black.gif +0 -0
- ascript/windows/tools/web/libs/treeview/img/treeview-default-line.gif +0 -0
- ascript/windows/tools/web/libs/treeview/img/treeview-default.gif +0 -0
- ascript/windows/tools/web/libs/treeview/img/treeview-famfamfam-line.gif +0 -0
- ascript/windows/tools/web/libs/treeview/img/treeview-famfamfam.gif +0 -0
- ascript/windows/tools/web/libs/treeview/img/treeview-gray-line.gif +0 -0
- ascript/windows/tools/web/libs/treeview/img/treeview-gray.gif +0 -0
- ascript/windows/tools/web/libs/treeview/img/treeview-red-line.gif +0 -0
- ascript/windows/tools/web/libs/treeview/img/treeview-red.gif +0 -0
- ascript/windows/tools/web/libs/treeview/js/jquery.treeview.edit.js +37 -0
- ascript/windows/tools/web/libs/treeview/js/jquery.treeview.js +250 -0
- ascript/windows/tools/web/license_window.html +255 -0
- ascript/windows/tools/web/plugs/a.html +653 -0
- ascript/windows/tools/web/plugs/demo.html +52 -0
- ascript/windows/tools/web/plugs/find_colors.html +629 -0
- ascript/windows/tools/web/plugs/find_images.html +699 -0
- ascript/windows/tools/web/plugs/rapidocr.html +954 -0
- ascript/windows/tools/web/vtree.html +496 -0
- ascript/windows/tools/webview/assets/index-HymBPl-I.css +1 -0
- ascript/windows/tools/webview/assets/index-PqA_m8tL.js +17 -0
- ascript/windows/tools/webview/index.html +13 -0
- ascript/windows/ui/__init__.py +6 -0
- ascript/windows/ui/app_store_window.py +272 -0
- ascript/windows/ui/draw_window.py +231 -0
- ascript/windows/ui/flot_test.py +297 -0
- ascript/windows/ui/flot_window.py +488 -0
- ascript/windows/ui/license_window.py +111 -0
- ascript/windows/ui/web_window.py +466 -0
- ascript/windows/utils/__init__.py +0 -0
- ascript/windows/utils/node_utils.py +20 -0
- ascript/windows/utils/screen_utils.py +280 -0
- ascript/windows/window/Selector.py +1015 -0
- ascript/windows/window/Window.py +747 -0
- ascript/windows/window/__init__.py +5 -0
- ascript/windows/window/launcher.py +213 -0
- ascript/windows/window/uia_runtime.py +26 -0
- ascript-1.3.27.dist-info/METADATA +41 -0
- ascript-1.3.27.dist-info/RECORD +177 -0
- ascript-1.3.27.dist-info/WHEEL +5 -0
- ascript-1.3.27.dist-info/entry_points.txt +2 -0
- ascript-1.3.27.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,778 @@
|
|
|
1
|
+
// var gp_job = [];
|
|
2
|
+
|
|
3
|
+
// ----
|
|
4
|
+
const strackDir = "~/data/gp/"
|
|
5
|
+
var temp_gp_dataname = "data.gp"
|
|
6
|
+
var workspace;
|
|
7
|
+
api_get_workspace();
|
|
8
|
+
|
|
9
|
+
var gpapi = {
|
|
10
|
+
file: {
|
|
11
|
+
file_url:api_file_url,
|
|
12
|
+
url: api_file_url,
|
|
13
|
+
img_url:api_file_url,
|
|
14
|
+
path: {
|
|
15
|
+
workspace: '~',
|
|
16
|
+
model: "~/modules/",
|
|
17
|
+
screen: "~/data/screenshot/",
|
|
18
|
+
concat: api_file_path_concat
|
|
19
|
+
},
|
|
20
|
+
read:api_file_read,
|
|
21
|
+
copy: api_file_copy,
|
|
22
|
+
dir:api_file_dir,
|
|
23
|
+
rname:api_file_rname,
|
|
24
|
+
delete: api_file_delect,
|
|
25
|
+
write: api_file_write,
|
|
26
|
+
},
|
|
27
|
+
marks: {
|
|
28
|
+
point: {
|
|
29
|
+
daos: [],
|
|
30
|
+
add: api_marks_point_add,
|
|
31
|
+
clear: api_marks_point_clear
|
|
32
|
+
},
|
|
33
|
+
rect: {
|
|
34
|
+
daos: [],
|
|
35
|
+
add: api_marks_rect_add,
|
|
36
|
+
clear: api_marks_rect_clear
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
image: {
|
|
40
|
+
show:api_image_show,
|
|
41
|
+
get_rect: api_get_rect,
|
|
42
|
+
set_rect: api_set_rect,
|
|
43
|
+
get_color: {},
|
|
44
|
+
crop: api_image_crop
|
|
45
|
+
},
|
|
46
|
+
module: {
|
|
47
|
+
current: undefined,
|
|
48
|
+
all: undefined,
|
|
49
|
+
get_all: api_module_getlist
|
|
50
|
+
},
|
|
51
|
+
sys:{
|
|
52
|
+
copy:api_sys_copy,
|
|
53
|
+
alert:api_sys_tip
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
gpapi.stack = gpapi.strack
|
|
58
|
+
|
|
59
|
+
function api_image_show(path){
|
|
60
|
+
gp_path = path;
|
|
61
|
+
showImg(gp_path)
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function api_get_workspace(){
|
|
65
|
+
// $.ajax({
|
|
66
|
+
// url: "http://127.0.0.1:9097/env",
|
|
67
|
+
// type: 'GET',
|
|
68
|
+
// async:false,
|
|
69
|
+
// dataType: 'json',
|
|
70
|
+
// success: function(data) {
|
|
71
|
+
// workspace = data.data.home;
|
|
72
|
+
// },
|
|
73
|
+
// error: function(xhr, status, error) {
|
|
74
|
+
// return null;
|
|
75
|
+
// }
|
|
76
|
+
// });
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function api_getimage() {
|
|
80
|
+
alert("img")
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function api_get_rect() {
|
|
84
|
+
// var rect = scope_pos[0].x
|
|
85
|
+
if (scope_pos != null && scope_pos.length == 2) {
|
|
86
|
+
if (scope_pos[0] != null && scope_pos[1] != null) {
|
|
87
|
+
return [scope_pos[0].x, scope_pos[0].y, scope_pos[1].x, scope_pos[1].y]
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
return []
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
function api_set_rect(rect,noti_iframe) {
|
|
94
|
+
|
|
95
|
+
if (rect == undefined) {
|
|
96
|
+
scope_pos = [null, null];
|
|
97
|
+
|
|
98
|
+
// change_part_rect(false)
|
|
99
|
+
return
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// alert(rect)
|
|
103
|
+
var down = { x: rect[0], y: rect[1], color: null }
|
|
104
|
+
var up = { x: rect[2], y: rect[3], color: null }
|
|
105
|
+
scope_pos = [down, up]
|
|
106
|
+
|
|
107
|
+
var rimgw = image_data_object.width;
|
|
108
|
+
var rimgh = image_data_object.height;
|
|
109
|
+
|
|
110
|
+
var cimgw = image.width;
|
|
111
|
+
var cimgh = image.height;
|
|
112
|
+
|
|
113
|
+
if (scope_pos[0] != null && scope_pos[1] != null) {
|
|
114
|
+
var rboxw = scope_pos[1].x - scope_pos[0].x;
|
|
115
|
+
var rboxh = scope_pos[1].y - scope_pos[0].y;
|
|
116
|
+
//计算目标box 的 宽度和高度
|
|
117
|
+
var tboxw = rboxw / (rimgw / cimgw);
|
|
118
|
+
var tboxh = rboxh / (rimgh / cimgh);
|
|
119
|
+
//计算目标box 的 left 和top值
|
|
120
|
+
var tboxleft = scope_pos[0].x / (rimgw / cimgw);
|
|
121
|
+
var tboxtop = scope_pos[0].y / (rimgw / cimgw);
|
|
122
|
+
|
|
123
|
+
part_box.css("left", tboxleft + "px");
|
|
124
|
+
part_box.css("top", tboxtop + "px");
|
|
125
|
+
part_box.css("width", tboxw + "px");
|
|
126
|
+
part_box.css("height", tboxh + "px");
|
|
127
|
+
|
|
128
|
+
if (tboxw > 0 & tboxh > 0) {
|
|
129
|
+
part_box.css("display", "block");
|
|
130
|
+
$(part_box).addClass("shadow-lg");
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// part_box.css("width", 2 + "px");
|
|
135
|
+
// part_box.css("height", 2 + "px");
|
|
136
|
+
|
|
137
|
+
// alert(scope_pos[0].x)
|
|
138
|
+
|
|
139
|
+
// part_box.css("left", down.x + "px");
|
|
140
|
+
// part_box.css("top", down.x.y + "px");
|
|
141
|
+
// part_box.css("width", (up.x-down.x)+"px");
|
|
142
|
+
// part_box.css("height", (up.y-down.y)+"px");
|
|
143
|
+
// part_box.css("display", "block");
|
|
144
|
+
|
|
145
|
+
if(noti_iframe==undefined){
|
|
146
|
+
noti_iframe = false;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
change_part_rect(noti_iframe)
|
|
150
|
+
|
|
151
|
+
// changeImageMarkSize()
|
|
152
|
+
|
|
153
|
+
// changeBoxRect()
|
|
154
|
+
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
function api_get_xycolor() {
|
|
158
|
+
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
function api_strack_load() {
|
|
162
|
+
// alert("load")
|
|
163
|
+
var gp_file = getQueryString("gp", window.location.href);
|
|
164
|
+
if (gp_file) {
|
|
165
|
+
var file_name = gp_file.split('/').pop();
|
|
166
|
+
var gp_target_name = "as_gp_"+file_name.split(".")[0]
|
|
167
|
+
$.ajax({
|
|
168
|
+
url: `${baseUrl}/api/gp/strack/load`,
|
|
169
|
+
type: 'post',
|
|
170
|
+
data: { file: gp_file,name:gp_target_name },
|
|
171
|
+
async: false,
|
|
172
|
+
success: function (res) {
|
|
173
|
+
if (res.code == 1) {
|
|
174
|
+
// alert(res.data)
|
|
175
|
+
var daos = JSON.parse(res.data)
|
|
176
|
+
gpapi.strack.info.gpname = file_name.split(".")[0]
|
|
177
|
+
gpapi.strack.info.name = gp_target_name
|
|
178
|
+
gpapi.strack.info.path = strackDir + gp_target_name
|
|
179
|
+
gpapi.strack.info.data_path = gpapi.strack.info.path + "/" + temp_gp_dataname
|
|
180
|
+
|
|
181
|
+
gpapi.strack.daos = daos;
|
|
182
|
+
fill_gp_job(gpapi.strack.daos)
|
|
183
|
+
|
|
184
|
+
}
|
|
185
|
+
},
|
|
186
|
+
error: function (err) {
|
|
187
|
+
// alert(err)
|
|
188
|
+
}
|
|
189
|
+
})
|
|
190
|
+
} else {
|
|
191
|
+
// 创建临时GP文件夹以及数据文件
|
|
192
|
+
var temp_gpname = "temp"
|
|
193
|
+
var temp_gpdir = strackDir +"/"+temp_gpname
|
|
194
|
+
|
|
195
|
+
// $.ajax({
|
|
196
|
+
// url: `${baseUrl}/api/file/remove`,
|
|
197
|
+
// type: 'post',
|
|
198
|
+
// data: {path: "~/data/cache/" },
|
|
199
|
+
// async: false,
|
|
200
|
+
// success: function (res) {
|
|
201
|
+
// // alert(res)
|
|
202
|
+
// // alert(JSON.stringify(res))
|
|
203
|
+
// },
|
|
204
|
+
// error: function (err) {
|
|
205
|
+
// alert(JSON.stringify(err))
|
|
206
|
+
// }
|
|
207
|
+
// })
|
|
208
|
+
|
|
209
|
+
$.ajax({
|
|
210
|
+
url: `${baseUrl}/api/file/create`,
|
|
211
|
+
type: 'post',
|
|
212
|
+
data: {path: temp_gpdir, name: temp_gp_dataname, type: "file" },
|
|
213
|
+
async: false,
|
|
214
|
+
success: function (res) {
|
|
215
|
+
// alert(JSON.stringify(res))
|
|
216
|
+
},
|
|
217
|
+
error: function (err) {
|
|
218
|
+
alert(JSON.stringify(err))
|
|
219
|
+
}
|
|
220
|
+
})
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
gpapi.strack.info.gpname = temp_gpname
|
|
225
|
+
gpapi.strack.info.name = temp_gpname
|
|
226
|
+
gpapi.strack.info.path = temp_gpdir
|
|
227
|
+
gpapi.strack.info.data_path = temp_gpdir + "/" + temp_gp_dataname
|
|
228
|
+
gpapi.strack.info.id = temp_gpname
|
|
229
|
+
|
|
230
|
+
// alert(gpapi.strack.info.data_path)
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
function api_strack_export(path, name) {
|
|
235
|
+
// 保存数据文件
|
|
236
|
+
|
|
237
|
+
// var gp = {
|
|
238
|
+
// id:gpapi.strack.info.id,
|
|
239
|
+
// data:gpapi.strack.daos
|
|
240
|
+
// }
|
|
241
|
+
|
|
242
|
+
var gp = gpapi.strack.daos;
|
|
243
|
+
|
|
244
|
+
// alert(gpapi.strack.info.data_path)
|
|
245
|
+
|
|
246
|
+
var data = JSON.stringify(gp)
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
$.ajax({
|
|
251
|
+
url: `${baseUrl}/api/file/save`,
|
|
252
|
+
type: 'post',
|
|
253
|
+
data: { path: gpapi.strack.info.data_path, content: data },
|
|
254
|
+
async: false,
|
|
255
|
+
success: function (res) {
|
|
256
|
+
// alert("亨功")
|
|
257
|
+
},
|
|
258
|
+
error: function (err) {
|
|
259
|
+
// alert(err)
|
|
260
|
+
}
|
|
261
|
+
})
|
|
262
|
+
|
|
263
|
+
// alert(data)
|
|
264
|
+
|
|
265
|
+
// 打包gp文件,
|
|
266
|
+
|
|
267
|
+
var source_path = gpapi.strack.info.path
|
|
268
|
+
|
|
269
|
+
// alert(source_path)
|
|
270
|
+
|
|
271
|
+
var target_path = path + "/res/gp/" + name + ".gp"
|
|
272
|
+
// alert(target_path)
|
|
273
|
+
$.ajax({
|
|
274
|
+
url: `${baseUrl}/api/gp/strack/export`,
|
|
275
|
+
type: 'post',
|
|
276
|
+
data: { source: source_path, target: target_path },
|
|
277
|
+
async: false,
|
|
278
|
+
success: function (res) {
|
|
279
|
+
// alert(res)
|
|
280
|
+
// $("#gp_export_submitf").text("已保存")
|
|
281
|
+
},
|
|
282
|
+
error: function (err) {
|
|
283
|
+
alert(err)
|
|
284
|
+
}
|
|
285
|
+
})
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
function api_strack_res_get_path(file) {
|
|
289
|
+
var path = gpapi.file.path.concat([gpapi.strack.info.path, file])
|
|
290
|
+
return path
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
function api_strack_file(file){
|
|
294
|
+
var path = gpapi.file.path.concat([gpapi.strack.info.path, file])
|
|
295
|
+
var url = `${baseUrl}/api/file/get?path=${path}`;
|
|
296
|
+
return {path:path,url:url}
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
function api_strack_daos_exist(nid) {
|
|
300
|
+
if (nid) {
|
|
301
|
+
var exist = false
|
|
302
|
+
gpapi.strack.daos.forEach(dao => {
|
|
303
|
+
if (dao.nid == nid) {
|
|
304
|
+
exist = true
|
|
305
|
+
return
|
|
306
|
+
}
|
|
307
|
+
});
|
|
308
|
+
|
|
309
|
+
return exist
|
|
310
|
+
} else {
|
|
311
|
+
return false
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
function api_strack_insert(data) {
|
|
316
|
+
gpframe = document.getElementById("gpiframe")
|
|
317
|
+
if (gpframe && gpframe.contentWindow.gp) {
|
|
318
|
+
if (api_strack_daos_exist(gpframe.contentWindow.gp.nid)) {
|
|
319
|
+
//更新
|
|
320
|
+
gpframe.contentWindow.gp["data"] = data
|
|
321
|
+
fill_gp_job(gpapi.strack.daos)
|
|
322
|
+
} else {
|
|
323
|
+
//添加
|
|
324
|
+
var gp = JSON.parse(JSON.stringify(gpframe.contentWindow.gp));
|
|
325
|
+
gp["nid"] = Date.now()
|
|
326
|
+
if (data) {
|
|
327
|
+
gp["data"] = data
|
|
328
|
+
}
|
|
329
|
+
gpapi.strack.daos.push(gp)
|
|
330
|
+
gpframe.contentWindow.gp = gp
|
|
331
|
+
// gp_job.push(gp)
|
|
332
|
+
fill_gp_job(gpapi.strack.daos)
|
|
333
|
+
}
|
|
334
|
+
gpapi.strack.run(on_strack_run_result)
|
|
335
|
+
// excute_gpjob()
|
|
336
|
+
} else {
|
|
337
|
+
alert("Error 没有找到GP对象")
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
function api_strack_update(data) {
|
|
342
|
+
gpframe = document.getElementById("gpiframe")
|
|
343
|
+
if (gpframe && gpframe.contentWindow.gp) {
|
|
344
|
+
if (data) {
|
|
345
|
+
gpframe.contentWindow.gp["data"] = data
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
fill_gp_job(gpapi.strack.daos)
|
|
349
|
+
// excute_gpjob()
|
|
350
|
+
gpapi.strack.run(on_strack_run_result)
|
|
351
|
+
} else {
|
|
352
|
+
alert("Error 没有找到GP对象")
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
function api_strack_delect(nid) {
|
|
357
|
+
var niddom = undefined;
|
|
358
|
+
// alert(gpapi.strack.daos.length)
|
|
359
|
+
gpapi.strack.daos.forEach((gp, index) => {
|
|
360
|
+
if (gp.nid == nid) {
|
|
361
|
+
niddom = index
|
|
362
|
+
}
|
|
363
|
+
});
|
|
364
|
+
|
|
365
|
+
if (niddom != undefined) {
|
|
366
|
+
gpapi.strack.daos.splice(niddom, 1)
|
|
367
|
+
fill_gp_job(gpapi.strack.daos)
|
|
368
|
+
gpapi.strack.run(on_strack_run_result)
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
// alert(gpapi.strack.daos.length)
|
|
372
|
+
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
function api_strack_clear() {
|
|
376
|
+
var niddom = undefined;
|
|
377
|
+
// alert(gpapi.strack.daos.length)
|
|
378
|
+
gpapi.strack.daos = [];
|
|
379
|
+
|
|
380
|
+
fill_gp_job(gpapi.strack.daos)
|
|
381
|
+
|
|
382
|
+
|
|
383
|
+
|
|
384
|
+
// alert(gpapi.strack.daos.length)
|
|
385
|
+
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
function api_strack_test(data, listener) {
|
|
389
|
+
|
|
390
|
+
var gp = JSON.parse(JSON.stringify(gpframe.contentWindow.gp));
|
|
391
|
+
// gpapi.strack.daos.push(gp)
|
|
392
|
+
|
|
393
|
+
var param_gpjob = gpapi.strack.daos.slice();
|
|
394
|
+
|
|
395
|
+
if (!gp.nid) {
|
|
396
|
+
gp["nid"] = Date.now()
|
|
397
|
+
if (data) {
|
|
398
|
+
gp["data"] = data
|
|
399
|
+
}
|
|
400
|
+
param_gpjob.push(gp)
|
|
401
|
+
} else {
|
|
402
|
+
param_gpjob.forEach(item => {
|
|
403
|
+
if (item.nid == gp.nid) {
|
|
404
|
+
item.data = data
|
|
405
|
+
}
|
|
406
|
+
});
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
$.ajax({
|
|
410
|
+
url: `${baseUrl}/api/screen/gp`,
|
|
411
|
+
type: 'post',
|
|
412
|
+
data: {device_id:device_id, strack: JSON.stringify(param_gpjob), image: source_path, gp: gpapi.strack.info.name },
|
|
413
|
+
async: true,
|
|
414
|
+
success: function (res) {
|
|
415
|
+
if (res.code == 1) {
|
|
416
|
+
res.data = JSON.parse(res.data)
|
|
417
|
+
// fill_excute_res(data,param_gpjob[param_gpjob.length-1])
|
|
418
|
+
}
|
|
419
|
+
listener(res)
|
|
420
|
+
|
|
421
|
+
},
|
|
422
|
+
error: function (err) {
|
|
423
|
+
listener(0, err)
|
|
424
|
+
}
|
|
425
|
+
})
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
function api_strack_run(listener, pos) {
|
|
429
|
+
|
|
430
|
+
$("#imagelist_loading").show();
|
|
431
|
+
|
|
432
|
+
var currentGP = undefined;
|
|
433
|
+
|
|
434
|
+
if (gpapi.strack.daos == null || gpapi.strack.daos.length < 1 || pos == -1) {
|
|
435
|
+
// $("#imagelist_loading").show();
|
|
436
|
+
// showImg(source_path)
|
|
437
|
+
|
|
438
|
+
var res = {
|
|
439
|
+
code: 1,
|
|
440
|
+
data: {
|
|
441
|
+
image: source_path, data: ""
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
listener(res)
|
|
446
|
+
return;
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
var param_gpjob = gpapi.strack.daos;
|
|
450
|
+
|
|
451
|
+
if (pos != undefined) {
|
|
452
|
+
param_gpjob = gpapi.strack.daos.slice(0, pos + 1);
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
currentGP = param_gpjob[param_gpjob.length - 1]
|
|
456
|
+
|
|
457
|
+
$("#coder-board-loading").show();
|
|
458
|
+
$.ajax({
|
|
459
|
+
url: `${baseUrl}/api/screen/gp`,
|
|
460
|
+
type: 'post',
|
|
461
|
+
data: { device_id:device_id,strack: JSON.stringify(param_gpjob), image: source_path, gp: gpapi.strack.info.name },
|
|
462
|
+
async: true,
|
|
463
|
+
success: function (res) {
|
|
464
|
+
// alert(res)
|
|
465
|
+
$("#coder-board-loading").hide();
|
|
466
|
+
if (res.code == 1) {
|
|
467
|
+
var data = JSON.parse(res.data)
|
|
468
|
+
res.data = data
|
|
469
|
+
// listener(res.code, data, currentGP)
|
|
470
|
+
gpapi.strack.result = res
|
|
471
|
+
listener(res, currentGP)
|
|
472
|
+
// fill_excute_res(data,param_gpjob[param_gpjob.length-1])
|
|
473
|
+
} else {
|
|
474
|
+
listener(res)
|
|
475
|
+
}
|
|
476
|
+
},
|
|
477
|
+
error: function (err) {
|
|
478
|
+
alert(err)
|
|
479
|
+
$("#coder-board-loading").hide();
|
|
480
|
+
}
|
|
481
|
+
})
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
|
|
485
|
+
function api_marks_point_add(id, xy) {
|
|
486
|
+
var dom = $("#mark-point-item").clone()
|
|
487
|
+
gpapi.marks.point.daos.push({ id: id, x: xy[0], y: xy[1] })
|
|
488
|
+
dom.appendTo(".mark-points")
|
|
489
|
+
dom.attr("id", null)
|
|
490
|
+
dom.find(".mark-points-number").text(id + "")
|
|
491
|
+
dom.find(".mark-points-xy").text(xy[0] + "," + xy[1])
|
|
492
|
+
|
|
493
|
+
$("#toolbar_mask_clear").addClass("toolbar_mask_active")
|
|
494
|
+
|
|
495
|
+
changeImageMarkSize()
|
|
496
|
+
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
function api_marks_point_clear() {
|
|
500
|
+
gpapi.marks.point.daos = []
|
|
501
|
+
|
|
502
|
+
$(".mark-points").empty()
|
|
503
|
+
$("#toolbar_mask_clear").removeClass("toolbar_mask_active")
|
|
504
|
+
|
|
505
|
+
// changeImageMarkSize()
|
|
506
|
+
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
function api_marks_rect_add(id, rect) {
|
|
510
|
+
var dom = $("#mark-rect-item").clone()
|
|
511
|
+
gpapi.marks.rect.daos.push({ id: id, rect: rect })
|
|
512
|
+
dom.appendTo(".mark-rects")
|
|
513
|
+
dom.attr("id", null)
|
|
514
|
+
dom.find(".mark-rect-number").text(id + "")
|
|
515
|
+
|
|
516
|
+
$("#toolbar_mask_clear").addClass("toolbar_mask_active")
|
|
517
|
+
|
|
518
|
+
changeImageMarkSize()
|
|
519
|
+
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
function api_marks_rect_clear() {
|
|
523
|
+
gpapi.marks.rect.daos = []
|
|
524
|
+
$(".mark-rects").empty()
|
|
525
|
+
$("#toolbar_mask_clear").removeClass("toolbar_mask_active")
|
|
526
|
+
|
|
527
|
+
// changeImageMarkSize()
|
|
528
|
+
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
// function api_marks_rect_add(id,rect){
|
|
532
|
+
// var dom = $("#mark-point-item").clone()
|
|
533
|
+
// gpapi.marks.point.daos.push({id:id,x:xy[0],y:xy[1]})
|
|
534
|
+
// dom.appendTo(".mark-points")
|
|
535
|
+
// dom.attr("id",null)
|
|
536
|
+
// dom.find(".mark-points-number").text(id+"")
|
|
537
|
+
// dom.find(".mark-points-xy").text(xy[0]+","+xy[1])
|
|
538
|
+
|
|
539
|
+
// changeImageMarkSize()
|
|
540
|
+
|
|
541
|
+
// }
|
|
542
|
+
|
|
543
|
+
function api_image_crop(listener, p_rect, target_path) {
|
|
544
|
+
if (p_rect) {
|
|
545
|
+
$.ajax({
|
|
546
|
+
url: `${baseUrl}/api/file/image/crop`,
|
|
547
|
+
type: 'post',
|
|
548
|
+
data: { image: gp_path, rect: JSON.stringify(p_rect), target: target_path },
|
|
549
|
+
async: true,
|
|
550
|
+
success: function (res) {
|
|
551
|
+
if (res.code == 1) {
|
|
552
|
+
listener(res.data)
|
|
553
|
+
// fill_excute_res(data,param_gpjob[param_gpjob.length-1])
|
|
554
|
+
} else {
|
|
555
|
+
alert(res.msg)
|
|
556
|
+
}
|
|
557
|
+
},
|
|
558
|
+
error: function (err) {
|
|
559
|
+
alert(res.msg)
|
|
560
|
+
}
|
|
561
|
+
})
|
|
562
|
+
} else {
|
|
563
|
+
return source_path
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
function api_file_url(file_path) {
|
|
568
|
+
return `${baseUrl}/api/file/get?path=${file_path}`;
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
function api_file_path_concat(paths) {
|
|
572
|
+
var real_path = ""
|
|
573
|
+
paths.forEach(path => {
|
|
574
|
+
var spc = ""
|
|
575
|
+
if(!path.startsWith("/")){
|
|
576
|
+
spc = "/"
|
|
577
|
+
}
|
|
578
|
+
real_path = real_path +spc+ path;
|
|
579
|
+
});
|
|
580
|
+
real_path = real_path.replace(/\/\//g, '/')
|
|
581
|
+
return real_path;
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
function api_file_read(source_file,listener){
|
|
585
|
+
$.ajax({
|
|
586
|
+
url: `${baseUrl}/api/file/get`,
|
|
587
|
+
type: 'post',
|
|
588
|
+
data: { path: source_file },
|
|
589
|
+
async: false,
|
|
590
|
+
success: function (res) {
|
|
591
|
+
if (listener && res) {
|
|
592
|
+
listener(res)
|
|
593
|
+
}
|
|
594
|
+
},
|
|
595
|
+
error: function (err) {
|
|
596
|
+
alert(err)
|
|
597
|
+
}
|
|
598
|
+
})
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
function api_file_copy(source_file, target_file, listener) {
|
|
602
|
+
$.ajax({
|
|
603
|
+
url: `${baseUrl}/api/file/copy`,
|
|
604
|
+
type: 'post',
|
|
605
|
+
data: { source: source_file, target: target_file },
|
|
606
|
+
async: false,
|
|
607
|
+
success: function (res) {
|
|
608
|
+
if (res.code == 1) {
|
|
609
|
+
if (listener) {
|
|
610
|
+
listener(res.data)
|
|
611
|
+
}
|
|
612
|
+
// fill_excute_res(data,param_gpjob[param_gpjob.length-1])
|
|
613
|
+
} else {
|
|
614
|
+
listener(res)
|
|
615
|
+
// alert(res.msg)
|
|
616
|
+
}
|
|
617
|
+
},
|
|
618
|
+
error: function (err) {
|
|
619
|
+
alert(JSON.stringify(err))
|
|
620
|
+
}
|
|
621
|
+
})
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
function api_file_dir(dir_path,listener){
|
|
625
|
+
$.ajax({
|
|
626
|
+
url: `${baseUrl}/api/files`,
|
|
627
|
+
type: 'post',
|
|
628
|
+
data: { path: dir_path },
|
|
629
|
+
async: false,
|
|
630
|
+
success: function (res) {
|
|
631
|
+
if (listener) {
|
|
632
|
+
listener(res)
|
|
633
|
+
}
|
|
634
|
+
},
|
|
635
|
+
error: function (err) {
|
|
636
|
+
alert(res.msg)
|
|
637
|
+
}
|
|
638
|
+
})
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
function api_file_rname(path,rname,listener){
|
|
642
|
+
$.ajax({
|
|
643
|
+
url: `${baseUrl}/api/file/rename`,
|
|
644
|
+
type: 'post',
|
|
645
|
+
data: { path: path,name:rname },
|
|
646
|
+
async: false,
|
|
647
|
+
success: function (res) {
|
|
648
|
+
if (listener) {
|
|
649
|
+
listener(res)
|
|
650
|
+
}
|
|
651
|
+
},
|
|
652
|
+
error: function (err) {
|
|
653
|
+
alert(res.msg)
|
|
654
|
+
}
|
|
655
|
+
})
|
|
656
|
+
}
|
|
657
|
+
|
|
658
|
+
function api_file_delect(path,listener){
|
|
659
|
+
$.ajax({
|
|
660
|
+
url: `${baseUrl}/api/file/remove`,
|
|
661
|
+
type: 'post',
|
|
662
|
+
data: { path: path },
|
|
663
|
+
async: false,
|
|
664
|
+
success: function (res) {
|
|
665
|
+
if (listener) {
|
|
666
|
+
listener(res)
|
|
667
|
+
}
|
|
668
|
+
},
|
|
669
|
+
error: function (err) {
|
|
670
|
+
alert(res.msg)
|
|
671
|
+
}
|
|
672
|
+
})
|
|
673
|
+
}
|
|
674
|
+
|
|
675
|
+
function api_file_write(path,content){
|
|
676
|
+
$.ajax({
|
|
677
|
+
url: `${baseUrl}/api/file/save`,
|
|
678
|
+
type: 'post',
|
|
679
|
+
data: { path: path,content: content},
|
|
680
|
+
async: false,
|
|
681
|
+
success: function (res) {
|
|
682
|
+
if (listener) {
|
|
683
|
+
listener(res)
|
|
684
|
+
}
|
|
685
|
+
},
|
|
686
|
+
error: function (err) {
|
|
687
|
+
alert(res.msg)
|
|
688
|
+
}
|
|
689
|
+
})
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
function api_module_getlist(listener) {
|
|
693
|
+
$.get(baseUrl + "/api/module/list ", {}, function (data, textStatus) {
|
|
694
|
+
listener(data)
|
|
695
|
+
}
|
|
696
|
+
);
|
|
697
|
+
}
|
|
698
|
+
|
|
699
|
+
function api_strack_genor_code(name) {
|
|
700
|
+
var header = []
|
|
701
|
+
var body = []
|
|
702
|
+
|
|
703
|
+
header.push("from ascript.android.screen import gp")
|
|
704
|
+
header.push("from ascript.android.system import R")
|
|
705
|
+
header.push("")
|
|
706
|
+
|
|
707
|
+
body.push(`res = gp.run(R.res('gp/${name}.gp'))`)
|
|
708
|
+
body.push(`if res:`)
|
|
709
|
+
body.push(` print(res.data)`)
|
|
710
|
+
|
|
711
|
+
let all_codes = header.concat(body);
|
|
712
|
+
var f_code = all_codes.join("\n");
|
|
713
|
+
$("#gp_export_code").val(f_code)
|
|
714
|
+
}
|
|
715
|
+
|
|
716
|
+
function api_strack_source_code(name) {
|
|
717
|
+
var header = []
|
|
718
|
+
var body = []
|
|
719
|
+
|
|
720
|
+
header.push("from ascript.android.screen import gp")
|
|
721
|
+
header.push("from ascript.android.system import R")
|
|
722
|
+
header.push("")
|
|
723
|
+
|
|
724
|
+
body.push(`res = gp.run(R.res('gp/${name}.gp'))`)
|
|
725
|
+
body.push(`if res:`)
|
|
726
|
+
body.push(` print(res.data)`)
|
|
727
|
+
|
|
728
|
+
let all_codes = header.concat(body);
|
|
729
|
+
var f_code = all_codes.join("\n");
|
|
730
|
+
$("#gp_export_code").val(f_code)
|
|
731
|
+
}
|
|
732
|
+
|
|
733
|
+
function api_sys_copy(msg){
|
|
734
|
+
// alert(msg)
|
|
735
|
+
var createInput = document.createElement("input");
|
|
736
|
+
createInput.value = msg;
|
|
737
|
+
document.getElementById("container_img").appendChild(createInput);
|
|
738
|
+
createInput.select();
|
|
739
|
+
document.execCommand("Copy");
|
|
740
|
+
createInput.className = 'createInput';
|
|
741
|
+
createInput.style.display = "none";
|
|
742
|
+
|
|
743
|
+
api_sys_tip("已复制:"+msg)
|
|
744
|
+
|
|
745
|
+
// alert(createInput.value)
|
|
746
|
+
}
|
|
747
|
+
|
|
748
|
+
function api_sys_copy_form(msg,formid){
|
|
749
|
+
// alert(msg)
|
|
750
|
+
createInput = document.getElementById(formid)
|
|
751
|
+
createInput.select();
|
|
752
|
+
document.execCommand("Copy");
|
|
753
|
+
|
|
754
|
+
api_sys_tip("已复制:"+msg)
|
|
755
|
+
|
|
756
|
+
// alert(createInput.value)
|
|
757
|
+
}
|
|
758
|
+
|
|
759
|
+
async function copyToClipboard(text) {
|
|
760
|
+
try {
|
|
761
|
+
await navigator.clipboard.writeText(text);
|
|
762
|
+
console.log('Text copied to clipboard');
|
|
763
|
+
} catch (err) {
|
|
764
|
+
console.error('Failed to copy text: ', err);
|
|
765
|
+
}
|
|
766
|
+
}
|
|
767
|
+
|
|
768
|
+
|
|
769
|
+
function api_sys_tip(msg){
|
|
770
|
+
|
|
771
|
+
if (msg.length > 30) {
|
|
772
|
+
msg = msg.slice(0, 30) + '...';
|
|
773
|
+
}
|
|
774
|
+
|
|
775
|
+
$("#as_toast_msg").text(msg)
|
|
776
|
+
$('#liveToast').toast('show')
|
|
777
|
+
|
|
778
|
+
}
|