diff --git a/index.html b/index.html index 0af8a65..0403044 100644 --- a/index.html +++ b/index.html @@ -125,28 +125,6 @@ - - @@ -414,11 +392,6 @@ 9600 - @@ -523,21 +496,6 @@ 0 - - @@ -672,10 +630,6 @@ - keydown @@ -716,12 +670,6 @@ - 0 @@ -740,11 +688,6 @@ - to@example.com @@ -762,14 +705,6 @@ - @@ -803,9 +738,6 @@ - @@ -814,12 +746,6 @@ - @@ -850,14 +776,6 @@ - @@ -874,7 +792,6 @@ normal new - コンニチワ! @@ -1056,7 +973,6 @@ - 答え @@ -1138,7 +1054,6 @@ - \ No newline at end of file diff --git a/index.js b/index.js index 1d0c28a..ce1ce39 100644 --- a/index.js +++ b/index.js @@ -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(); + // } + // }); } diff --git a/index_elutil.js b/index_elutil.js index 79baf2d..725fc86 100644 --- a/index_elutil.js +++ b/index_elutil.js @@ -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', diff --git a/ugj_blocks.js b/ugj_blocks.js index 6d71ac0..1bb1c60 100644 --- a/ugj_blocks.js +++ b/ugj_blocks.js @@ -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("");