Skip to content

Commit

Permalink
blocks fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
CAmi307 committed Jun 6, 2023
1 parent e2898d0 commit 0de79d1
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 57 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -246,15 +246,6 @@ module.exports = function (blockly) {
return code;
};

// Blockly.Python['measure_distance'] = function() {
// Blockly.Python.compute_distance();
// Blockly.Python.distance = Blockly.Python.variableDB_.getDistinctName('distance', Blockly.Generator.NAME_TYPE);

// var code = Blockly.Python.distance + ' = getDistance()\n';

// return code;
// };

Blockly.Python['get_distance'] = function(block) {
Blockly.Python.compute_distance();
var unit = block.getFieldValue('unit');
Expand All @@ -280,7 +271,6 @@ module.exports = function (blockly) {
Blockly.Python.import_json();
// TODO: Assemble Python into code variable.
Blockly.Python.val_city = block.getFieldValue('city_value').toString();
// Blockly.Python.val_country_code = block.getFieldValue('country_code_value').toString();
Blockly.Python.val_api_key = block.getFieldValue('api_key_value').toString();
// TODO: Change ORDER_NONE to the correct strength.
var code = 'URL = "https://api.openweathermap.org/data/2.5/weather?q=' + Blockly.Python.val_city + '&appid=' + Blockly.Python.val_api_key + '"\n';
Expand All @@ -290,14 +280,6 @@ module.exports = function (blockly) {
return code;
};

// Blockly.Python['open_weather_show_label'] = function (block) {
// // TODO: Assemble Python into code variable.
// var code = block.getFieldValue('type') + ' = ' + ' data' + Blockly.Python.valueToCode(block, 'value', Blockly.Python.ORDER_NONE) + '\n\t';
// code += 'print(' + block.getFieldValue('type') + ')\n';
// // TODO: Change ORDER_NONE to the correct strength.
// return code;
// };

Blockly.Python['open_weather_get_data'] = function (block) {
var type_value = block.getFieldValue('type');
var code = 'data';
Expand Down Expand Up @@ -388,7 +370,7 @@ module.exports = function (blockly) {
return code;
};

Blockly.Python['initialize_communication_simple'] = function(block) {
Blockly.Python['initialize_communication_simple'] = function() {
Blockly.Python.import_socket();

// TODO: Assemble Python into code variable.
Expand Down Expand Up @@ -489,7 +471,6 @@ module.exports = function (blockly) {

var content_type_value = parseInt(block.getFieldValue('content_type_value'));
var message_value = Blockly.Python.valueToCode(block, 'message_value', Blockly.Python.ORDER_ATOMIC);
var status_message = '';

if(content_type_value == 0) {
content_type_value = 'text/plain';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ module.exports = function (blockly) {
this.appendDummyInput()
.appendField('Set position of')
.appendField(new Blockly.FieldTextInput('servoName1'), 'servo_name')
.appendField('to:')
.appendField('to')
.appendField(new Blockly.FieldTextInput('degrees'), 'angle')
.appendField('degrees');
this.setPreviousStatement(true);
Expand Down Expand Up @@ -124,18 +124,6 @@ module.exports = function (blockly) {
}
};

// Blockly.Blocks['measure_distance'] = {
// init: function() {
// this.setHelpUrl('http://www.example.com/');
// this.setColour(45);
// this.appendDummyInput()
// .appendField('Measure current distance');
// this.setPreviousStatement(true);
// this.setNextStatement(true);
// this.setTooltip('Get\'s the current distance to the closest object and saves it in a variable.');
// }
// };

Blockly.Blocks['get_distance'] = {
init: function() {
this.setHelpUrl('http://www.example.com/');
Expand Down Expand Up @@ -171,25 +159,6 @@ module.exports = function (blockly) {
}
};

// Blockly.Blocks['open_weather_show_label'] = {
// init: function () {
// this.setHelpUrl('https://projects.wyliodrin.com/wiki/languages/visual#write');
// this.setColour(200);
// this.appendDummyInput()
// .appendField('Label');
// this.appendDummyInput()
// .appendField(new Blockly.FieldDropdown([['coordinates','coord'],['temp', 'temp'], ['temp_feels', 'temp_feels'], ['weather_state', 'weather_state'], ['weather icon name', 'weather_icon']]), 'type');
// this.appendDummyInput()
// .appendField('show');
// this.appendValueInput('value');
// this.appendDummyInput();
// this.setInputsInline(true);
// this.setPreviousStatement(true);
// this.setNextStatement(true);
// this.setTooltip('Sets the label for retrieved information');
// }
// };

Blockly.Blocks['open_weather_get_data'] = {
init: function () {
this.setColour(200);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,6 @@
<category name="Distance measurement" colour="45">
<block type="distance_initialize" colour="45">
</block>
<!-- <block type="measure_distance" colour="45">
</block> -->
<block type="get_distance" colour="45">
</block>
</category>
Expand All @@ -112,9 +110,6 @@
</block>
</value>
</block>
<!-- <block type="open_weather_show_label" colour="200">
<value name="value"></value>
</block> -->
<block type="open_weather_get_data" colour="200">
</block>
</category>
Expand Down

0 comments on commit 0de79d1

Please sign in to comment.