From 001258ce15ada5f19534a36ba25be33e06f65e63 Mon Sep 17 00:00:00 2001 From: ocogeclub Date: Fri, 20 Jan 2023 21:21:43 +0900 Subject: [PATCH] [update] updated blockly --- apptool.js | 2 +- blocks/index.js | 7 +++--- blocks/sensors/bme280/index.js | 2 +- blocks/sensors/dht11/index.js | 2 +- blocks/sensors/paj7620/index.js | 2 +- index.html | 2 +- main.js | 2 +- package-lock.json | 42 ++++++++++++++++----------------- package.json | 6 ++--- 9 files changed, 34 insertions(+), 33 deletions(-) diff --git a/apptool.js b/apptool.js index 28b80ec..a8cb114 100644 --- a/apptool.js +++ b/apptool.js @@ -49,7 +49,7 @@ class appTool { this.app_path = await this.ipcRenderer.invoke('get_app_path'); this.mascotFilePath = this.path.join(this.app_path, ugj_const.mascot_dirname, ugj_const.mascot_defname); this.library_path = this.path.join(this.app_path, ugj_const.library_dirname); - this.blocks_dir = this.path.join(this.app_path, ugj_const.blocks_dir); + // this.blocks_dir = this.path.join(this.app_path, ugj_const.blocks_dir); } // 0で数値の桁合わせ : NUM=値 LEN=桁数 diff --git a/blocks/index.js b/blocks/index.js index c1decb0..6c851eb 100644 --- a/blocks/index.js +++ b/blocks/index.js @@ -1,4 +1,4 @@ -const current = (function () { +apptool.blocks_dir = (function () { let r = ""; if (document.currentScript) { r = document.currentScript.src; @@ -9,16 +9,17 @@ const current = (function () { r = script.src; } } - return r.replace(/[^/]*$/, '') + return r.replace(/[^/]*$/, '').replace('file://', '') })(); var flyout_contents = []; const registerCategory = (category_dir, subcategories) => { for (let sbctgr of subcategories) { - let fname = current + category_dir + '/' + sbctgr + "/index.js"; + let fname = apptool.blocks_dir + category_dir + '/' + sbctgr + "/index.js"; let script = document.createElement('script'); script.type = 'text/javascript'; script.src = fname; script.async = false; + script.defer = true; document.body.appendChild(script); } } diff --git a/blocks/sensors/bme280/index.js b/blocks/sensors/bme280/index.js index 2430263..b892356 100644 --- a/blocks/sensors/bme280/index.js +++ b/blocks/sensors/bme280/index.js @@ -20,7 +20,7 @@ Blockly.JavaScript['ugj_bme280'] = function (block) { Blockly.JavaScript.provideFunction_( 'require_gpio', [`const _pi = require('@ocoge.club/` + apptool.gpio_backend + `');`] ); - let modpath = apptool.path.join(ugj_const.blocks_dir, 'sensors', 'bme280', 'BME280x.js'); + let modpath = apptool.path.join(apptool.blocks_dir, 'sensors', 'bme280', 'BME280x.js'); Blockly.JavaScript.provideFunction_( 'require_bme280', [`const _bme280 = require('${modpath}');`] ); diff --git a/blocks/sensors/dht11/index.js b/blocks/sensors/dht11/index.js index edc67e1..72d2477 100644 --- a/blocks/sensors/dht11/index.js +++ b/blocks/sensors/dht11/index.js @@ -15,7 +15,7 @@ Blockly.Blocks['ugj_dht11'] = { }; Blockly.JavaScript['ugj_dht11'] = function (block) { var value_pin = Blockly.JavaScript.valueToCode(block, 'pin', Blockly.JavaScript.ORDER_ATOMIC); - let pypath = apptool.path.join(ugj_const.blocks_dir, 'sensors', 'dht11', 'dht11.py'); + let pypath = apptool.path.join(apptool.blocks_dir, 'sensors', 'dht11', 'dht11.py'); var code = `let _th = require('child_process').spawnSync('python3', ['${pypath}', '${value_pin}'], {timeout: 5000}).stdout.toString(); let _dhtdata = JSON.parse(_th);`; // let _dht11data[0] = diff --git a/blocks/sensors/paj7620/index.js b/blocks/sensors/paj7620/index.js index 90ef2f0..cd25cc6 100644 --- a/blocks/sensors/paj7620/index.js +++ b/blocks/sensors/paj7620/index.js @@ -35,7 +35,7 @@ Blockly.JavaScript['ugj_gesture_init'] = function (block) { Blockly.JavaScript.provideFunction_( 'require_gpio', [`const _pi = require('@ocoge.club/` + apptool.gpio_backend + `');`] ); - let modpath = apptool.path.join(ugj_const.blocks_dir, 'sensors', 'paj7620', 'PAJ7620x.js'); + let modpath = apptool.path.join(apptool.blocks_dir, 'sensors', 'paj7620', 'PAJ7620x.js'); Blockly.JavaScript.provideFunction_( 'require_paj7620', [`const _paj7620 = require('${modpath}');`] ); diff --git a/index.html b/index.html index d4112b8..3f549c5 100644 --- a/index.html +++ b/index.html @@ -1045,9 +1045,9 @@ + - diff --git a/main.js b/main.js index c4c9e2e..b069805 100644 --- a/main.js +++ b/main.js @@ -32,7 +32,7 @@ function createWindow() { win.loadFile('index.html') // Open the DevTools. - // win.webContents.openDevTools() + win.webContents.openDevTools() // Emitted when the window is closed. // win.on('closed', () => { diff --git a/package-lock.json b/package-lock.json index 9786f37..3e6dfa4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16,8 +16,8 @@ "@tensorflow-models/mobilenet": "^2.1.0", "@tensorflow-models/speech-commands": "^0.5.4", "@tensorflow/tfjs-node": "^4.2.0", - "axios": "^1.2.2", - "blockly": "^9.2.0", + "axios": "^1.2.3", + "blockly": "^9.2.1", "dracula-prism": "^2.1.13", "js-beautify": "^1.14.7", "node-abi": "^3.31.0", @@ -28,7 +28,7 @@ "@electron-forge/cli": "^6.0.4", "@electron-forge/maker-deb": "^6.0.4", "@electron/rebuild": "^3.2.10", - "electron": "^22.0.2" + "electron": "^22.0.3" } }, "local_modules/pigpio": { @@ -1284,9 +1284,9 @@ } }, "node_modules/axios": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.2.2.tgz", - "integrity": "sha512-bz/J4gS2S3I7mpN/YZfGFTqhXTYzRho8Ay38w2otuuDR322KzFIWm/4W2K6gIwvWaws5n+mnb7D1lN9uD+QH6Q==", + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.2.3.tgz", + "integrity": "sha512-pdDkMYJeuXLZ6Xj/Q5J3Phpe+jbGdsSzlQaFVkMQzRUL05+6+tetX8TV3p4HrU4kzuO9bt+io/yGQxuyxA/xcw==", "dependencies": { "follow-redirects": "^1.15.0", "form-data": "^4.0.0", @@ -1351,9 +1351,9 @@ } }, "node_modules/blockly": { - "version": "9.2.0", - "resolved": "https://registry.npmjs.org/blockly/-/blockly-9.2.0.tgz", - "integrity": "sha512-rygZJupS5u4DMGGQ70gExH71c34vUEUjTVVBzhgVH7PCAK2RaitCNwr2yF6hGj/QTVodkjjEOdTzbHqLbuPipQ==", + "version": "9.2.1", + "resolved": "https://registry.npmjs.org/blockly/-/blockly-9.2.1.tgz", + "integrity": "sha512-8iy7keOE6A3lk+PIaDOIxuzv7eXUJqNKNNn1NXkd/246YSa8DkkfgaZ3eEskejkfm/uRgi8Y4HSU1dQRCfN+Hw==", "dependencies": { "jsdom": "20.0.3" } @@ -2107,9 +2107,9 @@ "integrity": "sha512-ncTzHV7NvsQZkYe1DW7cbDLm0YpzHmZF5r/iyP3ZnQtMiJ+pjzisCiMNI+Sj+xQF5pXhSHxSB3uDbsBTzY/c2A==" }, "node_modules/electron": { - "version": "22.0.2", - "resolved": "https://registry.npmjs.org/electron/-/electron-22.0.2.tgz", - "integrity": "sha512-NdJlA2+FMgDJBhQFKMPyWJY8ng/tWpFlrRsW2JkZgSzYPXOnIu9muO3b83YHGoDn+GTyS8ghPsgcAwPMXtxirA==", + "version": "22.0.3", + "resolved": "https://registry.npmjs.org/electron/-/electron-22.0.3.tgz", + "integrity": "sha512-eETrJTINTzlXgQrnJSrKiF2Xdt5EHpxZ6Kk+WUjFCE0zUztdVm+hrngUecqhj8TPFlYScTANzPwRwUIjOChl+g==", "dev": true, "hasInstallScript": true, "dependencies": { @@ -7271,9 +7271,9 @@ "dev": true }, "axios": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.2.2.tgz", - "integrity": "sha512-bz/J4gS2S3I7mpN/YZfGFTqhXTYzRho8Ay38w2otuuDR322KzFIWm/4W2K6gIwvWaws5n+mnb7D1lN9uD+QH6Q==", + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.2.3.tgz", + "integrity": "sha512-pdDkMYJeuXLZ6Xj/Q5J3Phpe+jbGdsSzlQaFVkMQzRUL05+6+tetX8TV3p4HrU4kzuO9bt+io/yGQxuyxA/xcw==", "requires": { "follow-redirects": "^1.15.0", "form-data": "^4.0.0", @@ -7323,9 +7323,9 @@ } }, "blockly": { - "version": "9.2.0", - "resolved": "https://registry.npmjs.org/blockly/-/blockly-9.2.0.tgz", - "integrity": "sha512-rygZJupS5u4DMGGQ70gExH71c34vUEUjTVVBzhgVH7PCAK2RaitCNwr2yF6hGj/QTVodkjjEOdTzbHqLbuPipQ==", + "version": "9.2.1", + "resolved": "https://registry.npmjs.org/blockly/-/blockly-9.2.1.tgz", + "integrity": "sha512-8iy7keOE6A3lk+PIaDOIxuzv7eXUJqNKNNn1NXkd/246YSa8DkkfgaZ3eEskejkfm/uRgi8Y4HSU1dQRCfN+Hw==", "requires": { "jsdom": "20.0.3" } @@ -7885,9 +7885,9 @@ } }, "electron": { - "version": "22.0.2", - "resolved": "https://registry.npmjs.org/electron/-/electron-22.0.2.tgz", - "integrity": "sha512-NdJlA2+FMgDJBhQFKMPyWJY8ng/tWpFlrRsW2JkZgSzYPXOnIu9muO3b83YHGoDn+GTyS8ghPsgcAwPMXtxirA==", + "version": "22.0.3", + "resolved": "https://registry.npmjs.org/electron/-/electron-22.0.3.tgz", + "integrity": "sha512-eETrJTINTzlXgQrnJSrKiF2Xdt5EHpxZ6Kk+WUjFCE0zUztdVm+hrngUecqhj8TPFlYScTANzPwRwUIjOChl+g==", "dev": true, "requires": { "@electron/get": "^2.0.0", diff --git a/package.json b/package.json index 0f5023a..6b749af 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,7 @@ "@electron-forge/cli": "^6.0.4", "@electron-forge/maker-deb": "^6.0.4", "@electron/rebuild": "^3.2.10", - "electron": "^22.0.2" + "electron": "^22.0.3" }, "dependencies": { "@blockly/field-slider": "^4.0.4", @@ -35,8 +35,8 @@ "@tensorflow-models/mobilenet": "^2.1.0", "@tensorflow-models/speech-commands": "^0.5.4", "@tensorflow/tfjs-node": "^4.2.0", - "axios": "^1.2.2", - "blockly": "^9.2.0", + "axios": "^1.2.3", + "blockly": "^9.2.1", "dracula-prism": "^2.1.13", "js-beautify": "^1.14.7", "node-abi": "^3.31.0",