Skip to content

Commit f3745fd

Browse files
committed
wip #64
1 parent 0042a5f commit f3745fd

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

static/js/blockly/blocks.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -859,6 +859,28 @@ Blockly.Python['hashmap_get_value'] = function(block) {
859859
return [code, Blockly.Python.ORDER_NONE];
860860
};
861861

862+
Blockly.Blocks['hashmap_get_keys'] = {
863+
init: function() {
864+
this.appendDummyInput()
865+
.appendField("get keys");
866+
this.appendValueInput("map")
867+
.setCheck("HashMap")
868+
.appendField("from ");
869+
this.setInputsInline(true);
870+
this.setOutput(true, "Array");
871+
this.setColour(230);
872+
this.setTooltip("get keys from an hashmap");
873+
this.setHelpUrl("");
874+
}
875+
};
876+
877+
Blockly.Python['hashmap_get_keys'] = function(block) {
878+
var value_map = Blockly.Python.valueToCode(block, 'map', Blockly.Python.ORDER_ATOMIC);
879+
var code = value_map + '.keys()';
880+
return [code, Blockly.Python.ORDER_NONE];
881+
};
882+
883+
862884
Blockly.Blocks['coderbot_conv_get_action'] = {
863885
init: function() {
864886
this.appendDummyInput()

templates/blocks_adv.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,8 @@
162162
</block>
163163
<block type="hashmap_get_value">
164164
</block>
165+
<block type="hashmap_get_keys">
166+
</block>
165167
</category>
166168
<category name="{% trans %}Variables{% endtrans %}" custom="VARIABLE" colour="330"></category>
167169
<category name="{% trans %}Functions{% endtrans %}" custom="PROCEDURE" colour="290"></category>

0 commit comments

Comments
 (0)