[update] コメントアウトされた不要なコードを削除

This commit is contained in:
ocogeclub 2022-01-16 20:26:38 +09:00
parent 496ee02f12
commit a94151b86b
4 changed files with 16 additions and 336 deletions

View File

@ -125,28 +125,6 @@
</shadow>
</value>
</block>
<!-- <block type="ugj_control_for">
<field name="index" id="[0Dv+s57IrE5bItrMx6V">番号</field>
<field name="crease">+</field>
<value name="from">
<shadow type="math_number">
<field name="NUM">1</field>
</shadow>
</value>
<value name="to">
<shadow type="math_number">
<field name="NUM">10</field>
</shadow>
</value>
<value name="by">
<shadow type="math_number">
<field name="NUM">1</field>
</shadow>
</value>
</block> -->
<!-- <block type="ugj_controls_forEach">
<field name="item" id="~!WaafBNY_R,9DB`?.cd" variabletype="">項目</field>
</block> -->
<block type="ugj_controls_foreach">
<value name="item">
<block type="variables_get">
@ -414,11 +392,6 @@
<label text="シリアル" web-line="4.0" web-line-width="200"></label>
<block type="ugj_serial_open">
<field name="baud">9600</field>
<!-- <value name="tty">
<shadow type="text">
<field name="TEXT">/dev/serial0</field>
</shadow>
</value> -->
</block>
<block type="ugj_serial_close"></block>
<block type="ugj_serial_read">
@ -523,21 +496,6 @@
<block type="ugj_bme280_data">
<field name="thp">0</field>
</block>
<!-- <block type="ugj_bme280">
<field name="temp">気温</field>
<field name="hum" id="IT?JH;IRcsGP.8I%aEgw">湿度</field>
<field name="pres" id="I^GLkF^Z3#x2F0ho%J[?">気圧</field>
<value name="address">
<shadow type="ugj_hextodec">
<value name="hex">
<shadow type="text">
<field name="TEXT">76</field>
</shadow>
</value>
</shadow>
</value>
</block> -->
<label text="ジェスチャーセンサー PAJ7620" web-line="4.0" web-line-width="200"></label>
<block type="ugj_gesture_init">
<value name="i2c_addr">
@ -672,10 +630,6 @@
</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="key" id="MRLP/?IZ:[U}[AV@bf6%" variabletype="">キー</field>
<field name="updown">keydown</field>
</block> -->
<block type="ugj_event_key">
<field name="updown">keydown</field>
<value name="key">
@ -716,12 +670,6 @@
</block>
<block type="ugj_face_init"></block>
<block type="ugj_face_display"></block>
<!-- <block type="ugj_face_detect">
<field name="x" id="TF-ziC[]OAJ9]r}YjUQg" variabletype=""></field>
<field name="y" id="]G:_%S*1v4!9_+yx532d" variabletype=""></field>
<field name="w" id="wP$LdeXDCiWzrI!/9R)G" variabletype=""></field>
<field name="h" id="8+E.-dP-Omt}v2~DCC]M" variabletype="">高さ</field>
</block> -->
<block type="ugj_face_detect"></block>
<block type="ugj_face_coord">
<field name="face_coord">0</field>
@ -740,11 +688,6 @@
</value>
</block>
<block type="ugj_network_sendmail">
<!-- <value name="from">
<shadow type="text">
<field name="TEXT">from@ocoge.club</field>
</shadow>
</value> -->
<value name="to">
<shadow type="text">
<field name="TEXT">to@example.com</field>
@ -762,14 +705,6 @@
</value>
</block>
<label text="サーバー" web-line="4.0" web-line-width="200"></label>
<!-- <block type="ugj_network_httpserver">
<field name="URL" id="fIVY=P=^1=p?6=+h:,Dt" variabletype="">url</field>
<value name="response">
<shadow type="text">
<field name="TEXT">オコゲ</field>
</shadow>
</value>
</block> -->
<block type="ugj_network_httpserver">
<value name="url">
<block type="variables_get">
@ -803,9 +738,6 @@
</value>
</block>
<block type="ugj_skyway_called"></block>
<!-- <block type="ugj_skyway_events">
<field name="remote_id" id="0H.)5,:R#6)mx{rc2O.6" variabletype="">相手のID</field>
</block> -->
<block type="ugj_skyway_events">
<value name="remote_id">
<block type="variables_get">
@ -814,12 +746,6 @@
</value>
</block>
<block type="ugj_skyway_eventopen"></block>
<!-- <block type="ugj_skyway_eventdata">
<field name="data" id="q[DF.B~59aE(90^posFt" variabletype="">発言</field>
</block>
<block type="ugj_skyway_eventsend">
<field name="data" id="vN/_]nnKA$wVHSxh2_9f" variabletype="">内容</field>
</block> -->
<block type="ugj_skyway_eventdata">
<value name="data">
<block type="variables_get">
@ -850,14 +776,6 @@
</shadow>
</value>
</block>
<!-- <block type="ugj_event_answer">
<field name="answer" id="_m@Uj#wHnIuGJNVwdUR+" variabletype="">答え</field>
<value name="question">
<shadow type="text">
<field name="TEXT">お名前は?</field>
</shadow>
</value>
</block> -->
<block type="ugj_event_answer">
<value name="question">
<shadow type="text">
@ -874,7 +792,6 @@
<block type="ugj_blackboard_write">
<field name="style">normal</field>
<field name="line">new</field>
<!-- <field name="cursor">FALSE</field> -->
<value name="text">
<shadow type="text">
<field name="TEXT">コンニチワ!</field>
@ -1056,7 +973,6 @@
<category name="スニペット" css-icon="customIcon fas fa-egg" categorystyle="snippets_category">
<label text="入出力" web-line="4.0" web-line-width="200"></label>
<block type="ugj_event_answer">
<!-- <field name="answer" id="_m@Uj#wHnIuGJNVwdUR+" variabletype="">答え</field> -->
<value name="answer">
<block type="variables_get">
<field name="VAR" id=":w)sl|yxx4k^W-~-VM#,">答え</field>
@ -1138,7 +1054,6 @@
<script src="./index.js"></script>
<script src="./lib/beautify.min.js"></script>
<script src="./lib/prettify.js"></script>
<!-- <script src="./.shared/skyway_key.js"></script> -->
</body>
</html>

View File

@ -184,8 +184,6 @@ Blockly.Msg["UGJ_DECTOHEX_TOOLTIP"] = "10進数を16進数に変換します。"
Blockly.Msg["UGJ_CANVAS_INIT_TITLE"] = "キャンバスを表示";
Blockly.Msg["UGJ_CANVAS_INIT_TOOLTIP"] = "キャンバスを表示し、使用できるようにします。";
// Blockly.Msg["UGJ_FACEAPI_TITLE"] = "TensorFlowによる顔検出 %1 ランドマークを検出 %2 %3";
// Blockly.Msg["UGJ_FACEAPI_TOOLTIP"] = "TensorFlow とFaceAPI をロードし、顔検出をできるようにします。";
Blockly.Msg["UGJ_SLEEP_TITLE"] = "%1 秒待つ";
Blockly.Msg["UGJ_SLEEP_TOOLTIP"] = "指定した秒数だけ処理を中断します。";
@ -356,9 +354,9 @@ const ugj_loadWorkspace = () => {
// }
// Python コードフォーマッタ Black をコール
const ugj_pyBeautify = (code) => {
let formatted;
// formatted = window.ocogeapi.child_process.spawnSync('python3', ['-m', 'black', '-'], { input: code }).stdout.toString();
formatted = require('child_process').spawnSync('python3', ['-m', 'black', '-'], { input: code }).stdout.toString();
let formatted = '';
// // formatted = window.ocogeapi.child_process.spawnSync('python3', ['-m', 'black', '-'], { input: code }).stdout.toString();
// formatted = require('child_process').spawnSync('python3', ['-m', 'black', '-'], { input: code }).stdout.toString();
return formatted;
}
@ -453,18 +451,18 @@ const ugj_showCode = () => {
}
btn_close.addEventListener('click', close_cb);
btn_export.addEventListener('click', export_cb);
document.addEventListener('keypress', (ev) => {
if (ev.key == 'p' && ext == 'js') {
ext = 'py';
showCode();
}
});
document.addEventListener('keyup', (ev) => {
if (ev.key == 'p') {
ext = 'js';
showCode();
}
});
// document.addEventListener('keypress', (ev) => {
// if (ev.key == 'p' && ext == 'js') {
// ext = 'py';
// showCode();
// }
// });
// document.addEventListener('keyup', (ev) => {
// if (ev.key == 'p') {
// ext = 'js';
// showCode();
// }
// });
}

View File

@ -8,7 +8,6 @@ const ugj_const = {
mascot_path: './img/',
mascot_defname: 'tamachee.png',
library_path: './lib/',
// executable_path: './bin/',
localStorage_fname: 'ocoge.json',
error_ja_all: 'エラーが発生しました。\n『おこげ倶楽部』までお問い合わせください。',
pig: 'pigpio',

View File

@ -1,65 +1,4 @@
/** Fix Basic Blocks ****************************************************************************************/
// var ugjConsrolForDefinition = {
// "type": "ugj_control_for",
// "message0": "%{BKY_UGJ_CONTROL_FOR_TITLE}",
// "args0": [
// {
// "type": "field_variable",
// "name": "index",
// "variable": "%{BKY_UGJ_CONTROL_FOR_INDEX}"
// },
// {
// "type": "input_dummy"
// },
// {
// "type": "input_value",
// "name": "from",
// "check": "Number"
// },
// {
// "type": "input_value",
// "name": "to",
// "check": "Number"
// },
// {
// "type": "input_value",
// "name": "by",
// "check": "Number"
// },
// {
// "type": "field_dropdown",
// "name": "crease",
// "options": [
// [
// "%{BKY_UGJ_CONTROL_FOR_INCREASE}",
// "+"
// ],
// [
// "%{BKY_UGJ_CONTROL_FOR_DECREASE}",
// "-"
// ]
// ]
// },
// {
// "type": "input_dummy"
// },
// {
// "type": "input_statement",
// "name": "do"
// }
// ],
// "inputsInline": true,
// "previousStatement": null,
// "nextStatement": null,
// "tooltip": "%{BKY_UGJ_CONTROL_FOR_TOOLTIP}",
// "helpUrl": "",
// "style": "loop_blocks"
// };
// Blockly.Blocks['ugj_control_for'] = {
// init: function () {
// this.jsonInit(ugjConsrolForDefinition);
// }
// };
Blockly.Blocks['ugj_control_for'] = {
init: function () {
this.appendValueInput("index")
@ -123,40 +62,6 @@ Blockly.Python['ugj_control_for'] = function (block) {
return code;
};
// var ugjForEachDefinition = {
// "type": "ugj_controls_foreach",
// "message0": "%{BKY_UGJ_FOREACH_TITLE}",
// "args0": [
// {
// "type": "input_value",
// "name": "list",
// "check": "Array"
// },
// {
// "type": "field_variable",
// "name": "item",
// "variable": "%{BKY_UGJ_FOREACH_ITEM}"
// },
// {
// "type": "input_dummy"
// },
// {
// "type": "input_statement",
// "name": "do"
// }
// ],
// "inputsInline": true,
// "previousStatement": null,
// "nextStatement": null,
// "style": "loop_blocks",
// "tooltip": "%{BKY_UGJ_FOREACH_TOOLTIP}",
// "helpUrl": ""
// }
// Blockly.Blocks['ugj_controls_forEach'] = {
// init: function () {
// this.jsonInit(ugjForEachDefinition);
// }
// };
Blockly.Blocks['ugj_controls_foreach'] = {
init: function () {
this.appendValueInput("list")
@ -190,32 +95,7 @@ Blockly.JavaScript['ugj_controls_foreach'] = function (block) {
].join('\n');
return code;
};
// Blockly.JavaScript['ugj_controls_forEach'] = function (block) {
// var value_list = Blockly.JavaScript.valueToCode(block, 'list', Blockly.JavaScript.ORDER_ATOMIC);
// var variable_item = Blockly.JavaScript.nameDB_.getName(block.getFieldValue('item'), Blockly.Variables.NAME_TYPE);
// var statements_do = Blockly.JavaScript.statementToCode(block, 'do');
// var code = [
// `for (let _index in ${value_list}) {`,
// `${variable_item} = ${value_list}[_index];`,
// statements_do,
// `}`,
// ''
// ].join('\n');
// return code;
// };
// Blockly.Python['ugj_controls_forEach'] = function (block) {
// var value_list = Blockly.Python.valueToCode(block, 'list', Blockly.Python.ORDER_ATOMIC);
// var variable_item = Blockly.Python.nameDB_.getName(block.getFieldValue('item'), Blockly.Variables.NAME_TYPE);
// var statements_do = Blockly.Python.statementToCode(block, 'do');
// if (value_list === '') value_list = '[]';
// if (statements_do === '') statements_do = ' pass';
// var code = [
// `for ${variable_item} in ${value_list}:`,
// statements_do,
// ''
// ].join('\n');
// return code;
// };
// Custom Color Picker
Blockly.FieldColour.COLOURS = [
'#ffffff', '#808000', '#ffff00', '#ff00ff', '#ff4500',
@ -698,11 +578,6 @@ var ugjSerialOpenDefinition = {
"type": "ugj_serial_open",
"message0": "%{BKY_SERIAL_OPEN_TITLE}",
"args0": [
// {
// "type": "input_value",
// "name": "tty",
// "check": "String"
// },
{
"type": "field_dropdown",
"name": "baud",
@ -1131,43 +1006,6 @@ Blockly.Python['ugj_i2c_write_device'] = function (block) {
/********* */
/** BME280 */
/********* */
// var ugjBme280Definition = {
// "type": "ugj_bme280",
// "message0": "%{BKY_UGJ_BME280_TITLE}",
// "args0": [
// {
// "type": "input_value",
// "name": "address",
// "check": "Number"
// },
// {
// "type": "field_variable",
// "name": "temp",
// "variable": "%{BKY_UGJ_BME280_READ_TEMP}"
// },
// {
// "type": "field_variable",
// "name": "hum",
// "variable": "%{BKY_UGJ_BME280_READ_HUM}"
// },
// {
// "type": "field_variable",
// "name": "pres",
// "variable": "%{BKY_UGJ_BME280_READ_PRES}"
// }
// ],
// "inputsInline": true,
// "previousStatement": null,
// "nextStatement": null,
// "tooltip": "%{BKY_UGJ_BME280_TOOLTIP}",
// "helpUrl": "",
// "style": "sensor_blocks"
// };
// Blockly.Blocks['ugj_bme280'] = {
// init: function () {
// this.jsonInit(ugjBme280Definition);
// }
// };
Blockly.Blocks['ugj_bme280'] = {
init: function () {
this.appendDummyInput()
@ -1201,48 +1039,6 @@ await _bme280.cancel();
`;
return code;
};
// Blockly.JavaScript['ugj_bme280'] = function (block) {
// var value_address = Blockly.JavaScript.valueToCode(block, 'address', Blockly.JavaScript.ORDER_ATOMIC);
// var variable_temp = Blockly.JavaScript.nameDB_.getName(block.getFieldValue('temp'), Blockly.Variables.NAME_TYPE);
// var variable_hum = Blockly.JavaScript.nameDB_.getName(block.getFieldValue('hum'), Blockly.Variables.NAME_TYPE);
// var variable_pres = Blockly.JavaScript.nameDB_.getName(block.getFieldValue('pres'), Blockly.Variables.NAME_TYPE);
// Blockly.JavaScript.provideFunction_(
// 'require_bme280', [`const _bme280 = require('@ocogeclub/bme280');`]
// );
// var code = [
// `const options = {`,
// ` i2cBusNo: ${elutil.i2c_bus},`,
// ` i2cAddress: ${value_address}`,
// `};`,
// `await _bme280.init(options);`,
// `let _thp = await _bme280.readSensorData();`,
// `${variable_temp} = Math.round(_thp.temperature_C * 10) / 10;`,
// `${variable_hum} = Math.round(_thp.humidity * 10) / 10;`,
// `${variable_pres} = Math.round(_thp.pressure_hPa);`,
// `await _bme280.cancel();`,
// ``
// ].join('\n');
// return code;
// };
// Blockly.Python['ugj_bme280'] = function (block) {
// var value_address = Blockly.Python.valueToCode(block, 'address', Blockly.Python.ORDER_ATOMIC);
// var variable_temp = Blockly.Python.nameDB_.getName(block.getFieldValue('temp'), Blockly.Variables.NAME_TYPE);
// var variable_hum = Blockly.Python.nameDB_.getName(block.getFieldValue('hum'), Blockly.Variables.NAME_TYPE);
// var variable_pres = Blockly.Python.nameDB_.getName(block.getFieldValue('pres'), Blockly.Variables.NAME_TYPE);
// Blockly.Python.provideFunction_(
// 'import_bme280', [`import BME280`]
// );
// var code = [
// `bme280 = BME280.sensor()`,
// `temp, pres, hum = bme280.read_data()`,
// `${variable_temp} = round(temp, 1)`,
// `${variable_hum} = round(hum, 1)`,
// `${variable_pres} = round(pres/100);`,
// `bme280.cancel()`,
// ``
// ].join('\n');
// return code;
// };
Blockly.Blocks['ugj_bme280_data'] = {
init: function () {
this.appendDummyInput()
@ -1716,13 +1512,6 @@ var ugj_canvas_init_definition = {
Blockly.Blocks['ugj_canvas_init'] = {
init: function () {
this.jsonInit(ugj_canvas_init_definition);
// this.appendDummyInput()
// .appendField("キャンバスを表示");
// this.setPreviousStatement(true, null);
// this.setNextStatement(true, null);
// this.setStyle('multimedia_blocks')
// this.setTooltip("キャンバスを表示し、使用できるようにします。");
// this.setHelpUrl("");
}
};
Blockly.JavaScript['ugj_canvas_init'] = function (block) {
@ -3160,24 +2949,6 @@ Blockly.JavaScript['ugj_child_irrcvr'] = function (block) {
return [code, Blockly.JavaScript.ORDER_NONE];
};
// face.py
// Blockly.Blocks['ugj_child_facepy'] = {
// init: function () {
// this.appendDummyInput()
// .appendField("face.py");
// this.setInputsInline(true);
// this.setOutput(true, null);
// this.setOutputShape(Blockly.OUTPUT_SHAPE_ROUND);
// this.setStyle('special_blocks')
// this.setTooltip("opencv4nodejsによる顔認識");
// this.setHelpUrl("");
// }
// };
// Blockly.JavaScript['ugj_child_facepy'] = function (block) {
// var code = "'node', ['./face.js']";
// return [code, Blockly.JavaScript.ORDER_NONE];
// };
// Python との連携のひな型
Blockly.Blocks['ugj_child_testpy'] = {
init: function () {
@ -3520,8 +3291,6 @@ Blockly.Blocks['ugj_set_timeout'] = {
.appendField("秒待ってから");
this.appendStatementInput("do")
.setCheck(null);
// this.appendDummyInput()
// .appendField("この下は待たずに実行");
this.setInputsInline(true);
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
@ -3547,7 +3316,6 @@ Blockly.Blocks['ugj_library_load'] = {
this.appendStatementInput("do")
.setCheck(null);
this.setInputsInline(true);
// this.setStartHat(true);
this.setStyle('special_blocks')
this.setTooltip("ライブラリをロードします。");
this.setHelpUrl("");