diff --git a/boards/default_src/python_mixpy/blocks/turtle.js b/boards/default_src/python_mixpy/blocks/turtle.js index c3cc5675..4766a487 100644 --- a/boards/default_src/python_mixpy/blocks/turtle.js +++ b/boards/default_src/python_mixpy/blocks/turtle.js @@ -171,7 +171,6 @@ export const turtle_setxy = { }; export const turtle_pos_shape = { - init: function () { this.setColour(TURTLE_HUE); var pos_shape = @@ -200,6 +199,18 @@ export const turtle_pos_shape = { } }; +export const turtle_stamp = { + init: function () { + this.setColour(TURTLE_HUE); + this.appendValueInput('TUR') + .setCheck('Turtle') + this.appendDummyInput() + .appendField(Blockly.Msg.TURTLE_STAMP); + this.setInputsInline(true); + this.setPreviousStatement(true); + this.setNextStatement(true); + } +}; export const turtle_clear = { init: function () { @@ -211,8 +222,6 @@ export const turtle_clear = { this.setColour(TURTLE_HUE); this.appendDummyInput("") .appendField(new Blockly.FieldDropdown(clear_reset), 'DIR') - - this.setInputsInline(true); this.setPreviousStatement(true); this.setNextStatement(true); diff --git a/boards/default_src/python_mixpy/generators/turtle.js b/boards/default_src/python_mixpy/generators/turtle.js index c0ba5d4d..80002b68 100644 --- a/boards/default_src/python_mixpy/generators/turtle.js +++ b/boards/default_src/python_mixpy/generators/turtle.js @@ -75,6 +75,13 @@ export const turtle_pos_shape = function (_, generator) { return [code, generator.ORDER_ATOMIC]; } +export const turtle_stamp = function (_, generator) { + generator.definitions_.import_turtle = "import turtle"; + var varName = generator.valueToCode(this, 'TUR', generator.ORDER_ASSIGNMENT) || '0'; + var code = varName + '.stamp()\n'; + return code; +} + export const turtle_clear = function (_, generator) { generator.definitions_.import_turtle = "import turtle"; var varName = generator.valueToCode(this, 'TUR', generator.ORDER_ASSIGNMENT) || '0'; diff --git a/boards/default_src/python_mixpy/template.xml b/boards/default_src/python_mixpy/template.xml index 8ba4021a..a70b5b49 100644 --- a/boards/default_src/python_mixpy/template.xml +++ b/boards/default_src/python_mixpy/template.xml @@ -1814,6 +1814,13 @@ + + + + tina + + + diff --git a/boards/default_src/python_pyodide/template.xml b/boards/default_src/python_pyodide/template.xml index 1a58a660..896c0083 100644 --- a/boards/default_src/python_pyodide/template.xml +++ b/boards/default_src/python_pyodide/template.xml @@ -1777,6 +1777,13 @@ + + + + tina + + + diff --git a/boards/default_src/python_skulpt/template.xml b/boards/default_src/python_skulpt/template.xml index f1bc3176..84404978 100644 --- a/boards/default_src/python_skulpt/template.xml +++ b/boards/default_src/python_skulpt/template.xml @@ -1445,6 +1445,13 @@ + + + + tina + + + diff --git a/common/msg/blockly/en.js b/common/msg/blockly/en.js index ce5a62aa..0bbfa84c 100644 --- a/common/msg/blockly/en.js +++ b/common/msg/blockly/en.js @@ -1776,6 +1776,7 @@ En.TURTLE_POS_SHAPE = "Get the turtle currently"; En.TURTLE_POS = "Get the current position of the turtle"; En.TURTLE_SHAPE = "shape"; En.TURTLE_HEADING = "Heading"; +En.TURTLE_STAMP = "Stamp"; En.MIXLY_TOOLTIP_TURTEL_POS = 'Get the turtle\'s current position and return a tuple containing the current position x and y coordinates'; En.MIXLY_TOOLTIP_TURTEL_SHAPE = 'Get the turtle\'s current shape and return a string'; En.MIXLY_TOOLTIP_TURTEL_GET_SPEED = "get the turtles current speed and return an integer;"; diff --git a/common/msg/blockly/zh-hans.js b/common/msg/blockly/zh-hans.js index 0a03b0ed..7c91fcb9 100644 --- a/common/msg/blockly/zh-hans.js +++ b/common/msg/blockly/zh-hans.js @@ -1789,6 +1789,7 @@ ZhHans.TURTLE_POS_SHAPE = "获取海龟当前"; ZhHans.TURTLE_POS = "位置"; ZhHans.TURTLE_SHAPE = "形状"; ZhHans.TURTLE_HEADING = "朝向"; +ZhHans.TURTLE_STAMP = "留下印记"; ZhHans.MIXLY_TOOLTIP_TURTEL_POS = '获取海龟当前位置,返回一个包含当前位置x坐标和y坐标的元组'; ZhHans.MIXLY_TOOLTIP_TURTEL_SHAPE = '获取海龟当前形状,返回一个字符串'; ZhHans.MIXLY_TOOLTIP_TURTEL_GET_SPEED = '获取海龟当前速度,返回一个整数'; diff --git a/common/msg/blockly/zh-hant.js b/common/msg/blockly/zh-hant.js index c634a67d..173f70ac 100644 --- a/common/msg/blockly/zh-hant.js +++ b/common/msg/blockly/zh-hant.js @@ -1789,6 +1789,7 @@ ZhHant.TURTLE_POS_SHAPE = "獲取海龜當前"; ZhHant.TURTLE_POS = "位置"; ZhHant.TURTLE_SHAPE = "形狀"; ZhHant.TURTLE_HEADING = "朝向"; +ZhHant.TURTLE_STAMP = "留下印記"; ZhHant.MIXLY_TOOLTIP_TURTEL_POS = '獲取海龜當前位置,返回一個包含當前位置x座標和y座標的元組'; ZhHant.MIXLY_TOOLTIP_TURTEL_SHAPE = '獲取海龜當前形狀,返回一個字符串'; ZhHant.MIXLY_TOOLTIP_TURTEL_GET_SPEED = '獲取海龜當前速度,返回一個整數';