minor changes

This commit is contained in:
Mario
2020-09-17 15:16:41 +02:00
parent 6a4de9c7a2
commit 42299a374a
8 changed files with 44 additions and 32 deletions
+7 -7
View File
@@ -33,11 +33,11 @@ class BlocklyWindow extends Component {
componentDidUpdate(props) {
const workspace = Blockly.getMainWorkspace();
var initialXML = this.props.initialXml
if(props.initialXml !== initialXml){
if (props.initialXml !== initialXml) {
// guarantees that the current xml-code (this.props.initialXml) is rendered
workspace.clear();
if(!initialXML) initialXML = initialXml;
Blockly.Xml.domToWorkspace(Blockly.Xml.textToDom(initialXML), workspace) ;
if (!initialXML) initialXML = initialXml;
Blockly.Xml.domToWorkspace(Blockly.Xml.textToDom(initialXML), workspace);
}
Blockly.svgResize(workspace);
}
@@ -48,11 +48,11 @@ class BlocklyWindow extends Component {
style={this.props.blocklyCSS}
readOnly={this.props.readOnly !== undefined ? this.props.readOnly : false}
trashcan={this.props.trashcan !== undefined ? this.props.trashcan : true}
renderer='zelos'
renderer='geras'
zoom={{ // https://developers.google.com/blockly/guides/configure/web/zoom
controls: this.props.zoomControls !== undefined ? this.props.zoomControls : true,
wheel: false,
startScale: 0.8,
startScale: 1.0,
maxScale: 3,
minScale: 0.3,
scaleSpeed: 1.2
@@ -63,14 +63,14 @@ class BlocklyWindow extends Component {
length: 1,
colour: '#4EAF47', // senseBox-green
snap: false
}}
}}
media={'/media/'}
move={this.props.move !== undefined && !this.props.move ? {} :
{ // https://developers.google.com/blockly/guides/configure/web/move
scrollbars: true,
drag: true,
wheel: false
}}
}}
initialXml={this.props.initialXml ? this.props.initialXml : initialXml}
>
+4 -2
View File
@@ -14,9 +14,9 @@ Blockly['Arduino']['controls_repeat_ext'] = function (Block) {
let branch = Blockly['Arduino'].statementToCode(Block, 'DO');
branch = Blockly['Arduino'].addLoopTrap(branch, Block.id);
let code = '';
const loopVar = 'simple_loop_variable';
const loopVar = 'i';
code +=
'for (' +
'for (int ' +
loopVar +
' = 1; ' +
loopVar +
@@ -36,6 +36,8 @@ Blockly['Arduino']['controls_for'] = function (Block) {
Block.getFieldValue('VAR')
).name;
const branch = Blockly['Arduino'].statementToCode(Block, 'DO');
const startNumber =
@@ -19,9 +19,9 @@ Blockly.Arduino['arduino_functions'] = function (block) {
}
var setupBranch = Blockly.Arduino.statementToCode(block, 'SETUP_FUNC');
//var setupCode = Blockly.Arduino.scrub_(block, setupBranch); No comment block
// //var setupCode = Blockly.Arduino.scrub_(block, setupBranch); No comment block
if (setupBranch) {
Blockly.Arduino.setupCode_('userSetupCode', setupBranch, true);
Blockly.Arduino.setupCode_['mainsetup'] = setupBranch;
}
var loopBranch = statementToCodeNoTab(block, 'LOOP_FUNC');
@@ -14,7 +14,7 @@ Blockly.Arduino.sensebox_sd_create_file = function (block) {
var res = filename.slice(0, 4);
Blockly.Arduino.libraries_['library_spi'] = '#include <SPI.h>';
Blockly.Arduino.libraries_['library_sd'] = '#include <SD.h>';
Blockly.Arduino.definitions_['define_' + filename] = 'File dataFile' + res + ';';
Blockly.Arduino.definitions_['define_' + res] = 'File dataFile' + res + ';';
Blockly.Arduino.setupCode_['sensebox_sd'] = 'SD.begin(28);';
Blockly.Arduino.setupCode_['sensebox_sd' + filename] = 'dataFile' + res + ' = SD.open("' + filename + '", FILE_WRITE);\ndataFile' + res + '.close();\n';
var code = '';
@@ -13,7 +13,7 @@ Blockly.Arduino.sensebox_telegram = function (Block) {
UniversalTelegramBot bot(BOTtoken, client);`
let code = 'testcode';
let code = '';
return code;
};
+2 -3
View File
@@ -9,7 +9,6 @@ class Toolbox extends React.Component {
render() {
return (
<xml xmlns="https://developers.google.com/blockly/xml" id="blockly" style={{ display: 'none' }} ref={this.props.toolbox}>
<Category name="senseBox" colour={getColour().sensebox}>
<Category name="Sensoren" colour={getColour().sensebox}>
<Block type="sensebox_sensor_temp_hum" />
<Block type="sensebox_sensor_uv_light" />
@@ -149,8 +148,9 @@ class Toolbox extends React.Component {
<Block type="sensebox_telegram_do_on_message" />
<Block type="sensebox_telegram_send" />
</Category>
<Category name="osem" colour={getColour().sensebox}>
<Category name="openSenseMap" colour={getColour().sensebox}>
<Block type="sensebox_osem_connection" />
<Block type="sensebox_send_to_osem" />
</Category>
<Category id="catSenseBoxOutput_LoRa" name=" LoRa" colour={getColour().sensebox}>
<Category id="catSenseBoxOutput_LoRa_activation" name=" Activation" colour={getColour().sensebox}>
@@ -172,7 +172,6 @@ class Toolbox extends React.Component {
<Block type="sensebox_lora_cayenne_gps" />
</Category>
</Category>
</Category>
<Category name="Logic" colour={getColour().logic}>
<Block type="controls_if" />
<Block type="controls_ifelse" />