|
@@ -1950,8 +1950,8 @@ Blockly.Python['v831_img_save'] = function (block) {
|
|
|
Blockly.Blocks.v831_img_text = {
|
|
|
init: function () {
|
|
|
this.appendValueInput("save_path")
|
|
|
- .setCheck(null)
|
|
|
- .appendField(Blockly.Msg.read_img_path_to)
|
|
|
+ .setCheck(null)
|
|
|
+ .appendField(Blockly.Msg.read_img_path_to)
|
|
|
this.setOutput(true, null);
|
|
|
this.setColour("#f0983e");
|
|
|
this.setTooltip(Blockly.Msg.read_img_path_to);
|
|
@@ -1961,7 +1961,7 @@ Blockly.Blocks.v831_img_text = {
|
|
|
Blockly.Python.v831_img_text = function (block) {
|
|
|
var save_path_location = Blockly.Python.valueToCode(block, 'save_path', Blockly.Python.ORDER_ATOMIC);
|
|
|
var code = 'image.open(' + save_path_location + ')';
|
|
|
- return [code,Blockly.Python.ORDER_NONE];
|
|
|
+ return [code, Blockly.Python.ORDER_NONE];
|
|
|
}
|
|
|
Blockly.Blocks['v831_img_open'] = {
|
|
|
init: function () {
|
|
@@ -8711,7 +8711,6 @@ BOXES = number_recognition.digitalShowCanvas(canvas)
|
|
|
return _code;
|
|
|
}
|
|
|
|
|
|
-// ai_model_digital_new
|
|
|
Blockly.Blocks['ai_model_digital_new'] = {
|
|
|
init: function () {
|
|
|
this.appendDummyInput()
|
|
@@ -8719,20 +8718,88 @@ Blockly.Blocks['ai_model_digital_new'] = {
|
|
|
this.appendStatementInput("input")
|
|
|
.setCheck(null)
|
|
|
.appendField(Blockly.Msg.basic_motion_statement_exec);
|
|
|
- this.appendStatementInput("input1")
|
|
|
- .setCheck(null)
|
|
|
- .appendField(Blockly.Msg.CONTROLS_IF_MSG_ELSE);
|
|
|
+ this.updateShape_();
|
|
|
+ this.setMutator(new Blockly.Mutator(['ai_model_false_create_with_item']));
|
|
|
this.setColour("#ee783a");
|
|
|
- this.setNextStatement(true, null);
|
|
|
this.setPreviousStatement(true, null);
|
|
|
- this.setTooltip(Blockly.Msg.ai_model_digital_new_text);
|
|
|
+ this.setNextStatement(true, null);
|
|
|
+ this.setTooltip("");
|
|
|
this.setHelpUrl("");
|
|
|
+ this.itemCount_ = 0;
|
|
|
+ },
|
|
|
+ mutationToDom: function () {
|
|
|
+ if (!this.itemCount_)
|
|
|
+ return null;
|
|
|
+ var container = document.createElement('mutation');
|
|
|
+ this.itemCount_ && container.setAttribute('aielse', 1);
|
|
|
+ return container;
|
|
|
+ },
|
|
|
+ domToMutation: function (a) {
|
|
|
+ this.itemCount_ = parseInt(a.getAttribute('aielse'), 10);
|
|
|
+ this.updateShape_();
|
|
|
+ },
|
|
|
+ decompose: function (a) {
|
|
|
+ var b = a.newBlock('ai_model_false_create_with_container');
|
|
|
+ b.initSvg();
|
|
|
+ var c = b.nextConnection
|
|
|
+ this.itemCount_ && (a = a.newBlock("ai_model_false_create_with_item"),
|
|
|
+ a.initSvg(),
|
|
|
+ c.connect(a.previousConnection));
|
|
|
+ console.log("this.elseCount_", a)
|
|
|
+ return b
|
|
|
+ },
|
|
|
+ compose: function (a) {
|
|
|
+ var b = a.nextConnection.targetBlock();
|
|
|
+ this.itemCount_ = 0;
|
|
|
+ var e = null;
|
|
|
+ if (b && b.type === "ai_model_false_create_with_item") {
|
|
|
+ this.itemCount_++;
|
|
|
+ e = b.statementConnection_;
|
|
|
+ b = b.nextConnection && b.nextConnection.targetBlock()
|
|
|
+ }
|
|
|
+ this.updateShape_()
|
|
|
+ Blockly.Mutator.reconnect(e, this, "AIELSE")
|
|
|
+ },
|
|
|
+ saveConnections: function (a) {
|
|
|
+ a = a.nextConnection.targetBlock();
|
|
|
+ if (a && a.type === "ai_model_false_create_with_item") {
|
|
|
+ e = this.getInput("AIELSE");
|
|
|
+ a.statementConnection_ = e && e.connection.targetConnection;
|
|
|
+
|
|
|
+ a = a.nextConnection && a.nextConnection.targetBlock()
|
|
|
+ }
|
|
|
+ },
|
|
|
+ updateShape_: function () {
|
|
|
+ this.getInput("AIELSE") && this.removeInput("AIELSE");
|
|
|
+ console.log("this.itemCount_", this.itemCount_)
|
|
|
+ this.itemCount_ && this.appendStatementInput("AIELSE").appendField(Blockly.Msg.CONTROLS_IF_MSG_ELSE)
|
|
|
+ },
|
|
|
+};
|
|
|
+
|
|
|
+Blockly.Blocks['ai_model_false_create_with_container'] = {
|
|
|
+ init: function () {
|
|
|
+ this.setColour("#ee783a");
|
|
|
+ this.appendDummyInput()
|
|
|
+ .appendField(Blockly.Msg.CONTROLS_REPEAT_INPUT_DO);
|
|
|
+ this.setNextStatement(true)
|
|
|
+ this.setTooltip('');
|
|
|
+ this.contextMenu = false;
|
|
|
}
|
|
|
};
|
|
|
|
|
|
-Blockly.Python.ai_model_digital_new = function (block) {
|
|
|
+Blockly.Blocks['ai_model_false_create_with_item'] = {
|
|
|
+ init: function () {
|
|
|
+ this.setColour("#ee783a");
|
|
|
+ this.appendDummyInput().appendField(Blockly.Msg.CONTROLS_IF_ELSE_TITLE_ELSE);
|
|
|
+ this.setPreviousStatement(!0);
|
|
|
+ this.setTooltip(Blockly.Msg.CONTROLS_IF_ELSE_TOOLTIP);
|
|
|
+ this.contextMenu = !1
|
|
|
+ }
|
|
|
+};
|
|
|
+
|
|
|
+Blockly.Python['ai_model_digital_new'] = function (block) {
|
|
|
var statements_input = Blockly.Python.statementToCode(block, 'input');
|
|
|
- var statements_input1 = Blockly.Python.statementToCode(block, 'input1');
|
|
|
+ var statements_input1 = Blockly.Python.statementToCode(block, 'AIELSE');
|
|
|
let allBlocks = block.workspace.getAllBlocks();
|
|
|
let global = ""
|
|
|
try {
|
|
@@ -8741,6 +8808,7 @@ Blockly.Python.ai_model_digital_new = function (block) {
|
|
|
catch (e) {
|
|
|
console.log(e)
|
|
|
}
|
|
|
+ console.log(statements_input1)
|
|
|
Blockly.Python.addFunction("digitalStatements", `def digitalStatements(BOXESI):
|
|
|
${global != "" ? `global ${global}` : "pass"}
|
|
|
${statements_input}
|
|
@@ -8749,11 +8817,10 @@ ${statements_input}
|
|
|
for BOXESI in BOXES:
|
|
|
digitalStatements(BOXESI)
|
|
|
else:
|
|
|
-${statements_input1}
|
|
|
+${statements_input1 != "" ? statements_input1 : " pass"}
|
|
|
`
|
|
|
return code;
|
|
|
-}
|
|
|
-
|
|
|
+};
|
|
|
|
|
|
Blockly.Blocks['ai_model_digital_result'] = {
|
|
|
init: function () {
|
|
@@ -8769,8 +8836,8 @@ Blockly.Blocks['ai_model_digital_result'] = {
|
|
|
[Blockly.Msg.ai_models_hand_written_model_confidence, "confidence"],
|
|
|
[Blockly.Msg.ai_models_object_model_x, "X"],
|
|
|
[Blockly.Msg.ai_models_object_model_y, "Y"],
|
|
|
- [Blockly.Msg.ai_models_object_model_w, "W"],
|
|
|
- [Blockly.Msg.ai_models_object_model_h, "H"],
|
|
|
+ // [Blockly.Msg.ai_models_object_model_w, "W"],
|
|
|
+ // [Blockly.Msg.ai_models_object_model_h, "H"],
|
|
|
[Blockly.Msg.ai_models_face_model_ws, "2"],
|
|
|
[Blockly.Msg.ai_models_face_model_hs, "3"],
|
|
|
[Blockly.Msg.ai_models_object_model_x_center, "CX"],
|
|
@@ -9043,20 +9110,67 @@ Blockly.Blocks['ai_model_look_new'] = {
|
|
|
this.appendStatementInput("input")
|
|
|
.setCheck(null)
|
|
|
.appendField(Blockly.Msg.basic_motion_statement_exec);
|
|
|
- this.appendStatementInput("input1")
|
|
|
- .setCheck(null)
|
|
|
- .appendField(Blockly.Msg.CONTROLS_IF_MSG_ELSE);
|
|
|
+ this.updateShape_();
|
|
|
+ this.setMutator(new Blockly.Mutator(['ai_model_false_create_with_item']));
|
|
|
this.setColour("#ee783a");
|
|
|
- this.setNextStatement(true, null);
|
|
|
this.setPreviousStatement(true, null);
|
|
|
- this.setTooltip(Blockly.Msg.ai_models_object_model_if);
|
|
|
+ this.setNextStatement(true, null);
|
|
|
+ this.setTooltip("");
|
|
|
this.setHelpUrl("");
|
|
|
- }
|
|
|
+ this.itemCount_ = 0;
|
|
|
+ },
|
|
|
+ mutationToDom: function () {
|
|
|
+ if (!this.itemCount_)
|
|
|
+ return null;
|
|
|
+ var container = document.createElement('mutation');
|
|
|
+ this.itemCount_ && container.setAttribute('aielse', 1);
|
|
|
+ return container;
|
|
|
+ },
|
|
|
+ domToMutation: function (a) {
|
|
|
+ this.itemCount_ = parseInt(a.getAttribute('aielse'), 10);
|
|
|
+ this.updateShape_();
|
|
|
+ },
|
|
|
+ decompose: function (a) {
|
|
|
+ var b = a.newBlock('ai_model_false_create_with_container');
|
|
|
+ b.initSvg();
|
|
|
+ var c = b.nextConnection
|
|
|
+ this.itemCount_ && (a = a.newBlock("ai_model_false_create_with_item"),
|
|
|
+ a.initSvg(),
|
|
|
+ c.connect(a.previousConnection));
|
|
|
+ console.log("this.elseCount_", a)
|
|
|
+ return b
|
|
|
+ },
|
|
|
+ compose: function (a) {
|
|
|
+ var b = a.nextConnection.targetBlock();
|
|
|
+ this.itemCount_ = 0;
|
|
|
+ var e = null;
|
|
|
+ if (b && b.type === "ai_model_false_create_with_item") {
|
|
|
+ this.itemCount_++;
|
|
|
+ e = b.statementConnection_;
|
|
|
+ b = b.nextConnection && b.nextConnection.targetBlock()
|
|
|
+ }
|
|
|
+ this.updateShape_()
|
|
|
+ Blockly.Mutator.reconnect(e, this, "AIELSE")
|
|
|
+ },
|
|
|
+ saveConnections: function (a) {
|
|
|
+ a = a.nextConnection.targetBlock();
|
|
|
+ if (a && a.type === "ai_model_false_create_with_item") {
|
|
|
+ e = this.getInput("AIELSE");
|
|
|
+ a.statementConnection_ = e && e.connection.targetConnection;
|
|
|
+
|
|
|
+ a = a.nextConnection && a.nextConnection.targetBlock()
|
|
|
+ }
|
|
|
+ },
|
|
|
+ updateShape_: function () {
|
|
|
+ this.getInput("AIELSE") && this.removeInput("AIELSE");
|
|
|
+ console.log("this.itemCount_", this.itemCount_)
|
|
|
+ this.itemCount_ && this.appendStatementInput("AIELSE").appendField(Blockly.Msg.CONTROLS_IF_MSG_ELSE)
|
|
|
+ },
|
|
|
};
|
|
|
|
|
|
Blockly.Python.ai_model_look_new = function (block) {
|
|
|
var statements_input = Blockly.Python.statementToCode(block, 'input');
|
|
|
- var statements_input1 = Blockly.Python.statementToCode(block, 'input1');
|
|
|
+ var statements_input1 = Blockly.Python.statementToCode(block, 'AIELSE');
|
|
|
let allBlocks = block.workspace.getAllBlocks();
|
|
|
let global = ""
|
|
|
try {
|
|
@@ -9073,7 +9187,7 @@ ${statements_input}
|
|
|
for BOXESI in BOXES:
|
|
|
modelStatements(BOXESI)
|
|
|
else:
|
|
|
-${statements_input1}
|
|
|
+${statements_input1 != "" ? statements_input1 : " pass"}
|
|
|
`
|
|
|
return code;
|
|
|
}
|
|
@@ -9376,20 +9490,67 @@ Blockly.Blocks['ai_model_Guesswork_look_new'] = {
|
|
|
this.appendStatementInput("input")
|
|
|
.setCheck(null)
|
|
|
.appendField(Blockly.Msg.basic_motion_statement_exec);
|
|
|
- this.appendStatementInput("input1")
|
|
|
- .setCheck(null)
|
|
|
- .appendField(Blockly.Msg.CONTROLS_IF_MSG_ELSE);
|
|
|
+ this.updateShape_();
|
|
|
+ this.setMutator(new Blockly.Mutator(['ai_model_false_create_with_item']));
|
|
|
this.setColour("#ee783a");
|
|
|
- this.setNextStatement(true, null);
|
|
|
this.setPreviousStatement(true, null);
|
|
|
- this.setTooltip(Blockly.Msg.ai_model_guesswork_look_attribute);
|
|
|
+ this.setNextStatement(true, null);
|
|
|
+ this.setTooltip("");
|
|
|
this.setHelpUrl("");
|
|
|
- }
|
|
|
+ this.itemCount_ = 0;
|
|
|
+ },
|
|
|
+ mutationToDom: function () {
|
|
|
+ if (!this.itemCount_)
|
|
|
+ return null;
|
|
|
+ var container = document.createElement('mutation');
|
|
|
+ this.itemCount_ && container.setAttribute('aielse', 1);
|
|
|
+ return container;
|
|
|
+ },
|
|
|
+ domToMutation: function (a) {
|
|
|
+ this.itemCount_ = parseInt(a.getAttribute('aielse'), 10);
|
|
|
+ this.updateShape_();
|
|
|
+ },
|
|
|
+ decompose: function (a) {
|
|
|
+ var b = a.newBlock('ai_model_false_create_with_container');
|
|
|
+ b.initSvg();
|
|
|
+ var c = b.nextConnection
|
|
|
+ this.itemCount_ && (a = a.newBlock("ai_model_false_create_with_item"),
|
|
|
+ a.initSvg(),
|
|
|
+ c.connect(a.previousConnection));
|
|
|
+ console.log("this.elseCount_", a)
|
|
|
+ return b
|
|
|
+ },
|
|
|
+ compose: function (a) {
|
|
|
+ var b = a.nextConnection.targetBlock();
|
|
|
+ this.itemCount_ = 0;
|
|
|
+ var e = null;
|
|
|
+ if (b && b.type === "ai_model_false_create_with_item") {
|
|
|
+ this.itemCount_++;
|
|
|
+ e = b.statementConnection_;
|
|
|
+ b = b.nextConnection && b.nextConnection.targetBlock()
|
|
|
+ }
|
|
|
+ this.updateShape_()
|
|
|
+ Blockly.Mutator.reconnect(e, this, "AIELSE")
|
|
|
+ },
|
|
|
+ saveConnections: function (a) {
|
|
|
+ a = a.nextConnection.targetBlock();
|
|
|
+ if (a && a.type === "ai_model_false_create_with_item") {
|
|
|
+ e = this.getInput("AIELSE");
|
|
|
+ a.statementConnection_ = e && e.connection.targetConnection;
|
|
|
+
|
|
|
+ a = a.nextConnection && a.nextConnection.targetBlock()
|
|
|
+ }
|
|
|
+ },
|
|
|
+ updateShape_: function () {
|
|
|
+ this.getInput("AIELSE") && this.removeInput("AIELSE");
|
|
|
+ console.log("this.itemCount_", this.itemCount_)
|
|
|
+ this.itemCount_ && this.appendStatementInput("AIELSE").appendField(Blockly.Msg.CONTROLS_IF_MSG_ELSE)
|
|
|
+ },
|
|
|
};
|
|
|
|
|
|
Blockly.Python.ai_model_Guesswork_look_new = function (block) {
|
|
|
var statements_input = Blockly.Python.statementToCode(block, 'input');
|
|
|
- var statements_input1 = Blockly.Python.statementToCode(block, 'input1');
|
|
|
+ var statements_input1 = Blockly.Python.statementToCode(block, 'AIELSE');
|
|
|
let allBlocks = block.workspace.getAllBlocks();
|
|
|
let global = ""
|
|
|
try {
|
|
@@ -9406,7 +9567,7 @@ ${statements_input}
|
|
|
for BOXESI in BOXES:
|
|
|
GuessworkStatements(BOXESI)
|
|
|
else:
|
|
|
-${statements_input1}
|
|
|
+${statements_input1 != "" ? statements_input1 : " pass"}
|
|
|
`
|
|
|
return code;
|
|
|
}
|
|
@@ -9675,21 +9836,67 @@ Blockly.Blocks['ai_model_face_new'] = {
|
|
|
this.appendStatementInput("input")
|
|
|
.setCheck(null)
|
|
|
.appendField(Blockly.Msg.basic_motion_statement_exec);
|
|
|
-
|
|
|
- this.appendStatementInput("input1")
|
|
|
- .setCheck(null)
|
|
|
- .appendField(Blockly.Msg.CONTROLS_IF_MSG_ELSE);
|
|
|
+ this.updateShape_();
|
|
|
+ this.setMutator(new Blockly.Mutator(['ai_model_false_create_with_item']));
|
|
|
this.setColour("#ee783a");
|
|
|
- this.setNextStatement(true, null);
|
|
|
this.setPreviousStatement(true, null);
|
|
|
- this.setTooltip(Blockly.Msg.ai_model_face_model_list);
|
|
|
+ this.setNextStatement(true, null);
|
|
|
+ this.setTooltip("");
|
|
|
this.setHelpUrl("");
|
|
|
- }
|
|
|
+ this.itemCount_ = 0;
|
|
|
+ },
|
|
|
+ mutationToDom: function () {
|
|
|
+ if (!this.itemCount_)
|
|
|
+ return null;
|
|
|
+ var container = document.createElement('mutation');
|
|
|
+ this.itemCount_ && container.setAttribute('aielse', 1);
|
|
|
+ return container;
|
|
|
+ },
|
|
|
+ domToMutation: function (a) {
|
|
|
+ this.itemCount_ = parseInt(a.getAttribute('aielse'), 10);
|
|
|
+ this.updateShape_();
|
|
|
+ },
|
|
|
+ decompose: function (a) {
|
|
|
+ var b = a.newBlock('ai_model_false_create_with_container');
|
|
|
+ b.initSvg();
|
|
|
+ var c = b.nextConnection
|
|
|
+ this.itemCount_ && (a = a.newBlock("ai_model_false_create_with_item"),
|
|
|
+ a.initSvg(),
|
|
|
+ c.connect(a.previousConnection));
|
|
|
+ console.log("this.elseCount_", a)
|
|
|
+ return b
|
|
|
+ },
|
|
|
+ compose: function (a) {
|
|
|
+ var b = a.nextConnection.targetBlock();
|
|
|
+ this.itemCount_ = 0;
|
|
|
+ var e = null;
|
|
|
+ if (b && b.type === "ai_model_false_create_with_item") {
|
|
|
+ this.itemCount_++;
|
|
|
+ e = b.statementConnection_;
|
|
|
+ b = b.nextConnection && b.nextConnection.targetBlock()
|
|
|
+ }
|
|
|
+ this.updateShape_()
|
|
|
+ Blockly.Mutator.reconnect(e, this, "AIELSE")
|
|
|
+ },
|
|
|
+ saveConnections: function (a) {
|
|
|
+ a = a.nextConnection.targetBlock();
|
|
|
+ if (a && a.type === "ai_model_false_create_with_item") {
|
|
|
+ e = this.getInput("AIELSE");
|
|
|
+ a.statementConnection_ = e && e.connection.targetConnection;
|
|
|
+
|
|
|
+ a = a.nextConnection && a.nextConnection.targetBlock()
|
|
|
+ }
|
|
|
+ },
|
|
|
+ updateShape_: function () {
|
|
|
+ this.getInput("AIELSE") && this.removeInput("AIELSE");
|
|
|
+ console.log("this.itemCount_", this.itemCount_)
|
|
|
+ this.itemCount_ && this.appendStatementInput("AIELSE").appendField(Blockly.Msg.CONTROLS_IF_MSG_ELSE)
|
|
|
+ },
|
|
|
};
|
|
|
|
|
|
Blockly.Python.ai_model_face_new = function (block) {
|
|
|
var statements_input = Blockly.Python.statementToCode(block, 'input');
|
|
|
- var statements_input1 = Blockly.Python.statementToCode(block, 'input1');
|
|
|
+ var statements_input1 = Blockly.Python.statementToCode(block, 'AIELSE');
|
|
|
let allBlocks = block.workspace.getAllBlocks();
|
|
|
let global = ""
|
|
|
try {
|
|
@@ -9706,7 +9913,7 @@ ${statements_input}
|
|
|
for BOXESI in BOXES:
|
|
|
GuessworkStatements(BOXESI)
|
|
|
else:
|
|
|
-${statements_input1}
|
|
|
+${statements_input1 != "" ? statements_input1 : " pass"}
|
|
|
`
|
|
|
return code;
|
|
|
}
|
|
@@ -10006,20 +10213,67 @@ Blockly.Blocks['ai_model_card_xy_new'] = {
|
|
|
this.appendStatementInput("input")
|
|
|
.setCheck(null)
|
|
|
.appendField(Blockly.Msg.basic_motion_statement_exec);
|
|
|
- this.appendStatementInput("input1")
|
|
|
- .setCheck(null)
|
|
|
- .appendField(Blockly.Msg.CONTROLS_IF_MSG_ELSE);
|
|
|
+ this.updateShape_();
|
|
|
+ this.setMutator(new Blockly.Mutator(['ai_model_false_create_with_item']));
|
|
|
this.setColour("#ee783a");
|
|
|
- this.setNextStatement(true, null);
|
|
|
this.setPreviousStatement(true, null);
|
|
|
- this.setTooltip(Blockly.Msg.ai_models_card_attribute);
|
|
|
+ this.setNextStatement(true, null);
|
|
|
+ this.setTooltip("");
|
|
|
this.setHelpUrl("");
|
|
|
- }
|
|
|
+ this.itemCount_ = 0;
|
|
|
+ },
|
|
|
+ mutationToDom: function () {
|
|
|
+ if (!this.itemCount_)
|
|
|
+ return null;
|
|
|
+ var container = document.createElement('mutation');
|
|
|
+ this.itemCount_ && container.setAttribute('aielse', 1);
|
|
|
+ return container;
|
|
|
+ },
|
|
|
+ domToMutation: function (a) {
|
|
|
+ this.itemCount_ = parseInt(a.getAttribute('aielse'), 10);
|
|
|
+ this.updateShape_();
|
|
|
+ },
|
|
|
+ decompose: function (a) {
|
|
|
+ var b = a.newBlock('ai_model_false_create_with_container');
|
|
|
+ b.initSvg();
|
|
|
+ var c = b.nextConnection
|
|
|
+ this.itemCount_ && (a = a.newBlock("ai_model_false_create_with_item"),
|
|
|
+ a.initSvg(),
|
|
|
+ c.connect(a.previousConnection));
|
|
|
+ console.log("this.elseCount_", a)
|
|
|
+ return b
|
|
|
+ },
|
|
|
+ compose: function (a) {
|
|
|
+ var b = a.nextConnection.targetBlock();
|
|
|
+ this.itemCount_ = 0;
|
|
|
+ var e = null;
|
|
|
+ if (b && b.type === "ai_model_false_create_with_item") {
|
|
|
+ this.itemCount_++;
|
|
|
+ e = b.statementConnection_;
|
|
|
+ b = b.nextConnection && b.nextConnection.targetBlock()
|
|
|
+ }
|
|
|
+ this.updateShape_()
|
|
|
+ Blockly.Mutator.reconnect(e, this, "AIELSE")
|
|
|
+ },
|
|
|
+ saveConnections: function (a) {
|
|
|
+ a = a.nextConnection.targetBlock();
|
|
|
+ if (a && a.type === "ai_model_false_create_with_item") {
|
|
|
+ e = this.getInput("AIELSE");
|
|
|
+ a.statementConnection_ = e && e.connection.targetConnection;
|
|
|
+
|
|
|
+ a = a.nextConnection && a.nextConnection.targetBlock()
|
|
|
+ }
|
|
|
+ },
|
|
|
+ updateShape_: function () {
|
|
|
+ this.getInput("AIELSE") && this.removeInput("AIELSE");
|
|
|
+ console.log("this.itemCount_", this.itemCount_)
|
|
|
+ this.itemCount_ && this.appendStatementInput("AIELSE").appendField(Blockly.Msg.CONTROLS_IF_MSG_ELSE)
|
|
|
+ },
|
|
|
};
|
|
|
|
|
|
Blockly.Python['ai_model_card_xy_new'] = function (block) {
|
|
|
var statements_input = Blockly.Python.statementToCode(block, 'input');
|
|
|
- var statements_input1 = Blockly.Python.statementToCode(block, 'input1');
|
|
|
+ var statements_input1 = Blockly.Python.statementToCode(block, 'AIELSE');
|
|
|
let allBlocks = block.workspace.getAllBlocks();
|
|
|
let global = ""
|
|
|
try {
|
|
@@ -10036,7 +10290,7 @@ ${statements_input}
|
|
|
for BOXESI in BOXES:
|
|
|
cardStatements(BOXESI)
|
|
|
else:
|
|
|
-${statements_input1}
|
|
|
+${statements_input1 != "" ? statements_input1 : " pass"}
|
|
|
`
|
|
|
return code;
|
|
|
};
|
|
@@ -10052,13 +10306,13 @@ Blockly.Blocks['ai_model_card_get'] = {
|
|
|
[Blockly.Msg.ai_models_init_card_result, "Object"],
|
|
|
[Blockly.Msg.ai_models_object_model_x, "X"],
|
|
|
[Blockly.Msg.ai_models_object_model_y, "Y"],
|
|
|
- [Blockly.Msg.ai_models_object_model_w, "W"],
|
|
|
- [Blockly.Msg.ai_models_object_model_h, "H"],
|
|
|
+ // [Blockly.Msg.ai_models_object_model_w, "W"],
|
|
|
+ // [Blockly.Msg.ai_models_object_model_h, "H"],
|
|
|
// [Blockly.Msg.ai_models_object_model_x_center, "CX"],
|
|
|
// [Blockly.Msg.ai_models_object_model_y_center, "CY"],
|
|
|
// [Blockly.Msg.ai_models_object_model_count, "Number"],
|
|
|
// [Blockly.Msg.ai_models_object_model_index, "Serial"],
|
|
|
- [Blockly.Msg.ai_models_object_model_confidence, "Confidence"],
|
|
|
+ // [Blockly.Msg.ai_models_object_model_confidence, "Confidence"],
|
|
|
[Blockly.Msg.ai_models_face_model_ws, "2"],
|
|
|
[Blockly.Msg.ai_models_face_model_hs, "3"],
|
|
|
[Blockly.Msg.ai_models_object_model_x_center, "CX"],
|
|
@@ -10522,20 +10776,67 @@ Blockly.Blocks['face_recognition_if_face_new'] = {
|
|
|
this.appendStatementInput("input")
|
|
|
.setCheck(null)
|
|
|
.appendField(Blockly.Msg.basic_motion_statement_exec);
|
|
|
- this.appendStatementInput("input1")
|
|
|
- .setCheck(null)
|
|
|
- .appendField(Blockly.Msg.CONTROLS_IF_MSG_ELSE);
|
|
|
- this.setColour("#ee783a");
|
|
|
- this.setNextStatement(true, null);
|
|
|
- this.setPreviousStatement(true, null);
|
|
|
- this.setTooltip(Blockly.Msg.ai_model_face_attribute_new);
|
|
|
- this.setHelpUrl("");
|
|
|
- }
|
|
|
+ this.updateShape_();
|
|
|
+ this.setMutator(new Blockly.Mutator(['ai_model_false_create_with_item']));
|
|
|
+ this.setColour("#ee783a");
|
|
|
+ this.setPreviousStatement(true, null);
|
|
|
+ this.setNextStatement(true, null);
|
|
|
+ this.setTooltip("");
|
|
|
+ this.setHelpUrl("");
|
|
|
+ this.itemCount_ = 0;
|
|
|
+ },
|
|
|
+ mutationToDom: function () {
|
|
|
+ if (!this.itemCount_)
|
|
|
+ return null;
|
|
|
+ var container = document.createElement('mutation');
|
|
|
+ this.itemCount_ && container.setAttribute('aielse', 1);
|
|
|
+ return container;
|
|
|
+ },
|
|
|
+ domToMutation: function (a) {
|
|
|
+ this.itemCount_ = parseInt(a.getAttribute('aielse'), 10);
|
|
|
+ this.updateShape_();
|
|
|
+ },
|
|
|
+ decompose: function (a) {
|
|
|
+ var b = a.newBlock('ai_model_false_create_with_container');
|
|
|
+ b.initSvg();
|
|
|
+ var c = b.nextConnection
|
|
|
+ this.itemCount_ && (a = a.newBlock("ai_model_false_create_with_item"),
|
|
|
+ a.initSvg(),
|
|
|
+ c.connect(a.previousConnection));
|
|
|
+ console.log("this.elseCount_",a)
|
|
|
+ return b
|
|
|
+ },
|
|
|
+ compose: function (a) {
|
|
|
+ var b = a.nextConnection.targetBlock();
|
|
|
+ this.itemCount_ = 0;
|
|
|
+ var e = null;
|
|
|
+ if (b && b.type === "ai_model_false_create_with_item") {
|
|
|
+ this.itemCount_++;
|
|
|
+ e = b.statementConnection_;
|
|
|
+ b = b.nextConnection && b.nextConnection.targetBlock()
|
|
|
+ }
|
|
|
+ this.updateShape_()
|
|
|
+ Blockly.Mutator.reconnect(e, this, "AIELSE")
|
|
|
+ },
|
|
|
+ saveConnections: function (a) {
|
|
|
+ a = a.nextConnection.targetBlock();
|
|
|
+ if (a && a.type === "ai_model_false_create_with_item") {
|
|
|
+ e = this.getInput("AIELSE");
|
|
|
+ a.statementConnection_ = e && e.connection.targetConnection;
|
|
|
+
|
|
|
+ a = a.nextConnection && a.nextConnection.targetBlock()
|
|
|
+ }
|
|
|
+ },
|
|
|
+ updateShape_: function () {
|
|
|
+ this.getInput("AIELSE") && this.removeInput("AIELSE");
|
|
|
+ console.log("this.itemCount_",this.itemCount_)
|
|
|
+ this.itemCount_ && this.appendStatementInput("AIELSE").appendField(Blockly.Msg.CONTROLS_IF_MSG_ELSE)
|
|
|
+ },
|
|
|
};
|
|
|
|
|
|
Blockly.Python['face_recognition_if_face_new'] = function (block) {
|
|
|
var statements_input = Blockly.Python.statementToCode(block, 'input');
|
|
|
- var statements_input1 = Blockly.Python.statementToCode(block, 'input1');
|
|
|
+ var statements_input1 = Blockly.Python.statementToCode(block, 'AIELSE');
|
|
|
let allBlocks = block.workspace.getAllBlocks();
|
|
|
let global = ""
|
|
|
try {
|
|
@@ -10552,7 +10853,7 @@ ${statements_input}
|
|
|
for BOXESI in FACERECGNIZER.FACESRECOGNITONRESULT:
|
|
|
recognitionStatements(BOXESI)
|
|
|
else:
|
|
|
-${statements_input1}
|
|
|
+${statements_input1 != "" ? statements_input1 : " pass"}
|
|
|
`
|
|
|
return code;
|
|
|
};
|
|
@@ -12379,7 +12680,7 @@ Blockly.Python['ai_model_customized_load_setup'] = function (block) {
|
|
|
for BOXESI, BOXOBJ in enumerate(BOXES):
|
|
|
canvas.draw_string((BOXOBJ[0]),(BOXOBJ[1]), ("".join([str(x) for x in [self.labels[PROBS[BOXESI][0]], ";", str(round((PROBS[BOXESI][1][PROBS[BOXESI][0]]*100), 2)) + str("%")]])), scale = 1, color = (255,0,0) , thickness = 1)
|
|
|
canvas.draw_rectangle((BOXOBJ[0]),(BOXOBJ[1]), (BOXOBJ[0])+(BOXOBJ[2]),(BOXOBJ[1])+ (BOXOBJ[3]), color=(255,0,0), thickness=1)
|
|
|
- BOXES[BOXESI].append(PROBS[BOXESI])
|
|
|
+ BOXES[BOXESI].append(PROBS[BOXESI])
|
|
|
return BOXES
|
|
|
|
|
|
|
|
@@ -12473,20 +12774,67 @@ Blockly.Blocks['ai_model_customized_if_got_new'] = {
|
|
|
this.appendStatementInput("input")
|
|
|
.setCheck(null)
|
|
|
.appendField(Blockly.Msg.basic_motion_statement_exec);
|
|
|
- this.appendStatementInput("input1")
|
|
|
- .setCheck(null)
|
|
|
- .appendField(Blockly.Msg.CONTROLS_IF_MSG_ELSE);
|
|
|
- this.setColour("#ee783a");
|
|
|
- this.setNextStatement(true, null);
|
|
|
- this.setPreviousStatement(true, null);
|
|
|
- this.setTooltip(Blockly.Msg.ai_model_customized_attribute);
|
|
|
- this.setHelpUrl("");
|
|
|
- }
|
|
|
+ this.updateShape_();
|
|
|
+ this.setMutator(new Blockly.Mutator(['ai_model_false_create_with_item']));
|
|
|
+ this.setColour("#ee783a");
|
|
|
+ this.setPreviousStatement(true, null);
|
|
|
+ this.setNextStatement(true, null);
|
|
|
+ this.setTooltip("");
|
|
|
+ this.setHelpUrl("");
|
|
|
+ this.itemCount_ = 0;
|
|
|
+ },
|
|
|
+ mutationToDom: function () {
|
|
|
+ if (!this.itemCount_)
|
|
|
+ return null;
|
|
|
+ var container = document.createElement('mutation');
|
|
|
+ this.itemCount_ && container.setAttribute('aielse', 1);
|
|
|
+ return container;
|
|
|
+ },
|
|
|
+ domToMutation: function (a) {
|
|
|
+ this.itemCount_ = parseInt(a.getAttribute('aielse'), 10);
|
|
|
+ this.updateShape_();
|
|
|
+ },
|
|
|
+ decompose: function (a) {
|
|
|
+ var b = a.newBlock('ai_model_false_create_with_container');
|
|
|
+ b.initSvg();
|
|
|
+ var c = b.nextConnection
|
|
|
+ this.itemCount_ && (a = a.newBlock("ai_model_false_create_with_item"),
|
|
|
+ a.initSvg(),
|
|
|
+ c.connect(a.previousConnection));
|
|
|
+ console.log("this.elseCount_",a)
|
|
|
+ return b
|
|
|
+ },
|
|
|
+ compose: function (a) {
|
|
|
+ var b = a.nextConnection.targetBlock();
|
|
|
+ this.itemCount_ = 0;
|
|
|
+ var e = null;
|
|
|
+ if (b && b.type === "ai_model_false_create_with_item") {
|
|
|
+ this.itemCount_++;
|
|
|
+ e = b.statementConnection_;
|
|
|
+ b = b.nextConnection && b.nextConnection.targetBlock()
|
|
|
+ }
|
|
|
+ this.updateShape_()
|
|
|
+ Blockly.Mutator.reconnect(e, this, "AIELSE")
|
|
|
+ },
|
|
|
+ saveConnections: function (a) {
|
|
|
+ a = a.nextConnection.targetBlock();
|
|
|
+ if (a && a.type === "ai_model_false_create_with_item") {
|
|
|
+ e = this.getInput("AIELSE");
|
|
|
+ a.statementConnection_ = e && e.connection.targetConnection;
|
|
|
+
|
|
|
+ a = a.nextConnection && a.nextConnection.targetBlock()
|
|
|
+ }
|
|
|
+ },
|
|
|
+ updateShape_: function () {
|
|
|
+ this.getInput("AIELSE") && this.removeInput("AIELSE");
|
|
|
+ console.log("this.itemCount_",this.itemCount_)
|
|
|
+ this.itemCount_ && this.appendStatementInput("AIELSE").appendField(Blockly.Msg.CONTROLS_IF_MSG_ELSE)
|
|
|
+ },
|
|
|
};
|
|
|
|
|
|
Blockly.Python['ai_model_customized_if_got_new'] = function (block) {
|
|
|
var statements_input = Blockly.Python.statementToCode(block, 'input');
|
|
|
- var statements_input1 = Blockly.Python.statementToCode(block, 'input1');
|
|
|
+ var statements_input1 = Blockly.Python.statementToCode(block, 'AIELSE');
|
|
|
let allBlocks = block.workspace.getAllBlocks();
|
|
|
let global = ""
|
|
|
try {
|
|
@@ -12503,7 +12851,7 @@ ${statements_input}
|
|
|
for BOXESI in BOXES:
|
|
|
cardStatements(BOXESI)
|
|
|
else:
|
|
|
-${statements_input1}
|
|
|
+${statements_input1 != "" ? statements_input1 : " pass"}
|
|
|
`
|
|
|
return code;
|
|
|
};
|
|
@@ -12966,7 +13314,7 @@ Blockly.Python.set_pinyin_dict_create_with_items_insert = function (block) {
|
|
|
a[b] = c + block.getFieldValue("toneADD" + b + b);
|
|
|
}
|
|
|
console.log(a.join(" "))
|
|
|
- a = `"${a.join(" ")}"` ;
|
|
|
+ a = `"${a.join(" ")}"`;
|
|
|
return [a, Blockly.Python.ORDER_ATOMIC]
|
|
|
};
|
|
|
|