-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgenerators.ts
More file actions
37 lines (33 loc) · 1.6 KB
/
Copy pathgenerators.ts
File metadata and controls
37 lines (33 loc) · 1.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
Blockly.Python['import_DriveBit'] = function(block) {
var code = 'from DriveBit import *\n';
return code;
};
Blockly.Python['DriveBit_init'] = function(block) {
var variable_robot = Blockly.Python.variableDB_.getName(block.getFieldValue('robot'), Blockly.Variables.NAME_TYPE);
// TODO: Assemble Python into code variable.
var code = variable_robot + ' = DriveBit()\n';
return code;
};
Blockly.Python['DriveBit_direction'] = function(block) {
var variable_robot = Blockly.Python.variableDB_.getName(block.getFieldValue('robot'), Blockly.Variables.NAME_TYPE);
var dropdown_motor = block.getFieldValue('motor');
var dropdown_direction = block.getFieldValue('direction');
var value_name = Blockly.Python.valueToCode(block, 'NAME', Blockly.Python.ORDER_ATOMIC);
// TODO: Assemble Python into code variable.
var code = variable_robot+ '.motor.' +dropdown_motor+ '.' +dropdown_direction+ '(' +value_name+ ')\n';
return code;
};
Blockly.Python['DriveBit_stop'] = function(block) {
var variable_robot = Blockly.Python.variableDB_.getName(block.getFieldValue('robot'), Blockly.Variables.NAME_TYPE);
var dropdown_motor = block.getFieldValue('motor');
// TODO: Assemble Python into code variable.
var code = variable_robot+ '.motor.' +dropdown_motor+ '.stop()\n';
return code;
};
Blockly.Python['sliderinlinerobot'] = function(block) {
var text_text = block.getFieldValue('slider');
// TODO: Assemble Python into code variable.
var code = text_text;
// TODO: Change ORDER_NONE to the correct strength.
return [code, Blockly.Python.ORDER_ATOMIC];
};