root vor 1 Jahr
Ursprung
Commit
732d002227

+ 32 - 0
package-lock.json

@@ -42,6 +42,8 @@
         "iconv-lite": "^0.6.2",
         "materialize-css": "^1.0.0",
         "module": "^1.2.5",
+        "request": "^2.88.2",
+        "request-progress": "^3.0.0",
         "require": "^2.4.20",
         "socket.io": "^2.3.0",
         "sudo-prompt": "^8.2.5",
@@ -12928,6 +12930,15 @@
         "node": ">= 6"
       }
     },
+    "node_modules/request-progress": {
+      "version": "3.0.0",
+      "resolved": "https://registry.npmmirror.com/request-progress/-/request-progress-3.0.0.tgz",
+      "integrity": "sha512-MnWzEHHaxHO2iWiQuHrUPBi/1WeBf5PkxQqNyNvLl9VAYSdXkP8tQ3pBSeCPD+yw0v0Aq1zosWLz0BdeXpWwZg==",
+      "dev": true,
+      "dependencies": {
+        "throttleit": "^1.0.0"
+      }
+    },
     "node_modules/request/node_modules/form-data": {
       "version": "2.3.3",
       "resolved": "https://registry.npmmirror.com/form-data/-/form-data-2.3.3.tgz",
@@ -14865,6 +14876,12 @@
       "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==",
       "dev": true
     },
+    "node_modules/throttleit": {
+      "version": "1.0.0",
+      "resolved": "https://registry.npmmirror.com/throttleit/-/throttleit-1.0.0.tgz",
+      "integrity": "sha512-rkTVqu6IjfQ/6+uNuuc3sZek4CEYxTJom3IktzgdSxcZqdARuebbA/f4QmAxMQIxqq9ZLEUkSYqvuk1I6VKq4g==",
+      "dev": true
+    },
     "node_modules/through2": {
       "version": "2.0.5",
       "resolved": "https://registry.npmmirror.com/through2/-/through2-2.0.5.tgz",
@@ -28537,6 +28554,15 @@
         }
       }
     },
+    "request-progress": {
+      "version": "3.0.0",
+      "resolved": "https://registry.npmmirror.com/request-progress/-/request-progress-3.0.0.tgz",
+      "integrity": "sha512-MnWzEHHaxHO2iWiQuHrUPBi/1WeBf5PkxQqNyNvLl9VAYSdXkP8tQ3pBSeCPD+yw0v0Aq1zosWLz0BdeXpWwZg==",
+      "dev": true,
+      "requires": {
+        "throttleit": "^1.0.0"
+      }
+    },
     "require": {
       "version": "2.4.20",
       "resolved": "https://registry.npmmirror.com/require/-/require-2.4.20.tgz",
@@ -30154,6 +30180,12 @@
         }
       }
     },
+    "throttleit": {
+      "version": "1.0.0",
+      "resolved": "https://registry.npmmirror.com/throttleit/-/throttleit-1.0.0.tgz",
+      "integrity": "sha512-rkTVqu6IjfQ/6+uNuuc3sZek4CEYxTJom3IktzgdSxcZqdARuebbA/f4QmAxMQIxqq9ZLEUkSYqvuk1I6VKq4g==",
+      "dev": true
+    },
     "through2": {
       "version": "2.0.5",
       "resolved": "https://registry.npmmirror.com/through2/-/through2-2.0.5.tgz",

+ 2 - 0
package.json

@@ -42,6 +42,8 @@
     "iconv-lite": "^0.6.2",
     "materialize-css": "^1.0.0",
     "module": "^1.2.5",
+    "request": "^2.88.2",
+    "request-progress": "^3.0.0",
     "require": "^2.4.20",
     "socket.io": "^2.3.0",
     "sudo-prompt": "^8.2.5",

+ 18 - 2
src/main/main.js

@@ -111,6 +111,22 @@ ipcMain.on('version', (e, data) => e.returnValue = data === "already" ? version
 ipcMain.on('relaunch', reboot);
 ipcMain.on('windowsid', (e, data) => e.returnValue = getWindowsId(data));
 
+ipcMain.on('download', (event, url, filePath) => {
+	const request = require('request')
+	const progress = require('request-progress')
+
+	progress(request(url))
+		.on('progress', (state) => {
+			event.sender.send('download-progress', state.percent)
+		})
+		.on('error', (err) => {
+			event.sender.send('download-error', err)
+		})
+		.pipe(fs.createWriteStream(filePath))
+		.on('finish', () => {
+			event.sender.send('download-finished')
+		})
+})
 
 // ------------ When app is ready ------------ //
 app.on('ready', () => {
@@ -151,7 +167,7 @@ function createMainWindow() {
 				// }
 				return true;
 			})
-			try{
+			try {
 				if (callback) {
 					if (deviceToReturn) {
 						callback(deviceToReturn.deviceId)
@@ -160,7 +176,7 @@ function createMainWindow() {
 					}
 				}
 			}
-			catch(e){
+			catch (e) {
 				console.log(e)
 			}
 			return deviceToReturn;

+ 1 - 1
src/renderer/cocoblockly-x/ardublockly_lang.js

@@ -117,7 +117,7 @@ Ardublockly.injectLanguageJsSources = function (langKey) {
 
   // Retrieve and inject Blockly translations asynchronously
   var blocklyLangJsLoad = document.createElement('script');
-  blocklyLangJsLoad.src = '../blockly/msg/js/' + langKey + '.js';
+  blocklyLangJsLoad.src = 'blockly/msg/js/' + langKey + '.js';
   head.appendChild(blocklyLangJsLoad);
 };
 

+ 1 - 1
src/renderer/cocoblockly-x/blockly/generators/python/screen.js

@@ -222,7 +222,7 @@ Blockly.Python['lcd_set_colorRGB'] = function (block) {
 /** add on 14:25-09/01/2019 by QR
  *   convert position from origin(x,y) to (x,128-y)
  */
-function posConvert(x, y) {
+window.posConvert = function(x, y) {
     var reg = /^?[0-9]\d*$/;
     // if (reg.test(y)) y = 128 - parseInt(y, 10) 
     // else y = "128 - " + y;

+ 18 - 17
src/renderer/cocoblockly-x/index.html

@@ -772,7 +772,7 @@
                     <!-- <li>
                         <span class="vertical-separator"></span>
                     </li> -->
-                    <li  style="display:none">
+                    <li style="display:none">
                         <a id="nav_account" href="#login_modal" class="modal-trigger lang_resize"
                             style="position:relative"
                             onclick="$('#api-key').html(''); $('#api-key').html($('#cloud_events').val()); document.getElementById('api-key').value = $('#cloud_events').val();">
@@ -878,7 +878,7 @@
                                     id="repl_box">
                                     <div class="blockpy-toolbar" id="terminal"
                                         style="display:block;height: 99%;padding: 0 10px;background: #000;min-width:570px;">
-                                        <iframe id="webadb_iframe" src="/ya-webadb/apps/demo/out/shell.html"
+                                        <iframe id="webadb_iframe" src="ya-webadb/apps/demo/out/shell.html"
                                             frameborder="0" style="width: 100%;height: 100%;" scrolling="no"
                                             allow="camera *; fullscreen *;fullscreen 'src'">
 
@@ -925,7 +925,8 @@
                                                 style="position:absolute;height:10px;left:3px;top:0px;display:none;"
                                                 src="./icons/plugin_download_new.png">
                                         </a>
-                                        <a href="#iframe" class="modal-trigger header-link" id="showIframe">
+                                        <a style="display:none" href="#iframe" class="modal-trigger header-link"
+                                            id="showIframe">
                                             <img src="./icons/firmware.png">
                                         </a>
                                         <a href="#qrCode" class="modal-trigger header-link" id="">
@@ -949,8 +950,7 @@
                                         style="position: relative;top: 5px;display: none;">
                                         <i class="material-icons sketch_name_icon">create_new_folder</i>
                                     </a>
-                                    <div style="display: inline-block;"><select
-                                            class="select-connected " id="select-connected">
+                                    <div style="display: none;"><select class="select-connected " id="select-connected">
                                             <option class="select-connected translatable_select_connecteds"
                                                 style="color: #000;">The
                                                 cable to upload</option>
@@ -991,7 +991,8 @@
                                             <input id="IP" type="text" placeholder="请输入ip地址" style="display: none;">
                                         </div>
                                         <div class="col s4">
-                                            <button id="webadb_add" style="width:100%" class="translatable_addDevice btn blue"
+                                            <button id="webadb_add" style="width:100%"
+                                                class="translatable_addDevice btn blue"
                                                 onclick="addWebadb()">添加</button>
                                         </div>
                                     </div>
@@ -1043,8 +1044,9 @@
                                                 <span class="translatable_uploadFiles"></span>
                                             </a>
                                             <a id="backHome" onclick="backHome()" class="waves-effect
-                                                     waves-light btn blue disabled" style="margin-left:0.5rem;width: 100%;">
-                                                     <img src="./icons/stop.png" style="top:6px">
+                                                     waves-light btn blue disabled"
+                                                style="margin-left:0.5rem;width: 100%;">
+                                                <img src="./icons/stop.png" style="top:6px">
                                                 <span class="translatable_resetMainUI">返回菜单</span>
                                             </a>
                                             <li id="changeRunCuploadFilesode"
@@ -1074,14 +1076,14 @@
                                         <div class="col s4">
                                             <div class="systemBtn" style="display:flex;">
                                                 <a id="resetDevice" onclick="systemCommand('reboot')" class="waves-effect
-                                                            waves-light btn blue disabled" style="width:100%;margin-right:0.5rem;"><span
-                                                                class="translatable_resetDevice">Reset
-                                                                Device</span></a>
+                                                            waves-light btn blue disabled"
+                                                    style="width:100%;margin-right:0.5rem;"><span
+                                                        class="translatable_resetDevice">Reset
+                                                        Device</span></a>
                                                 <a id="poweroff" onclick="systemCommand('poweroff')" class="waves-effect
-                                                        waves-light btn blue disabled"
-                                                    style="width:100%;"><span
+                                                        waves-light btn blue disabled" style="width:100%;"><span
                                                         class="translatable_shutDown">关机</span></a>
-                                                        
+
                                             </div>
                                         </div>
                                         <a onclick="getmcnty()" class="waves-effect waves-light btn blue"
@@ -3355,7 +3357,7 @@
                                     <li class="container-top-noactive" onclick="clickLoadingExample('图像处理/循线-单.xml')">
                                         <div class="translatable_ai_tpl2">循线(单线)</div>
                                     </li>
-                            </ul>
+                                </ul>
                         </div>
                         <div class="con" style="display: none;position: relative;">
                             <ul style="display: flex;flex-direction: column;">
@@ -3489,8 +3491,7 @@
     <div id="webadbIframeFile" class="modal modal_closes">
         <span class="modal_close" style="padding: 5px;position: absolute;right: 0;cursor: pointer;"><i
                 class="small material-icons" style="font-size: 1.5rem;">close</i></span>
-        <div id="file_manager_back"
-            onclick="document.getElementById('file_manager').contentWindow.history.back()"
+        <div id="file_manager_back" onclick="document.getElementById('file_manager').contentWindow.history.back()"
             style="padding: 5px;position: absolute;left: -2px;top: 7px;cursor: pointer;width: 35px;"><i
                 class="small material-icons" style="font-size: 1.5rem;">arrow_back</i></div>
         <iframe id="file_manager" frameborder="0" style="width: 100%;height: 100%;" scrolling="no"

Datei-Diff unterdrückt, da er zu groß ist
+ 710 - 667
src/renderer/cocoblockly-x/src/blockly/ardublockly_design.js


+ 22 - 21
src/renderer/cocoblockly-x/train_cocopi.html

@@ -863,7 +863,8 @@
                                     <img class="fullscreenIcon hidden" src="./images/icon-fullscreen.svg">
                                     <img class="fullscreenIcon hidden" src="./images/icon-fullscreen-exit.svg">
                                 </div>
-                                <div class="card-content hidden" style="position:relative;overflow:auto;" id="python_box">
+                                <div class="card-content hidden" style="position:relative;overflow:auto;"
+                                    id="python_box">
                                     <div class="blockpy-toolbar" style="position: relative;">
                                         <div class='blockpy-text blockpy-editor-menu'>
                                             <div class='blockpy-text-sidebar'></div>
@@ -878,7 +879,7 @@
                                     id="repl_box">
                                     <div class="blockpy-toolbar" id="terminal"
                                         style="display:block;height: 99%;padding: 0 10px;background: #000;min-width:570px;">
-                                        <iframe id="webadb_iframe" src="/ya-webadb/apps/demo/out/shell.html"
+                                        <iframe id="webadb_iframe" src="ya-webadb/apps/demo/out/shell.html"
                                             frameborder="0" style="width: 100%;height: 100%;" scrolling="no"
                                             allow="camera *; fullscreen *;fullscreen 'src'">
 
@@ -887,8 +888,7 @@
                                     </div>
                                 </div>
 
-                                <div class="blockpy-toolbar" id="serial_plotter_content"
-                                    style="overflow-y: auto;">
+                                <div class="blockpy-toolbar" id="serial_plotter_content" style="overflow-y: auto;">
                                     <div class="editDiv" id="editDiv"
                                         style="width: 100%;position: sticky;top: 0px;height: 100%;">
                                         <span style="display:none" class="translatable_serial_plotter"
@@ -897,8 +897,8 @@
                                             onclick="switchSerial('1')">图传</span>
                                         <span class="translatable_screenshot serial-active blue" style="color: #ffffff;"
                                             onclick="getTrainImg()">截图</span>
-                                        <span class="translatable_uploadFiles serial-active blue" style="color: #ffffff;"
-                                            onclick="uploadImg()">上传</span>
+                                        <span class="translatable_uploadFiles serial-active blue"
+                                            style="color: #ffffff;" onclick="uploadImg()">上传</span>
                                         <div id="repl_box_content"
                                             style="height: calc(100% - 30px);background: rgb(255, 255, 255);overflow-y: auto;display: none;">
                                         </div>
@@ -932,7 +932,8 @@
                                         <a href="#iframe" class="modal-trigger header-link" id="showIframe">
                                             <img src="./icons/firmware.png">
                                         </a>
-                                        <a href="#qrCode" class="modal-trigger header-link" id="" style="display: none;">
+                                        <a href="#qrCode" class="modal-trigger header-link" id=""
+                                            style="display: none;">
                                             <i id="QRCodeIcon" style="margin-top: 11px;"
                                                 class="material-icons sketch_name_icon hidden">wifi</i>
                                         </a>
@@ -953,8 +954,7 @@
                                         style="position: relative;top: 5px;display: none;">
                                         <i class="material-icons sketch_name_icon">create_new_folder</i>
                                     </a>
-                                    <div style="display: none;"><select
-                                            class="select-connected " id="select-connected">
+                                    <div style="display: none;"><select class="select-connected " id="select-connected">
                                             <option class="select-connected translatable_select_connecteds"
                                                 style="color: #000;">The
                                                 cable to upload</option>
@@ -995,7 +995,8 @@
                                             <input id="IP" type="text" placeholder="请输入ip地址" style="display: none;">
                                         </div>
                                         <div class="col s4">
-                                            <button id="webadb_add" style="width:100%" class="translatable_addDevice btn blue"
+                                            <button id="webadb_add" style="width:100%"
+                                                class="translatable_addDevice btn blue"
                                                 onclick="addWebadb()">添加</button>
                                         </div>
                                     </div>
@@ -1047,8 +1048,9 @@
                                                 <span class="translatable_uploadFiles"></span>
                                             </a>
                                             <a id="backHome" onclick="backHome()" class="waves-effect
-                                                     waves-light btn blue disabled" style="margin-left:0.5rem;width: 100%;">
-                                                     <img src="./icons/stop.png" style="top:6px">
+                                                     waves-light btn blue disabled"
+                                                style="margin-left:0.5rem;width: 100%;">
+                                                <img src="./icons/stop.png" style="top:6px">
                                                 <span class="translatable_resetMainUI">返回菜单</span>
                                             </a>
                                             <li id="changeRunCuploadFilesode"
@@ -1078,14 +1080,14 @@
                                         <div class="col s4">
                                             <div class="systemBtn" style="display:flex;">
                                                 <a id="resetDevice" onclick="systemCommand('reboot')" class="waves-effect
-                                                            waves-light btn blue disabled" style="width:100%;margin-right:0.5rem;"><span
-                                                                class="translatable_resetDevice">Reset
-                                                                Device</span></a>
+                                                            waves-light btn blue disabled"
+                                                    style="width:100%;margin-right:0.5rem;"><span
+                                                        class="translatable_resetDevice">Reset
+                                                        Device</span></a>
                                                 <a id="poweroff" onclick="systemCommand('poweroff')" class="waves-effect
-                                                        waves-light btn blue disabled"
-                                                    style="width:100%;"><span
+                                                        waves-light btn blue disabled" style="width:100%;"><span
                                                         class="translatable_shutDown">关机</span></a>
-                                                        
+
                                             </div>
                                         </div>
                                         <a onclick="getmcnty()" class="waves-effect waves-light btn blue"
@@ -3348,7 +3350,7 @@
                                     <li class="container-top-noactive" onclick="clickLoadingExample('图像处理/循线-单.xml')">
                                         <div class="translatable_ai_tpl2">循线(单线)</div>
                                     </li>
-                            </ul>
+                                </ul>
                         </div>
                         <div class="con" style="display: none;position: relative;">
                             <ul style="display: flex;flex-direction: column;">
@@ -3482,8 +3484,7 @@
     <div id="webadbIframeFile" class="modal modal_closes">
         <span class="modal_close" style="padding: 5px;position: absolute;right: 0;cursor: pointer;"><i
                 class="small material-icons" style="font-size: 1.5rem;">close</i></span>
-        <div id="file_manager_back"
-            onclick="document.getElementById('file_manager').contentWindow.history.back()"
+        <div id="file_manager_back" onclick="document.getElementById('file_manager').contentWindow.history.back()"
             style="padding: 5px;position: absolute;left: -2px;top: 7px;cursor: pointer;width: 35px;"><i
                 class="small material-icons" style="font-size: 1.5rem;">arrow_back</i></div>
         <iframe id="file_manager" frameborder="0" style="width: 100%;height: 100%;" scrolling="no"

Einige Dateien werden nicht angezeigt, da zu viele Dateien in diesem Diff geändert wurden.