Skip to content

Commit

Permalink
blockly plugin: fix item get
Browse files Browse the repository at this point in the history
  • Loading branch information
onkelandy committed Oct 25, 2023
1 parent 1fef141 commit 1e08880
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions blockly/webif/static/shblocks/sh_items.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ Blockly.Blocks['sh_item_obj'] = {
Blockly.Python['sh_item_obj'] = function(block) {
var iName = block.getFieldValue('N');
var iPath = block.getFieldValue('P');

// TODO: Assemble Python into code variable.
// var code = 'sh.return_item("' + iPath + '")';
var code = 'sh.items.return_item("' + iPath + '")';
Expand Down Expand Up @@ -110,9 +110,8 @@ Blockly.Blocks['sh_item_get'] = {

Blockly.Python['sh_item_get'] = function(block) {
var itemobj = Blockly.Python.valueToCode(block, 'ITEMOBJECT', Blockly.Python.ORDER_ATOMIC) || 'item';
var code = itemobj + '()';
//return [code, Blockly.Python.ORDER_NONE];
return code;
var code = itemobj + '.property.value';
return [code, Blockly.Python.ORDER_NONE];
};


Expand Down Expand Up @@ -142,8 +141,7 @@ Blockly.Python['sh_item_set'] = function(block) {
// TODO: Assemble Python into code variable.
//var code = '...';
var code = itemobject + '(' + value + ')\n';
//return [code, Blockly.Python.ORDER_FUNCTION_CALL];
return code;
return [code, Blockly.Python.ORDER_FUNCTION_CALL];
};

Blockly.Blocks['sh_item_hasattr'] = {
Expand Down Expand Up @@ -174,7 +172,7 @@ Blockly.Python['sh_item_hasattr'] = function(block) {

};

/**
/**
Blockly.Blocks['sh_item_attr'] = {
init: function() {
var attrlist = new Blockly.FieldTextInput('0');
Expand Down Expand Up @@ -208,4 +206,4 @@ Blockly.Python['sh_item_attr'] = function(block) {
return [code, Blockly.Python.ORDER_NONE];
};
*/
*/

0 comments on commit 1e08880

Please sign in to comment.