mirror of
https://github.com/ocogeclub/ocoge.git
synced 2024-11-21 15:19:48 +00:00
[update] Electron を 22.0.2 にアップデート。細々とした調整。
This commit is contained in:
parent
c9815fbc18
commit
34e969ef55
41
apptool.js
41
apptool.js
@ -11,7 +11,6 @@ const ugj_const = {
|
||||
document_root: 'Documents',
|
||||
tmp_dir: '.ocogeclub/tmp', //ホームディレクトリからのパス
|
||||
executable_path: '.ocogeclub/apps/', //ホームディレクトリからのパス
|
||||
blocks_dir: './blocks', // 動作するコードを web demo で生成するためには「./」をつける
|
||||
localStorage_fname: 'ocoge.json',
|
||||
error_ja_all: 'エラーが発生しました。\n『おこげ倶楽部』までお問い合わせください。',
|
||||
pig: 'pigpio',
|
||||
@ -38,7 +37,6 @@ class appTool {
|
||||
this.doc_root = this.path.join(process.env["HOME"], ugj_const.document_root);
|
||||
this.doc_current = this.path.join(process.env["HOME"], ugj_const.document_root);
|
||||
this.executable_path = this.path.join(process.env["HOME"], ugj_const.executable_path);
|
||||
// this.blocks_dir = this.path.join(process.env["HOME"], ugj_const.blocks_dir);
|
||||
this.tmp_dir = this.path.join(process.env["HOME"], ugj_const.tmp_dir);
|
||||
const EventEmitter = require('events');
|
||||
this.ugjEmitter = new EventEmitter();
|
||||
@ -52,45 +50,8 @@ class appTool {
|
||||
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.loadSensorblocks();
|
||||
}
|
||||
|
||||
// センサーブロックのロード
|
||||
// loadSensorblocks() {
|
||||
// // ディレクトリの有無
|
||||
// if (!this.fs.existsSync(this.blocks_dir)) return;
|
||||
// // ブロックデータ格納ディレクトリのリスト
|
||||
// const allDirents = this.fs.readdirSync(this.blocks_dir, { withFileTypes: true });
|
||||
// const blocks_list = allDirents.filter(dirent => dirent.isDirectory()).map(({ name }) => name);
|
||||
// // センサーカテゴリのインスタンス
|
||||
// let category_sensors = workspace.getToolbox().getToolboxItemById('category_sensors');
|
||||
// let flyout_contents = []; // フライアウトのjsonのリスト
|
||||
// for (let sensor_dir of blocks_list) { //ディレクトリ巡り
|
||||
// if (sensor_dir.charAt(0) == '.') continue; //隠しディレクトリをスキップ
|
||||
// // フライアウトのjsonを取得してパース、リストに追加
|
||||
// let fname = this.path.join(this.blocks_dir, sensor_dir, 'index.json');
|
||||
// let json_text = this.fs.readFileSync(fname);
|
||||
// let obj = JSON.parse(json_text);
|
||||
// flyout_contents = flyout_contents.concat(obj);
|
||||
// // ブロック定義のスクリプト要素をbody要素の最後に追加
|
||||
// fname = this.path.join(this.blocks_dir, sensor_dir, 'index.js');
|
||||
// let script = document.createElement('script');
|
||||
// script.type = 'text/javascript';
|
||||
// script.src = fname;
|
||||
// document.body.appendChild(script);
|
||||
// }
|
||||
// let lastline = [{
|
||||
// "kind": "label",
|
||||
// "text": " ",
|
||||
// "web-line": "4.0",
|
||||
// "web-line-width": "200"
|
||||
// }];
|
||||
// flyout_contents = flyout_contents.concat(lastline);
|
||||
// // センサーカテゴリのフライアウトをアップデート
|
||||
// category_sensors.updateFlyoutContents(flyout_contents);
|
||||
// }
|
||||
|
||||
|
||||
// 0で数値の桁合わせ : NUM=値 LEN=桁数
|
||||
zeroPadding(NUM, LEN) {
|
||||
return (Array(LEN).join('0') + NUM).slice(-LEN);
|
||||
@ -130,7 +91,7 @@ class appTool {
|
||||
if (filepath.length > 0) {
|
||||
if (this.saveFilepath === null) {
|
||||
this.setSaveFilepath(filepath);
|
||||
} //読み込みに失敗してもsaveFilepathが更新されてしまうのはちょっと具合が悪いかも
|
||||
} //読み込みに失敗してもsaveFilepathが更新されてしまうのはちょっと具合が悪いかも
|
||||
this.doc_current = this.path.dirname(filepath);
|
||||
return this.readFromFile(filepath);
|
||||
} else {
|
||||
|
@ -3018,15 +3018,3 @@ Blockly.Python['ugj_controls_foreach'] = function (block) {
|
||||
// return code;
|
||||
// };
|
||||
|
||||
Blockly.defineBlocksWithJsonArray([{
|
||||
"type": "toggle_lang",
|
||||
"message0": "MicroPython Mode",
|
||||
"colour": 0,
|
||||
"tooltip": "実行すると秘密の MicorPython モードに移行します。JavaScript モードに戻るには、ワークスペースを再読み込みしてください。",
|
||||
"helpUrl": ""
|
||||
}]);
|
||||
Blockly.JavaScript['toggle_lang'] = function (block) {
|
||||
var code = `apptool.setLang('py');
|
||||
`;
|
||||
return code;
|
||||
};
|
||||
|
94
index.html
94
index.html
@ -331,10 +331,9 @@
|
||||
</category>
|
||||
<sep></sep>
|
||||
<category name="GPIO" css-icon="customIcon fab fa-raspberry-pi" categorystyle="gpio_category">
|
||||
<label text="必須"></label>
|
||||
<label text="基本"></label>
|
||||
<block type="ugj_gpio_open"></block>
|
||||
<block type="ugj_gpio_close"></block>
|
||||
<label text="基本"></label>
|
||||
<block type="ugj_gpio_set_output">
|
||||
<value name="gpio">
|
||||
<shadow type="math_number">
|
||||
@ -395,33 +394,6 @@
|
||||
</shadow>
|
||||
</value>
|
||||
</block>
|
||||
<label text="シリアル" web-line="4.0" web-line-width="200"></label>
|
||||
<block type="ugj_serial_open">
|
||||
<field name="baud">9600</field>
|
||||
</block>
|
||||
<block type="ugj_serial_close"></block>
|
||||
<block type="ugj_serial_read">
|
||||
<value name="count">
|
||||
<shadow type="math_number">
|
||||
<field name="NUM">1</field>
|
||||
</shadow>
|
||||
</value>
|
||||
</block>
|
||||
<block type="ugj_serial_write">
|
||||
<value name="data">
|
||||
<shadow type="text_join">
|
||||
<mutation items="2"></mutation>
|
||||
<value name="ADD0">
|
||||
<shadow type="text">
|
||||
<field name="TEXT">ohayo-.</field>
|
||||
</shadow>
|
||||
</value>
|
||||
<value name="ADD1">
|
||||
<shadow type="ugj_text_cr"></shadow>
|
||||
</value>
|
||||
</shadow>
|
||||
</value>
|
||||
</block>
|
||||
<label text="I2C" web-line="4.0" web-line-width="200"></label>
|
||||
<block type="ugj_i2c_open">
|
||||
<value name="i2c_address">
|
||||
@ -491,6 +463,33 @@
|
||||
</shadow>
|
||||
</value>
|
||||
</block>
|
||||
<label text="シリアル" web-line="4.0" web-line-width="200"></label>
|
||||
<block type="ugj_serial_open">
|
||||
<field name="baud">9600</field>
|
||||
</block>
|
||||
<block type="ugj_serial_close"></block>
|
||||
<block type="ugj_serial_read">
|
||||
<value name="count">
|
||||
<shadow type="math_number">
|
||||
<field name="NUM">1</field>
|
||||
</shadow>
|
||||
</value>
|
||||
</block>
|
||||
<block type="ugj_serial_write">
|
||||
<value name="data">
|
||||
<shadow type="text_join">
|
||||
<mutation items="2"></mutation>
|
||||
<value name="ADD0">
|
||||
<shadow type="text">
|
||||
<field name="TEXT">ohayo-.</field>
|
||||
</shadow>
|
||||
</value>
|
||||
<value name="ADD1">
|
||||
<shadow type="ugj_text_cr"></shadow>
|
||||
</value>
|
||||
</shadow>
|
||||
</value>
|
||||
</block>
|
||||
<label text="Extra" web-line="4.0" web-line-width="200"></label>
|
||||
<label text="_" web-line="4.0" web-line-width="200"></label>
|
||||
</category>
|
||||
@ -581,15 +580,6 @@
|
||||
</value>
|
||||
</block>
|
||||
<block type="ugj_canvas_finalize"></block>
|
||||
<label text="イベント" web-line="4.0" web-line-width="200"></label>
|
||||
<block type="ugj_event_key">
|
||||
<field name="updown">keydown</field>
|
||||
<value name="key">
|
||||
<block type="variables_get">
|
||||
<field name="VAR" id="Tf-2_OhUEAcOe;U}wu%I">キー</field>
|
||||
</block>
|
||||
</value>
|
||||
</block>
|
||||
<label text="色" web-line="4.0" web-line-width="200"></label>
|
||||
<block type="colour_picker">
|
||||
<field name="COLOUR">#ff0000</field>
|
||||
@ -616,6 +606,15 @@
|
||||
<block type="ugj_sound_play">
|
||||
<field name="sound">meow</field>
|
||||
</block>
|
||||
<label text="イベント" web-line="4.0" web-line-width="200"></label>
|
||||
<block type="ugj_event_key">
|
||||
<field name="updown">keydown</field>
|
||||
<value name="key">
|
||||
<block type="variables_get">
|
||||
<field name="VAR" id="Tf-2_OhUEAcOe;U}wu%I">キー</field>
|
||||
</block>
|
||||
</value>
|
||||
</block>
|
||||
<label text="顔認識" web-line="4.0" web-line-width="200"></label>
|
||||
<block type="ugj_face_init"></block>
|
||||
<block type="ugj_face_display"></block>
|
||||
@ -777,6 +776,15 @@
|
||||
<label text="_" web-line="4.0" web-line-width="200"></label>
|
||||
</category>
|
||||
<category name="特殊" css-icon="customIcon fas fa-plug" categorystyle="special_category">
|
||||
<label text="制御" web-line="4.0" web-line-width="200"></label>
|
||||
<block type="ugj_sleep">
|
||||
<value name="sec">
|
||||
<shadow type="math_number">
|
||||
<field name="NUM">1</field>
|
||||
</shadow>
|
||||
</value>
|
||||
</block>
|
||||
<block type="ugj_async_iife"></block>
|
||||
<label text="出入力" web-line="4.0" web-line-width="200"></label>
|
||||
<block type="ugj_canvas_say">
|
||||
<value name="say">
|
||||
@ -863,15 +871,6 @@
|
||||
</shadow>
|
||||
</value>
|
||||
</block>
|
||||
<label text="制御" web-line="4.0" web-line-width="200"></label>
|
||||
<block type="ugj_sleep">
|
||||
<value name="sec">
|
||||
<shadow type="math_number">
|
||||
<field name="NUM">1</field>
|
||||
</shadow>
|
||||
</value>
|
||||
</block>
|
||||
<block type="ugj_async_iife"></block>
|
||||
<label text="外部アプリ連携" web-line="4.0" web-line-width="200"></label>
|
||||
<block type="ugj_spawnsync">
|
||||
<value name="data">
|
||||
@ -887,7 +886,6 @@
|
||||
</block>
|
||||
</value>
|
||||
</block>
|
||||
<block type="ugj_child_julius"></block>
|
||||
<block type="aquestalk_pi">
|
||||
<value name="talk">
|
||||
<shadow type="text">
|
||||
|
4
index.js
4
index.js
@ -1,13 +1,9 @@
|
||||
'use strict';
|
||||
|
||||
// const { checkPrimeSync } = require('crypto');
|
||||
|
||||
let apptool = appTool_new();
|
||||
|
||||
|
||||
const testfunc = async () => {
|
||||
apptool.openURL('http://ocoge.club');
|
||||
// console.log(apptool.app_path);
|
||||
}
|
||||
|
||||
//============ User Customize Start ===============
|
||||
|
14
package-lock.json
generated
14
package-lock.json
generated
@ -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.1"
|
||||
"electron": "^22.0.2"
|
||||
}
|
||||
},
|
||||
"local_modules/pigpio": {
|
||||
@ -2107,9 +2107,9 @@
|
||||
"integrity": "sha512-ncTzHV7NvsQZkYe1DW7cbDLm0YpzHmZF5r/iyP3ZnQtMiJ+pjzisCiMNI+Sj+xQF5pXhSHxSB3uDbsBTzY/c2A=="
|
||||
},
|
||||
"node_modules/electron": {
|
||||
"version": "22.0.1",
|
||||
"resolved": "https://registry.npmjs.org/electron/-/electron-22.0.1.tgz",
|
||||
"integrity": "sha512-05X/UmQOtUYwFmytY4/rc+4Iz+LYzHhftRZDkx1GQzyX/BxopStddG8LMcx3SESNk25F2J93oHv1Lzs6QWeCjA==",
|
||||
"version": "22.0.2",
|
||||
"resolved": "https://registry.npmjs.org/electron/-/electron-22.0.2.tgz",
|
||||
"integrity": "sha512-NdJlA2+FMgDJBhQFKMPyWJY8ng/tWpFlrRsW2JkZgSzYPXOnIu9muO3b83YHGoDn+GTyS8ghPsgcAwPMXtxirA==",
|
||||
"dev": true,
|
||||
"hasInstallScript": true,
|
||||
"dependencies": {
|
||||
@ -7885,9 +7885,9 @@
|
||||
}
|
||||
},
|
||||
"electron": {
|
||||
"version": "22.0.1",
|
||||
"resolved": "https://registry.npmjs.org/electron/-/electron-22.0.1.tgz",
|
||||
"integrity": "sha512-05X/UmQOtUYwFmytY4/rc+4Iz+LYzHhftRZDkx1GQzyX/BxopStddG8LMcx3SESNk25F2J93oHv1Lzs6QWeCjA==",
|
||||
"version": "22.0.2",
|
||||
"resolved": "https://registry.npmjs.org/electron/-/electron-22.0.2.tgz",
|
||||
"integrity": "sha512-NdJlA2+FMgDJBhQFKMPyWJY8ng/tWpFlrRsW2JkZgSzYPXOnIu9muO3b83YHGoDn+GTyS8ghPsgcAwPMXtxirA==",
|
||||
"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.1"
|
||||
"electron": "^22.0.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"@blockly/field-slider": "^4.0.4",
|
||||
|
Loading…
Reference in New Issue
Block a user