mirror of
https://github.com/ocogeclub/ocoge.git
synced 2024-11-24 08:29:48 +00:00
[update] updated blockly
This commit is contained in:
parent
34e969ef55
commit
001258ce15
@ -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=桁数
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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}');`]
|
||||
);
|
||||
|
@ -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] =
|
||||
|
@ -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}');`]
|
||||
);
|
||||
|
@ -1045,9 +1045,9 @@
|
||||
<script src="./node_modules/blockly/msg/ja.js"></script>
|
||||
<script src="./node_modules/@blockly/field-slider/dist/index.js"></script>
|
||||
<script src="./lib/custom-dialog.js"></script>
|
||||
<script src="./apptool.js"></script>
|
||||
<script src="./blocks/blocks.js"></script>
|
||||
<script src="./blocks/index.js"></script>
|
||||
<script src="./apptool.js"></script>
|
||||
<script src="./index.js"></script>
|
||||
<script src="./node_modules/js-beautify/js/lib/beautify.js"></script>
|
||||
<script src="./node_modules/prismjs/prism.js"></script>
|
||||
|
2
main.js
2
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', () => {
|
||||
|
42
package-lock.json
generated
42
package-lock.json
generated
@ -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",
|
||||
|
@ -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",
|
||||
|
Loading…
Reference in New Issue
Block a user