Merge branch 'development' into feat/senseBoxConnect
This commit is contained in:
commit
d167d883b1
26
CITATION.cff
Normal file
26
CITATION.cff
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
# This CITATION.cff file was generated with cffinit.
|
||||||
|
# Visit https://bit.ly/cffinit to generate yours today!
|
||||||
|
|
||||||
|
cff-version: 1.2.0
|
||||||
|
title: senseBox Learn- and Programming Environment
|
||||||
|
message: Please cite this software using these metadata.
|
||||||
|
type: software
|
||||||
|
version: 1.0.0
|
||||||
|
date-released: 2021-09-30
|
||||||
|
url: "https://github.com/sensebox/React-Ardublockly"
|
||||||
|
authors:
|
||||||
|
- given-names: Mario
|
||||||
|
family-names: Pesch
|
||||||
|
email: mario.pesch@uni-muenster.de
|
||||||
|
affiliation: >-
|
||||||
|
Institute for geoinformatics University of
|
||||||
|
Muenster
|
||||||
|
- given-names: Luc
|
||||||
|
family-names: Niski
|
||||||
|
affiliation: >-
|
||||||
|
Institute for geoinformatics University of
|
||||||
|
Muenster
|
||||||
|
- given-names: Felix
|
||||||
|
family-names: Erdmann
|
||||||
|
email: f.erdmann@reedu.de
|
||||||
|
affiliation: Reedu GmbH & Co. KG
|
18
package-lock.json
generated
18
package-lock.json
generated
@ -22,7 +22,7 @@
|
|||||||
"@testing-library/jest-dom": "^4.2.4",
|
"@testing-library/jest-dom": "^4.2.4",
|
||||||
"@testing-library/react": "^9.5.0",
|
"@testing-library/react": "^9.5.0",
|
||||||
"@testing-library/user-event": "^7.2.1",
|
"@testing-library/user-event": "^7.2.1",
|
||||||
"axios": "^0.21.2",
|
"axios": "^0.22.0",
|
||||||
"blockly": "^6.20210701.0",
|
"blockly": "^6.20210701.0",
|
||||||
"file-saver": "^2.0.2",
|
"file-saver": "^2.0.2",
|
||||||
"mnemonic-id": "^3.2.7",
|
"mnemonic-id": "^3.2.7",
|
||||||
@ -5152,11 +5152,11 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/axios": {
|
"node_modules/axios": {
|
||||||
"version": "0.21.2",
|
"version": "0.22.0",
|
||||||
"resolved": "https://registry.npmjs.org/axios/-/axios-0.21.2.tgz",
|
"resolved": "https://registry.npmjs.org/axios/-/axios-0.22.0.tgz",
|
||||||
"integrity": "sha512-87otirqUw3e8CzHTMO+/9kh/FSgXt/eVDvipijwDtEuwbkySWZ9SBm6VEubmJ/kLKEoLQV/POhxXFb66bfekfg==",
|
"integrity": "sha512-Z0U3uhqQeg1oNcihswf4ZD57O3NrR1+ZXhxaROaWpDmsDTx7T2HNBV2ulBtie2hwJptu8UvgnJoK+BIqdzh/1w==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"follow-redirects": "^1.14.0"
|
"follow-redirects": "^1.14.4"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/axobject-query": {
|
"node_modules/axobject-query": {
|
||||||
@ -29080,11 +29080,11 @@
|
|||||||
"integrity": "sha512-vwPpH4Aj4122EW38mxO/fxhGKtwWTMLDIJfZ1He0Edbtjcfna/R3YB67yVhezUMzqc3Jr3+Ii50KRntlENL4xQ=="
|
"integrity": "sha512-vwPpH4Aj4122EW38mxO/fxhGKtwWTMLDIJfZ1He0Edbtjcfna/R3YB67yVhezUMzqc3Jr3+Ii50KRntlENL4xQ=="
|
||||||
},
|
},
|
||||||
"axios": {
|
"axios": {
|
||||||
"version": "0.21.2",
|
"version": "0.22.0",
|
||||||
"resolved": "https://registry.npmjs.org/axios/-/axios-0.21.2.tgz",
|
"resolved": "https://registry.npmjs.org/axios/-/axios-0.22.0.tgz",
|
||||||
"integrity": "sha512-87otirqUw3e8CzHTMO+/9kh/FSgXt/eVDvipijwDtEuwbkySWZ9SBm6VEubmJ/kLKEoLQV/POhxXFb66bfekfg==",
|
"integrity": "sha512-Z0U3uhqQeg1oNcihswf4ZD57O3NrR1+ZXhxaROaWpDmsDTx7T2HNBV2ulBtie2hwJptu8UvgnJoK+BIqdzh/1w==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"follow-redirects": "^1.14.0"
|
"follow-redirects": "^1.14.4"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"axobject-query": {
|
"axobject-query": {
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
"@testing-library/jest-dom": "^4.2.4",
|
"@testing-library/jest-dom": "^4.2.4",
|
||||||
"@testing-library/react": "^9.5.0",
|
"@testing-library/react": "^9.5.0",
|
||||||
"@testing-library/user-event": "^7.2.1",
|
"@testing-library/user-event": "^7.2.1",
|
||||||
"axios": "^0.21.2",
|
"axios": "^0.22.0",
|
||||||
"blockly": "^6.20210701.0",
|
"blockly": "^6.20210701.0",
|
||||||
"file-saver": "^2.0.2",
|
"file-saver": "^2.0.2",
|
||||||
"mnemonic-id": "^3.2.7",
|
"mnemonic-id": "^3.2.7",
|
||||||
|
BIN
public/media/hardware/ble-bee.png
Normal file
BIN
public/media/hardware/ble-bee.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 194 KiB |
@ -11,6 +11,7 @@ import "./blocks/index";
|
|||||||
import "./generator/index";
|
import "./generator/index";
|
||||||
import { ZoomToFitControl } from "@blockly/zoom-to-fit";
|
import { ZoomToFitControl } from "@blockly/zoom-to-fit";
|
||||||
import { initialXml } from "./initialXml.js";
|
import { initialXml } from "./initialXml.js";
|
||||||
|
import { getMaxInstances } from "./helpers/maxInstances";
|
||||||
|
|
||||||
class BlocklyWindow extends Component {
|
class BlocklyWindow extends Component {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
@ -24,6 +25,7 @@ class BlocklyWindow extends Component {
|
|||||||
this.props.clearStats();
|
this.props.clearStats();
|
||||||
workspace.addChangeListener((event) => {
|
workspace.addChangeListener((event) => {
|
||||||
this.props.onChangeWorkspace(event);
|
this.props.onChangeWorkspace(event);
|
||||||
|
|
||||||
// switch on that a block is displayed disabled or not depending on whether it is correctly connected
|
// switch on that a block is displayed disabled or not depending on whether it is correctly connected
|
||||||
// for SVG display, a deactivated block in the display is undesirable
|
// for SVG display, a deactivated block in the display is undesirable
|
||||||
if (this.props.blockDisabled) {
|
if (this.props.blockDisabled) {
|
||||||
@ -37,6 +39,7 @@ class BlocklyWindow extends Component {
|
|||||||
|
|
||||||
componentDidUpdate(props) {
|
componentDidUpdate(props) {
|
||||||
const workspace = Blockly.getMainWorkspace();
|
const workspace = Blockly.getMainWorkspace();
|
||||||
|
|
||||||
var xml = this.props.initialXml;
|
var xml = this.props.initialXml;
|
||||||
// if svg is true, then the update process is done in the BlocklySvg component
|
// if svg is true, then the update process is done in the BlocklySvg component
|
||||||
if (props.initialXml !== xml && !this.props.svg) {
|
if (props.initialXml !== xml && !this.props.svg) {
|
||||||
@ -69,6 +72,7 @@ class BlocklyWindow extends Component {
|
|||||||
this.props.trashcan !== undefined ? this.props.trashcan : true
|
this.props.trashcan !== undefined ? this.props.trashcan : true
|
||||||
}
|
}
|
||||||
renderer={this.props.renderer}
|
renderer={this.props.renderer}
|
||||||
|
maxInstances={getMaxInstances()}
|
||||||
zoom={{
|
zoom={{
|
||||||
// https://developers.google.com/blockly/guides/configure/web/zoom
|
// https://developers.google.com/blockly/guides/configure/web/zoom
|
||||||
controls:
|
controls:
|
||||||
|
@ -1,11 +1,9 @@
|
|||||||
import Blockly from 'blockly/core';
|
import Blockly from "blockly/core";
|
||||||
import { getColour } from '../helpers/colour';
|
import { getColour } from "../helpers/colour";
|
||||||
import * as Types from '../helpers/types';
|
import * as Types from "../helpers/types";
|
||||||
import { getCompatibleTypes } from '../helpers/types';
|
import { getCompatibleTypes } from "../helpers/types";
|
||||||
|
|
||||||
|
Blockly.Blocks["controls_if"] = {
|
||||||
|
|
||||||
Blockly.Blocks['controls_if'] = {
|
|
||||||
/**
|
/**
|
||||||
* Block for if/elseif/else condition.
|
* Block for if/elseif/else condition.
|
||||||
* @this Blockly.Block
|
* @this Blockly.Block
|
||||||
@ -13,29 +11,18 @@ Blockly.Blocks['controls_if'] = {
|
|||||||
init: function () {
|
init: function () {
|
||||||
this.setHelpUrl(Blockly.Msg.CONTROLS_IF_HELPURL);
|
this.setHelpUrl(Blockly.Msg.CONTROLS_IF_HELPURL);
|
||||||
this.setColour(getColour().logic);
|
this.setColour(getColour().logic);
|
||||||
this.appendValueInput('IF0')
|
this.appendValueInput("IF0")
|
||||||
.setCheck(Types.getCompatibleTypes('boolean'))
|
.setCheck(Types.getCompatibleTypes("boolean"))
|
||||||
.appendField(Blockly.Msg.CONTROLS_IF_MSG_IF);
|
.appendField(Blockly.Msg.CONTROLS_IF_MSG_IF);
|
||||||
this.appendStatementInput('DO0')
|
this.appendStatementInput("DO0").appendField(
|
||||||
.appendField(Blockly.Msg.CONTROLS_IF_MSG_THEN);
|
Blockly.Msg.CONTROLS_IF_MSG_THEN
|
||||||
|
);
|
||||||
this.setPreviousStatement(true);
|
this.setPreviousStatement(true);
|
||||||
this.setNextStatement(true);
|
this.setNextStatement(true);
|
||||||
this.setMutator(new Blockly.Mutator(['controls_if_elseif',
|
this.setMutator(
|
||||||
'controls_if_else']));
|
new Blockly.Mutator(["controls_if_elseif", "controls_if_else"])
|
||||||
// Assign 'this' to a variable for use in the tooltip closure below.
|
);
|
||||||
var thisBlock = this;
|
this.setTooltip(Blockly.Msg.CONTROLS_IF_TOOLTIP_1);
|
||||||
this.setTooltip(function () {
|
|
||||||
if (!thisBlock.elseifCount_ && !thisBlock.elseCount_) {
|
|
||||||
return Blockly.Msg.CONTROLS_IF_TOOLTIP_1;
|
|
||||||
} else if (!thisBlock.elseifCount_ && thisBlock.elseCount_) {
|
|
||||||
return Blockly.Msg.CONTROLS_IF_TOOLTIP_2;
|
|
||||||
} else if (thisBlock.elseifCount_ && !thisBlock.elseCount_) {
|
|
||||||
return Blockly.Msg.CONTROLS_IF_TOOLTIP_3;
|
|
||||||
} else if (thisBlock.elseifCount_ && thisBlock.elseCount_) {
|
|
||||||
return Blockly.Msg.CONTROLS_IF_TOOLTIP_4;
|
|
||||||
}
|
|
||||||
return '';
|
|
||||||
});
|
|
||||||
this.elseifCount_ = 0;
|
this.elseifCount_ = 0;
|
||||||
this.elseCount_ = 0;
|
this.elseCount_ = 0;
|
||||||
},
|
},
|
||||||
@ -48,12 +35,12 @@ Blockly.Blocks['controls_if'] = {
|
|||||||
if (!this.elseifCount_ && !this.elseCount_) {
|
if (!this.elseifCount_ && !this.elseCount_) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
var container = document.createElement('mutation');
|
var container = document.createElement("mutation");
|
||||||
if (this.elseifCount_) {
|
if (this.elseifCount_) {
|
||||||
container.setAttribute('elseif', this.elseifCount_);
|
container.setAttribute("elseif", this.elseifCount_);
|
||||||
}
|
}
|
||||||
if (this.elseCount_) {
|
if (this.elseCount_) {
|
||||||
container.setAttribute('else', 1);
|
container.setAttribute("else", 1);
|
||||||
}
|
}
|
||||||
return container;
|
return container;
|
||||||
},
|
},
|
||||||
@ -63,8 +50,8 @@ Blockly.Blocks['controls_if'] = {
|
|||||||
* @this Blockly.Block
|
* @this Blockly.Block
|
||||||
*/
|
*/
|
||||||
domToMutation: function (xmlElement) {
|
domToMutation: function (xmlElement) {
|
||||||
this.elseifCount_ = parseInt(xmlElement.getAttribute('elseif'), 10) || 0;
|
this.elseifCount_ = parseInt(xmlElement.getAttribute("elseif"), 10) || 0;
|
||||||
this.elseCount_ = parseInt(xmlElement.getAttribute('else'), 10) || 0;
|
this.elseCount_ = parseInt(xmlElement.getAttribute("else"), 10) || 0;
|
||||||
this.updateShape_();
|
this.updateShape_();
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
@ -74,17 +61,17 @@ Blockly.Blocks['controls_if'] = {
|
|||||||
* @this Blockly.Block
|
* @this Blockly.Block
|
||||||
*/
|
*/
|
||||||
decompose: function (workspace) {
|
decompose: function (workspace) {
|
||||||
var containerBlock = workspace.newBlock('controls_if_if');
|
var containerBlock = workspace.newBlock("controls_if_if");
|
||||||
containerBlock.initSvg();
|
containerBlock.initSvg();
|
||||||
var connection = containerBlock.nextConnection;
|
var connection = containerBlock.nextConnection;
|
||||||
for (var i = 1; i <= this.elseifCount_; i++) {
|
for (var i = 1; i <= this.elseifCount_; i++) {
|
||||||
var elseifBlock = workspace.newBlock('controls_if_elseif');
|
var elseifBlock = workspace.newBlock("controls_if_elseif");
|
||||||
elseifBlock.initSvg();
|
elseifBlock.initSvg();
|
||||||
connection.connect(elseifBlock.previousConnection);
|
connection.connect(elseifBlock.previousConnection);
|
||||||
connection = elseifBlock.nextConnection;
|
connection = elseifBlock.nextConnection;
|
||||||
}
|
}
|
||||||
if (this.elseCount_) {
|
if (this.elseCount_) {
|
||||||
var elseBlock = workspace.newBlock('controls_if_else');
|
var elseBlock = workspace.newBlock("controls_if_else");
|
||||||
elseBlock.initSvg();
|
elseBlock.initSvg();
|
||||||
connection.connect(elseBlock.previousConnection);
|
connection.connect(elseBlock.previousConnection);
|
||||||
}
|
}
|
||||||
@ -105,28 +92,28 @@ Blockly.Blocks['controls_if'] = {
|
|||||||
var elseStatementConnection = null;
|
var elseStatementConnection = null;
|
||||||
while (clauseBlock) {
|
while (clauseBlock) {
|
||||||
switch (clauseBlock.type) {
|
switch (clauseBlock.type) {
|
||||||
case 'controls_if_elseif':
|
case "controls_if_elseif":
|
||||||
this.elseifCount_++;
|
this.elseifCount_++;
|
||||||
valueConnections.push(clauseBlock.valueConnection_);
|
valueConnections.push(clauseBlock.valueConnection_);
|
||||||
statementConnections.push(clauseBlock.statementConnection_);
|
statementConnections.push(clauseBlock.statementConnection_);
|
||||||
break;
|
break;
|
||||||
case 'controls_if_else':
|
case "controls_if_else":
|
||||||
this.elseCount_++;
|
this.elseCount_++;
|
||||||
elseStatementConnection = clauseBlock.statementConnection_;
|
elseStatementConnection = clauseBlock.statementConnection_;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new Error('Unknown block type.');
|
throw new Error("Unknown block type.");
|
||||||
}
|
}
|
||||||
clauseBlock = clauseBlock.nextConnection &&
|
clauseBlock =
|
||||||
clauseBlock.nextConnection.targetBlock();
|
clauseBlock.nextConnection && clauseBlock.nextConnection.targetBlock();
|
||||||
}
|
}
|
||||||
this.updateShape_();
|
this.updateShape_();
|
||||||
// Reconnect any child blocks.
|
// Reconnect any child blocks.
|
||||||
for (var i = 1; i <= this.elseifCount_; i++) {
|
for (var i = 1; i <= this.elseifCount_; i++) {
|
||||||
Blockly.Mutator.reconnect(valueConnections[i], this, 'IF' + i);
|
Blockly.Mutator.reconnect(valueConnections[i], this, "IF" + i);
|
||||||
Blockly.Mutator.reconnect(statementConnections[i], this, 'DO' + i);
|
Blockly.Mutator.reconnect(statementConnections[i], this, "DO" + i);
|
||||||
}
|
}
|
||||||
Blockly.Mutator.reconnect(elseStatementConnection, this, 'ELSE');
|
Blockly.Mutator.reconnect(elseStatementConnection, this, "ELSE");
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* Store pointers to any connected child blocks.
|
* Store pointers to any connected child blocks.
|
||||||
@ -139,25 +126,25 @@ Blockly.Blocks['controls_if'] = {
|
|||||||
var inputDo;
|
var inputDo;
|
||||||
while (clauseBlock) {
|
while (clauseBlock) {
|
||||||
switch (clauseBlock.type) {
|
switch (clauseBlock.type) {
|
||||||
case 'controls_if_elseif':
|
case "controls_if_elseif":
|
||||||
var inputIf = this.getInput('IF' + i);
|
var inputIf = this.getInput("IF" + i);
|
||||||
inputDo = this.getInput('DO' + i);
|
inputDo = this.getInput("DO" + i);
|
||||||
clauseBlock.valueConnection_ =
|
clauseBlock.valueConnection_ =
|
||||||
inputIf && inputIf.connection.targetConnection;
|
inputIf && inputIf.connection.targetConnection;
|
||||||
clauseBlock.statementConnection_ =
|
clauseBlock.statementConnection_ =
|
||||||
inputDo && inputDo.connection.targetConnection;
|
inputDo && inputDo.connection.targetConnection;
|
||||||
i++;
|
i++;
|
||||||
break;
|
break;
|
||||||
case 'controls_if_else':
|
case "controls_if_else":
|
||||||
inputDo = this.getInput('ELSE');
|
inputDo = this.getInput("ELSE");
|
||||||
clauseBlock.statementConnection_ =
|
clauseBlock.statementConnection_ =
|
||||||
inputDo && inputDo.connection.targetConnection;
|
inputDo && inputDo.connection.targetConnection;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new Error('Unknown block type.');
|
throw new Error("Unknown block type.");
|
||||||
}
|
}
|
||||||
clauseBlock = clauseBlock.nextConnection &&
|
clauseBlock =
|
||||||
clauseBlock.nextConnection.targetBlock();
|
clauseBlock.nextConnection && clauseBlock.nextConnection.targetBlock();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
@ -167,290 +154,296 @@ Blockly.Blocks['controls_if'] = {
|
|||||||
*/
|
*/
|
||||||
updateShape_: function () {
|
updateShape_: function () {
|
||||||
// Delete everything.
|
// Delete everything.
|
||||||
if (this.getInput('ELSE')) {
|
if (this.getInput("ELSE")) {
|
||||||
this.removeInput('ELSE');
|
this.removeInput("ELSE");
|
||||||
}
|
}
|
||||||
var j = 1;
|
var j = 1;
|
||||||
while (this.getInput('IF' + j)) {
|
while (this.getInput("IF" + j)) {
|
||||||
this.removeInput('IF' + j);
|
this.removeInput("IF" + j);
|
||||||
this.removeInput('DO' + j);
|
this.removeInput("DO" + j);
|
||||||
j++;
|
j++;
|
||||||
}
|
}
|
||||||
// Rebuild block.
|
// Rebuild block.
|
||||||
for (var i = 1; i <= this.elseifCount_; i++) {
|
for (var i = 1; i <= this.elseifCount_; i++) {
|
||||||
this.appendValueInput('IF' + i)
|
this.appendValueInput("IF" + i)
|
||||||
.setCheck(Types.getCompatibleTypes('boolean'))
|
.setCheck(Types.getCompatibleTypes("boolean"))
|
||||||
.appendField(Blockly.Msg.CONTROLS_IF_MSG_ELSEIF);
|
.appendField(Blockly.Msg.CONTROLS_IF_MSG_ELSEIF);
|
||||||
this.appendStatementInput('DO' + i)
|
this.appendStatementInput("DO" + i).appendField(
|
||||||
.appendField(Blockly.Msg.CONTROLS_IF_MSG_THEN);
|
Blockly.Msg.CONTROLS_IF_MSG_THEN
|
||||||
|
);
|
||||||
}
|
}
|
||||||
if (this.elseCount_) {
|
if (this.elseCount_) {
|
||||||
this.appendStatementInput('ELSE')
|
this.appendStatementInput("ELSE").appendField(
|
||||||
.appendField(Blockly.Msg.CONTROLS_IF_MSG_ELSE);
|
Blockly.Msg.CONTROLS_IF_MSG_ELSE
|
||||||
}
|
);
|
||||||
}
|
}
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
Blockly.Blocks['controls_if_if'] = {
|
Blockly.Blocks["controls_if_if"] = {
|
||||||
/**
|
/**
|
||||||
* Mutator block for if container.
|
* Mutator block for if container.
|
||||||
* @this Blockly.Block
|
* @this Blockly.Block
|
||||||
*/
|
*/
|
||||||
init: function () {
|
init: function () {
|
||||||
this.setColour(getColour().logic);
|
this.setColour(getColour().logic);
|
||||||
this.appendDummyInput()
|
this.appendDummyInput().appendField(Blockly.Msg.CONTROLS_IF_IF_TITLE_IF);
|
||||||
.appendField(Blockly.Msg.CONTROLS_IF_IF_TITLE_IF);
|
|
||||||
this.setNextStatement(true);
|
this.setNextStatement(true);
|
||||||
this.setTooltip(Blockly.Msg.CONTROLS_IF_IF_TOOLTIP);
|
this.setTooltip(Blockly.Msg.CONTROLS_IF_IF_TOOLTIP);
|
||||||
this.contextMenu = false;
|
this.contextMenu = false;
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
Blockly.Blocks['controls_if_elseif'] = {
|
Blockly.Blocks["controls_if_elseif"] = {
|
||||||
/**
|
/**
|
||||||
* Mutator bolck for else-if condition.
|
* Mutator bolck for else-if condition.
|
||||||
* @this Blockly.Block
|
* @this Blockly.Block
|
||||||
*/
|
*/
|
||||||
init: function () {
|
init: function () {
|
||||||
this.setColour(getColour().logic);
|
this.setColour(getColour().logic);
|
||||||
this.appendDummyInput()
|
this.appendDummyInput().appendField(
|
||||||
.appendField(Blockly.Msg.CONTROLS_IF_ELSEIF_TITLE_ELSEIF);
|
Blockly.Msg.CONTROLS_IF_ELSEIF_TITLE_ELSEIF
|
||||||
|
);
|
||||||
this.setPreviousStatement(true);
|
this.setPreviousStatement(true);
|
||||||
this.setNextStatement(true);
|
this.setNextStatement(true);
|
||||||
this.setTooltip(Blockly.Msg.CONTROLS_IF_ELSEIF_TOOLTIP);
|
this.setTooltip(Blockly.Msg.CONTROLS_IF_ELSEIF_TOOLTIP);
|
||||||
this.contextMenu = false;
|
this.contextMenu = false;
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
Blockly.Blocks['controls_if_else'] = {
|
Blockly.Blocks["controls_if_else"] = {
|
||||||
/**
|
/**
|
||||||
* Mutator block for else condition.
|
* Mutator block for else condition.
|
||||||
* @this Blockly.Block
|
* @this Blockly.Block
|
||||||
*/
|
*/
|
||||||
init: function () {
|
init: function () {
|
||||||
this.setColour(getColour().logic);
|
this.setColour(getColour().logic);
|
||||||
this.appendDummyInput()
|
this.appendDummyInput().appendField(
|
||||||
.appendField(Blockly.Msg.CONTROLS_IF_ELSE_TITLE_ELSE);
|
Blockly.Msg.CONTROLS_IF_ELSE_TITLE_ELSE
|
||||||
|
);
|
||||||
this.setPreviousStatement(true);
|
this.setPreviousStatement(true);
|
||||||
this.setTooltip(Blockly.Msg.CONTROLS_IF_ELSE_TOOLTIP);
|
this.setTooltip(Blockly.Msg.CONTROLS_IF_ELSE_TOOLTIP);
|
||||||
this.contextMenu = false;
|
this.contextMenu = false;
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Blockly.defineBlocksWithJsonArray([
|
||||||
Blockly.defineBlocksWithJsonArray([ // BEGIN JSON EXTRACT
|
// BEGIN JSON EXTRACT
|
||||||
// Block for boolean data type: true and false.
|
// Block for boolean data type: true and false.
|
||||||
{
|
{
|
||||||
"type": "logic_boolean",
|
type: "logic_boolean",
|
||||||
"message0": "%1",
|
message0: "%1",
|
||||||
"args0": [
|
args0: [
|
||||||
{
|
{
|
||||||
"type": "field_dropdown",
|
type: "field_dropdown",
|
||||||
"name": "BOOL",
|
name: "BOOL",
|
||||||
"options": [
|
options: [
|
||||||
["%{BKY_LOGIC_BOOLEAN_TRUE}", "TRUE"],
|
["%{BKY_LOGIC_BOOLEAN_TRUE}", "TRUE"],
|
||||||
["%{BKY_LOGIC_BOOLEAN_FALSE}", "FALSE"]
|
["%{BKY_LOGIC_BOOLEAN_FALSE}", "FALSE"],
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
],
|
||||||
"output": Types.BOOLEAN.typeName,
|
},
|
||||||
"style": "logic_blocks",
|
],
|
||||||
"tooltip": "%{BKY_LOGIC_BOOLEAN_TOOLTIP}",
|
output: Types.BOOLEAN.typeName,
|
||||||
"helpUrl": "%{BKY_LOGIC_BOOLEAN_HELPURL}"
|
style: "logic_blocks",
|
||||||
|
tooltip: "%{BKY_LOGIC_BOOLEAN_TOOLTIP}",
|
||||||
|
helpUrl: "%{BKY_LOGIC_BOOLEAN_HELPURL}",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "controls_ifelse",
|
type: "controls_ifelse",
|
||||||
"message0": "%{BKY_CONTROLS_IF_MSG_IF} %1",
|
message0: "%{BKY_CONTROLS_IF_MSG_IF} %1",
|
||||||
"args0": [
|
args0: [
|
||||||
{
|
{
|
||||||
"type": "input_value",
|
type: "input_value",
|
||||||
"name": "IF0",
|
name: "IF0",
|
||||||
"check": Types.getCompatibleTypes('boolean')
|
check: Types.getCompatibleTypes("boolean"),
|
||||||
}
|
},
|
||||||
],
|
],
|
||||||
"message1": "%{BKY_CONTROLS_IF_MSG_THEN} %1",
|
message1: "%{BKY_CONTROLS_IF_MSG_THEN} %1",
|
||||||
"args1": [
|
args1: [
|
||||||
{
|
{
|
||||||
"type": "input_statement",
|
type: "input_statement",
|
||||||
"name": "DO0"
|
name: "DO0",
|
||||||
}
|
},
|
||||||
],
|
],
|
||||||
"message2": "%{BKY_CONTROLS_IF_MSG_ELSE} %1",
|
message2: "%{BKY_CONTROLS_IF_MSG_ELSE} %1",
|
||||||
"args2": [
|
args2: [
|
||||||
{
|
{
|
||||||
"type": "input_statement",
|
type: "input_statement",
|
||||||
"name": "ELSE"
|
name: "ELSE",
|
||||||
}
|
},
|
||||||
],
|
],
|
||||||
"previousStatement": null,
|
previousStatement: null,
|
||||||
"nextStatement": null,
|
nextStatement: null,
|
||||||
"style": "logic_blocks",
|
style: "logic_blocks",
|
||||||
"tooltip": "%{BKYCONTROLS_IF_TOOLTIP_2}",
|
tooltip: "%{BKYCONTROLS_IF_TOOLTIP_2}",
|
||||||
"helpUrl": "%{BKY_CONTROLS_IF_HELPURL}",
|
helpUrl: "%{BKY_CONTROLS_IF_HELPURL}",
|
||||||
"extensions": ["controls_if_tooltip"]
|
extensions: ["controls_if_tooltip"],
|
||||||
},
|
},
|
||||||
// Block for comparison operator.
|
// Block for comparison operator.
|
||||||
{
|
{
|
||||||
"type": "logic_compare",
|
type: "logic_compare",
|
||||||
"message0": "%1 %2 %3",
|
message0: "%1 %2 %3",
|
||||||
"args0": [
|
args0: [
|
||||||
{
|
{
|
||||||
"type": "input_value",
|
type: "input_value",
|
||||||
"name": "A"
|
name: "A",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "field_dropdown",
|
type: "field_dropdown",
|
||||||
"name": "OP",
|
name: "OP",
|
||||||
"options": [
|
options: [
|
||||||
["=", "EQ"],
|
["=", "EQ"],
|
||||||
["\u2260", "NEQ"],
|
["\u2260", "NEQ"],
|
||||||
["\u200F<", "LT"],
|
["\u200F<", "LT"],
|
||||||
["\u200F\u2264", "LTE"],
|
["\u200F\u2264", "LTE"],
|
||||||
["\u200F>", "GT"],
|
["\u200F>", "GT"],
|
||||||
["\u200F\u2265", "GTE"]
|
["\u200F\u2265", "GTE"],
|
||||||
]
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "input_value",
|
type: "input_value",
|
||||||
"name": "B"
|
name: "B",
|
||||||
}
|
},
|
||||||
],
|
],
|
||||||
"inputsInline": true,
|
inputsInline: true,
|
||||||
"output": Types.BOOLEAN.typeName,
|
output: Types.BOOLEAN.typeName,
|
||||||
"style": "logic_blocks",
|
style: "logic_blocks",
|
||||||
"helpUrl": "%{BKY_LOGIC_COMPARE_HELPURL}",
|
helpUrl: "%{BKY_LOGIC_COMPARE_HELPURL}",
|
||||||
"extensions": ["logic_compare", "logic_op_tooltip"]
|
extensions: ["logic_compare", "logic_op_tooltip"],
|
||||||
},
|
},
|
||||||
// Block for logical operations: 'and', 'or'.
|
// Block for logical operations: 'and', 'or'.
|
||||||
{
|
{
|
||||||
"type": "logic_operation",
|
type: "logic_operation",
|
||||||
"message0": "%1 %2 %3",
|
message0: "%1 %2 %3",
|
||||||
"args0": [
|
args0: [
|
||||||
{
|
{
|
||||||
"type": "input_value",
|
type: "input_value",
|
||||||
"name": "A",
|
name: "A",
|
||||||
"check": Types.getCompatibleTypes('boolean')
|
check: Types.getCompatibleTypes("boolean"),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "field_dropdown",
|
type: "field_dropdown",
|
||||||
"name": "OP",
|
name: "OP",
|
||||||
"options": [
|
options: [
|
||||||
["%{BKY_LOGIC_OPERATION_AND}", "AND"],
|
["%{BKY_LOGIC_OPERATION_AND}", "AND"],
|
||||||
["%{BKY_LOGIC_OPERATION_OR}", "OR"]
|
["%{BKY_LOGIC_OPERATION_OR}", "OR"],
|
||||||
]
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "input_value",
|
type: "input_value",
|
||||||
"name": "B",
|
name: "B",
|
||||||
"check": Types.getCompatibleTypes('boolean')
|
check: Types.getCompatibleTypes("boolean"),
|
||||||
}
|
},
|
||||||
],
|
],
|
||||||
"inputsInline": true,
|
inputsInline: true,
|
||||||
"output": Types.BOOLEAN.typeName,
|
output: Types.BOOLEAN.typeName,
|
||||||
"style": "logic_blocks",
|
style: "logic_blocks",
|
||||||
"helpUrl": "%{BKY_LOGIC_OPERATION_HELPURL}",
|
helpUrl: "%{BKY_LOGIC_OPERATION_HELPURL}",
|
||||||
"extensions": ["logic_op_tooltip"]
|
extensions: ["logic_op_tooltip"],
|
||||||
},
|
},
|
||||||
// Block for negation.
|
// Block for negation.
|
||||||
{
|
{
|
||||||
"type": "logic_negate",
|
type: "logic_negate",
|
||||||
"message0": "%{BKY_LOGIC_NEGATE_TITLE}",
|
message0: "%{BKY_LOGIC_NEGATE_TITLE}",
|
||||||
"args0": [
|
args0: [
|
||||||
{
|
{
|
||||||
"type": "input_value",
|
type: "input_value",
|
||||||
"name": "BOOL",
|
name: "BOOL",
|
||||||
"check": Types.getCompatibleTypes('boolean'),
|
check: Types.getCompatibleTypes("boolean"),
|
||||||
}
|
},
|
||||||
],
|
],
|
||||||
"output": Types.BOOLEAN.typeName,
|
output: Types.BOOLEAN.typeName,
|
||||||
"style": "logic_blocks",
|
style: "logic_blocks",
|
||||||
"tooltip": "%{BKY_LOGIC_NEGATE_TOOLTIP}",
|
tooltip: "%{BKY_LOGIC_NEGATE_TOOLTIP}",
|
||||||
"helpUrl": "%{BKY_LOGIC_NEGATE_HELPURL}"
|
helpUrl: "%{BKY_LOGIC_NEGATE_HELPURL}",
|
||||||
},
|
},
|
||||||
// Block for null data type.
|
// Block for null data type.
|
||||||
{
|
{
|
||||||
"type": "logic_null",
|
type: "logic_null",
|
||||||
"message0": "%{BKY_LOGIC_NULL}",
|
message0: "%{BKY_LOGIC_NULL}",
|
||||||
"output": null,
|
output: null,
|
||||||
"style": "logic_blocks",
|
style: "logic_blocks",
|
||||||
"tooltip": "%{BKY_LOGIC_NULL_TOOLTIP}",
|
tooltip: "%{BKY_LOGIC_NULL_TOOLTIP}",
|
||||||
"helpUrl": "%{BKY_LOGIC_NULL_HELPURL}"
|
helpUrl: "%{BKY_LOGIC_NULL_HELPURL}",
|
||||||
},
|
},
|
||||||
// Block for ternary operator.
|
// Block for ternary operator.
|
||||||
{
|
{
|
||||||
"type": "logic_ternary",
|
type: "logic_ternary",
|
||||||
"message0": "%{BKY_LOGIC_TERNARY_CONDITION} %1",
|
message0: "%{BKY_LOGIC_TERNARY_CONDITION} %1",
|
||||||
"args0": [
|
args0: [
|
||||||
{
|
{
|
||||||
"type": "input_value",
|
type: "input_value",
|
||||||
"name": "IF",
|
name: "IF",
|
||||||
"check": Types.getCompatibleTypes('boolean'),
|
check: Types.getCompatibleTypes("boolean"),
|
||||||
}
|
},
|
||||||
],
|
],
|
||||||
"message1": "%{BKY_LOGIC_TERNARY_IF_TRUE} %1",
|
message1: "%{BKY_LOGIC_TERNARY_IF_TRUE} %1",
|
||||||
"args1": [
|
args1: [
|
||||||
{
|
{
|
||||||
"type": "input_value",
|
type: "input_value",
|
||||||
"name": "THEN",
|
name: "THEN",
|
||||||
"check": Types.getCompatibleTypes('boolean'),
|
check: Types.getCompatibleTypes("boolean"),
|
||||||
}
|
},
|
||||||
],
|
],
|
||||||
"message2": "%{BKY_LOGIC_TERNARY_IF_FALSE} %1",
|
message2: "%{BKY_LOGIC_TERNARY_IF_FALSE} %1",
|
||||||
"args2": [
|
args2: [
|
||||||
{
|
{
|
||||||
"type": "input_value",
|
type: "input_value",
|
||||||
"name": "ELSE",
|
name: "ELSE",
|
||||||
"check": Types.getCompatibleTypes('boolean'),
|
check: Types.getCompatibleTypes("boolean"),
|
||||||
}
|
},
|
||||||
],
|
],
|
||||||
"output": null,
|
output: null,
|
||||||
"style": "logic_blocks",
|
style: "logic_blocks",
|
||||||
"tooltip": "%{BKY_LOGIC_TERNARY_TOOLTIP}",
|
tooltip: "%{BKY_LOGIC_TERNARY_TOOLTIP}",
|
||||||
"helpUrl": "%{BKY_LOGIC_TERNARY_HELPURL}",
|
helpUrl: "%{BKY_LOGIC_TERNARY_HELPURL}",
|
||||||
"extensions": ["logic_ternary"]
|
extensions: ["logic_ternary"],
|
||||||
}
|
},
|
||||||
]); // END JSON EXTRACT (Do not delete this comment.)
|
]); // END JSON EXTRACT (Do not delete this comment.)
|
||||||
|
|
||||||
|
Blockly.Blocks["logic_compare"] = {
|
||||||
Blockly.Blocks['logic_compare'] = {
|
|
||||||
/**
|
/**
|
||||||
* Block for comparison operator.
|
* Block for comparison operator.
|
||||||
* @this Blockly.Block
|
* @this Blockly.Block
|
||||||
*/
|
*/
|
||||||
init: function () {
|
init: function () {
|
||||||
var OPERATORS = this.RTL ? [
|
var OPERATORS = this.RTL
|
||||||
['=', 'EQ'],
|
? [
|
||||||
['\u2260', 'NEQ'],
|
["=", "EQ"],
|
||||||
['>', 'LT'],
|
["\u2260", "NEQ"],
|
||||||
['\u2265', 'LTE'],
|
[">", "LT"],
|
||||||
['<', 'GT'],
|
["\u2265", "LTE"],
|
||||||
['\u2264', 'GTE']
|
["<", "GT"],
|
||||||
] : [
|
["\u2264", "GTE"],
|
||||||
['=', 'EQ'],
|
]
|
||||||
['\u2260', 'NEQ'],
|
: [
|
||||||
['<', 'LT'],
|
["=", "EQ"],
|
||||||
['\u2264', 'LTE'],
|
["\u2260", "NEQ"],
|
||||||
['>', 'GT'],
|
["<", "LT"],
|
||||||
['\u2265', 'GTE']
|
["\u2264", "LTE"],
|
||||||
|
[">", "GT"],
|
||||||
|
["\u2265", "GTE"],
|
||||||
];
|
];
|
||||||
this.setHelpUrl(Blockly.Msg.LOGIC_COMPARE_HELPURL);
|
this.setHelpUrl(Blockly.Msg.LOGIC_COMPARE_HELPURL);
|
||||||
this.setColour(getColour().logic);
|
this.setColour(getColour().logic);
|
||||||
this.setOutput(true, Types.BOOLEAN.typeName);
|
this.setOutput(true, Types.BOOLEAN.typeName);
|
||||||
this.appendValueInput('A');
|
this.appendValueInput("A");
|
||||||
this.appendValueInput('B')
|
this.appendValueInput("B").appendField(
|
||||||
.appendField(new Blockly.FieldDropdown(OPERATORS), 'OP');
|
new Blockly.FieldDropdown(OPERATORS),
|
||||||
|
"OP"
|
||||||
|
);
|
||||||
this.setInputsInline(true);
|
this.setInputsInline(true);
|
||||||
// Assign 'this' to a variable for use in the tooltip closure below.
|
// Assign 'this' to a variable for use in the tooltip closure below.
|
||||||
var thisBlock = this;
|
var thisBlock = this;
|
||||||
this.setTooltip(function () {
|
this.setTooltip(function () {
|
||||||
var op = thisBlock.getFieldValue('OP');
|
var op = thisBlock.getFieldValue("OP");
|
||||||
var TOOLTIPS = {
|
var TOOLTIPS = {
|
||||||
'EQ': Blockly.Msg.LOGIC_COMPARE_TOOLTIP_EQ,
|
EQ: Blockly.Msg.LOGIC_COMPARE_TOOLTIP_EQ,
|
||||||
'NEQ': Blockly.Msg.LOGIC_COMPARE_TOOLTIP_NEQ,
|
NEQ: Blockly.Msg.LOGIC_COMPARE_TOOLTIP_NEQ,
|
||||||
'LT': Blockly.Msg.LOGIC_COMPARE_TOOLTIP_LT,
|
LT: Blockly.Msg.LOGIC_COMPARE_TOOLTIP_LT,
|
||||||
'LTE': Blockly.Msg.LOGIC_COMPARE_TOOLTIP_LTE,
|
LTE: Blockly.Msg.LOGIC_COMPARE_TOOLTIP_LTE,
|
||||||
'GT': Blockly.Msg.LOGIC_COMPARE_TOOLTIP_GT,
|
GT: Blockly.Msg.LOGIC_COMPARE_TOOLTIP_GT,
|
||||||
'GTE': Blockly.Msg.LOGIC_COMPARE_TOOLTIP_GTE
|
GTE: Blockly.Msg.LOGIC_COMPARE_TOOLTIP_GTE,
|
||||||
};
|
};
|
||||||
return TOOLTIPS[op];
|
return TOOLTIPS[op];
|
||||||
});
|
});
|
||||||
@ -462,37 +455,43 @@ Blockly.Blocks['logic_compare'] = {
|
|||||||
* @this Blockly.Block
|
* @this Blockly.Block
|
||||||
*/
|
*/
|
||||||
onchange: function (e) {
|
onchange: function (e) {
|
||||||
var blockA = this.getInputTargetBlock('A');
|
var blockA = this.getInputTargetBlock("A");
|
||||||
var blockB = this.getInputTargetBlock('B');
|
var blockB = this.getInputTargetBlock("B");
|
||||||
if (blockA === null && blockB === null) {
|
if (blockA === null && blockB === null) {
|
||||||
this.getInput('A').setCheck(null);
|
this.getInput("A").setCheck(null);
|
||||||
this.getInput('B').setCheck(null);
|
this.getInput("B").setCheck(null);
|
||||||
}
|
}
|
||||||
if (blockA !== null && blockB === null) {
|
if (blockA !== null && blockB === null) {
|
||||||
this.getInput('A').setCheck(getCompatibleTypes(blockA.outputConnection.check_[0]));
|
this.getInput("A").setCheck(
|
||||||
this.getInput('B').setCheck(getCompatibleTypes(blockA.outputConnection.check_[0]));
|
getCompatibleTypes(blockA.outputConnection.check_[0])
|
||||||
|
);
|
||||||
|
this.getInput("B").setCheck(
|
||||||
|
getCompatibleTypes(blockA.outputConnection.check_[0])
|
||||||
|
);
|
||||||
}
|
}
|
||||||
if (blockB !== null && blockA === null) {
|
if (blockB !== null && blockA === null) {
|
||||||
this.getInput('B').setCheck(getCompatibleTypes(blockB.outputConnection.check_[0]));
|
this.getInput("B").setCheck(
|
||||||
this.getInput('A').setCheck(getCompatibleTypes(blockB.outputConnection.check_[0]));
|
getCompatibleTypes(blockB.outputConnection.check_[0])
|
||||||
}
|
);
|
||||||
|
this.getInput("A").setCheck(
|
||||||
|
getCompatibleTypes(blockB.outputConnection.check_[0])
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Blockly.Blocks["switch_case"] = {
|
||||||
Blockly.Blocks['switch_case'] = {
|
|
||||||
init: function () {
|
init: function () {
|
||||||
this.setColour(getColour().logic);
|
this.setColour(getColour().logic);
|
||||||
this.setPreviousStatement(true);
|
this.setPreviousStatement(true);
|
||||||
this.setTooltip(Blockly.Msg.cases_tooltip);
|
this.setTooltip(Blockly.Msg.cases_tooltip);
|
||||||
this.setNextStatement(true);
|
this.setNextStatement(true);
|
||||||
this.appendValueInput('CONDITION')
|
this.appendValueInput("CONDITION").appendField(Blockly.Msg.cases_switch);
|
||||||
.appendField(Blockly.Msg.cases_switch);
|
this.appendValueInput("CASECONDITION0").appendField(
|
||||||
this.appendValueInput('CASECONDITION0')
|
Blockly.Msg.cases_condition
|
||||||
.appendField(Blockly.Msg.cases_condition);
|
);
|
||||||
this.appendStatementInput('CASE0')
|
this.appendStatementInput("CASE0").appendField(Blockly.Msg.cases_do);
|
||||||
.appendField(Blockly.Msg.cases_do);
|
this.setMutator(new Blockly.Mutator(["case_incaseof", "case_default"]));
|
||||||
this.setMutator(new Blockly.Mutator(['case_incaseof', 'case_default']));
|
|
||||||
this.caseCount_ = 0;
|
this.caseCount_ = 0;
|
||||||
this.defaultCount_ = 0;
|
this.defaultCount_ = 0;
|
||||||
},
|
},
|
||||||
@ -501,43 +500,42 @@ Blockly.Blocks['switch_case'] = {
|
|||||||
if (!this.caseCount_ && !this.defaultCount_) {
|
if (!this.caseCount_ && !this.defaultCount_) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
var container = document.createElement('mutation');
|
var container = document.createElement("mutation");
|
||||||
if (this.caseCount_) {
|
if (this.caseCount_) {
|
||||||
container.setAttribute('case', this.caseCount_);
|
container.setAttribute("case", this.caseCount_);
|
||||||
}
|
}
|
||||||
if (this.defaultCount_) {
|
if (this.defaultCount_) {
|
||||||
container.setAttribute('default', 1);
|
container.setAttribute("default", 1);
|
||||||
}
|
}
|
||||||
return container;
|
return container;
|
||||||
},
|
},
|
||||||
|
|
||||||
domToMutation: function (xmlElement) {
|
domToMutation: function (xmlElement) {
|
||||||
this.caseCount_ = parseInt(xmlElement.getAttribute('case'), 10);
|
this.caseCount_ = parseInt(xmlElement.getAttribute("case"), 10);
|
||||||
this.defaultCount_ = parseInt(xmlElement.getAttribute('default'), 10);
|
this.defaultCount_ = parseInt(xmlElement.getAttribute("default"), 10);
|
||||||
for (var x = 0; x <= this.caseCount_; x++) {
|
for (var x = 0; x <= this.caseCount_; x++) {
|
||||||
this.appendValueInput('CASECONDITION' + x)
|
this.appendValueInput("CASECONDITION" + x).appendField(
|
||||||
.appendField(Blockly.Msg.cases_condition);
|
Blockly.Msg.cases_condition
|
||||||
this.appendStatementInput('CASE' + x)
|
);
|
||||||
.appendField(Blockly.Msg.cases_do);
|
this.appendStatementInput("CASE" + x).appendField(Blockly.Msg.cases_do);
|
||||||
}
|
}
|
||||||
if (this.defaultCount_) {
|
if (this.defaultCount_) {
|
||||||
this.appendStatementInput('ONDEFAULT')
|
this.appendStatementInput("ONDEFAULT").appendField("default");
|
||||||
.appendField('default');
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
decompose: function (workspace) {
|
decompose: function (workspace) {
|
||||||
var containerBlock = workspace.newBlock('control_case');
|
var containerBlock = workspace.newBlock("control_case");
|
||||||
containerBlock.initSvg();
|
containerBlock.initSvg();
|
||||||
var connection = containerBlock.getInput('STACK').connection;
|
var connection = containerBlock.getInput("STACK").connection;
|
||||||
for (var x = 1; x <= this.caseCount_; x++) {
|
for (var x = 1; x <= this.caseCount_; x++) {
|
||||||
var caseBlock = workspace.newBlock('case_incaseof');
|
var caseBlock = workspace.newBlock("case_incaseof");
|
||||||
caseBlock.initSvg();
|
caseBlock.initSvg();
|
||||||
connection.connect(caseBlock.previousConnection);
|
connection.connect(caseBlock.previousConnection);
|
||||||
connection = caseBlock.nextConnection;
|
connection = caseBlock.nextConnection;
|
||||||
}
|
}
|
||||||
if (this.defaultCount_) {
|
if (this.defaultCount_) {
|
||||||
var defaultBlock = Blockly.Block.obtain(workspace, 'case_default');
|
var defaultBlock = Blockly.Block.obtain(workspace, "case_default");
|
||||||
defaultBlock.initSvg();
|
defaultBlock.initSvg();
|
||||||
connection.connect(defaultBlock.previousConnection);
|
connection.connect(defaultBlock.previousConnection);
|
||||||
}
|
}
|
||||||
@ -547,23 +545,25 @@ Blockly.Blocks['switch_case'] = {
|
|||||||
compose: function (containerBlock) {
|
compose: function (containerBlock) {
|
||||||
//Disconnect all input blocks and remove all inputs.
|
//Disconnect all input blocks and remove all inputs.
|
||||||
if (this.defaultCount_) {
|
if (this.defaultCount_) {
|
||||||
this.removeInput('ONDEFAULT');
|
this.removeInput("ONDEFAULT");
|
||||||
}
|
}
|
||||||
this.defaultCount_ = 0;
|
this.defaultCount_ = 0;
|
||||||
for (var x = this.caseCount_; x > 0; x--) {
|
for (var x = this.caseCount_; x > 0; x--) {
|
||||||
this.removeInput('CASECONDITION' + x);
|
this.removeInput("CASECONDITION" + x);
|
||||||
this.removeInput('CASE' + x);
|
this.removeInput("CASE" + x);
|
||||||
}
|
}
|
||||||
this.caseCount_ = 0;
|
this.caseCount_ = 0;
|
||||||
var caseBlock = containerBlock.getInputTargetBlock('STACK');
|
var caseBlock = containerBlock.getInputTargetBlock("STACK");
|
||||||
while (caseBlock) {
|
while (caseBlock) {
|
||||||
switch (caseBlock.type) {
|
switch (caseBlock.type) {
|
||||||
case 'case_incaseof':
|
case "case_incaseof":
|
||||||
this.caseCount_++;
|
this.caseCount_++;
|
||||||
var caseconditionInput = this.appendValueInput('CASECONDITION' + this.caseCount_)
|
var caseconditionInput = this.appendValueInput(
|
||||||
.appendField(Blockly.Msg.cases_condition);
|
"CASECONDITION" + this.caseCount_
|
||||||
var caseInput = this.appendStatementInput('CASE' + this.caseCount_)
|
).appendField(Blockly.Msg.cases_condition);
|
||||||
.appendField(Blockly.Msg.cases_do);
|
var caseInput = this.appendStatementInput(
|
||||||
|
"CASE" + this.caseCount_
|
||||||
|
).appendField(Blockly.Msg.cases_do);
|
||||||
if (caseBlock.valueConnection_) {
|
if (caseBlock.valueConnection_) {
|
||||||
caseconditionInput.connection.connect(caseBlock.valueConnection_);
|
caseconditionInput.connection.connect(caseBlock.valueConnection_);
|
||||||
}
|
}
|
||||||
@ -571,78 +571,81 @@ Blockly.Blocks['switch_case'] = {
|
|||||||
caseInput.connection.connect(caseBlock.statementConnection_);
|
caseInput.connection.connect(caseBlock.statementConnection_);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'case_default':
|
case "case_default":
|
||||||
this.defaultCount_++;
|
this.defaultCount_++;
|
||||||
var defaultInput = this.appendStatementInput('ONDEFAULT')
|
var defaultInput =
|
||||||
.appendField('default');
|
this.appendStatementInput("ONDEFAULT").appendField("default");
|
||||||
if (caseBlock.statementConnection_) {
|
if (caseBlock.statementConnection_) {
|
||||||
defaultInput.connection.connect(caseBlock.statementConnection_);
|
defaultInput.connection.connect(caseBlock.statementConnection_);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new Error('Unknown block type.');
|
throw new Error("Unknown block type.");
|
||||||
}
|
}
|
||||||
caseBlock = caseBlock.nextConnection &&
|
caseBlock =
|
||||||
caseBlock.nextConnection.targetBlock();
|
caseBlock.nextConnection && caseBlock.nextConnection.targetBlock();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
saveConnections: function (containerBlock) {
|
saveConnections: function (containerBlock) {
|
||||||
var caseBlock = containerBlock.getInputTargetBlock('STACK');
|
var caseBlock = containerBlock.getInputTargetBlock("STACK");
|
||||||
var x = 1;
|
var x = 1;
|
||||||
while (caseBlock) {
|
while (caseBlock) {
|
||||||
switch (caseBlock.type) {
|
switch (caseBlock.type) {
|
||||||
case 'case_incaseof':
|
case "case_incaseof":
|
||||||
var caseconditionInput = this.getInput('CASECONDITION' + x);
|
var caseconditionInput = this.getInput("CASECONDITION" + x);
|
||||||
var caseInput = this.getInput('CASE' + x);
|
var caseInput = this.getInput("CASE" + x);
|
||||||
caseBlock.valueConnection_ = caseconditionInput && caseconditionInput.connection.targetConnection;
|
caseBlock.valueConnection_ =
|
||||||
caseBlock.statementConnection_ = caseInput && caseInput.connection.targetConnection;
|
caseconditionInput &&
|
||||||
|
caseconditionInput.connection.targetConnection;
|
||||||
|
caseBlock.statementConnection_ =
|
||||||
|
caseInput && caseInput.connection.targetConnection;
|
||||||
x++;
|
x++;
|
||||||
break;
|
break;
|
||||||
case 'case_default':
|
case "case_default":
|
||||||
var defaultInput = this.getInput('ONDEFAULT');
|
var defaultInput = this.getInput("ONDEFAULT");
|
||||||
caseBlock.satementConnection_ = defaultInput && defaultInput.connection.targetConnection;
|
caseBlock.satementConnection_ =
|
||||||
|
defaultInput && defaultInput.connection.targetConnection;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new Error('Unknown block type');
|
throw new Error("Unknown block type");
|
||||||
}
|
|
||||||
caseBlock = caseBlock.nextConnection &&
|
|
||||||
caseBlock.nextConnection.targetBlock();
|
|
||||||
}
|
}
|
||||||
|
caseBlock =
|
||||||
|
caseBlock.nextConnection && caseBlock.nextConnection.targetBlock();
|
||||||
}
|
}
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
Blockly.Blocks['control_case'] = {
|
Blockly.Blocks["control_case"] = {
|
||||||
init: function () {
|
init: function () {
|
||||||
this.setColour(getColour().logic);
|
this.setColour(getColour().logic);
|
||||||
this.appendDummyInput()
|
this.appendDummyInput().appendField(Blockly.Msg.cases_switch);
|
||||||
.appendField(Blockly.Msg.cases_switch);
|
this.appendStatementInput("STACK");
|
||||||
this.appendStatementInput('STACK');
|
this.setTooltip("--Placeholder--");
|
||||||
this.setTooltip('--Placeholder--');
|
|
||||||
this.contextMenu = false;
|
this.contextMenu = false;
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
Blockly.Blocks['case_incaseof'] = {
|
Blockly.Blocks["case_incaseof"] = {
|
||||||
init: function () {
|
init: function () {
|
||||||
this.setColour(getColour().logic);
|
this.setColour(getColour().logic);
|
||||||
this.appendDummyInput()
|
this.appendDummyInput().appendField(Blockly.Msg.cases_add);
|
||||||
.appendField(Blockly.Msg.cases_add);
|
|
||||||
this.setPreviousStatement(true);
|
this.setPreviousStatement(true);
|
||||||
this.setNextStatement(true);
|
this.setNextStatement(true);
|
||||||
this.setTooltip('--Placeholder--');
|
this.setTooltip("--Placeholder--");
|
||||||
this.contextMenu = false;
|
this.contextMenu = false;
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
Blockly.Blocks['case_default'] = {
|
Blockly.Blocks["case_default"] = {
|
||||||
init: function () {
|
init: function () {
|
||||||
this.setColour(getColour().logic);
|
this.setColour(getColour().logic);
|
||||||
this.appendValueInput('default')
|
this.appendValueInput("default").appendField("default");
|
||||||
.appendField('default');
|
|
||||||
this.setPreviousStatement(true);
|
this.setPreviousStatement(true);
|
||||||
this.setNextStatement(false);
|
this.setNextStatement(false);
|
||||||
this.setTooltip('This function will run if there aren\'t any matching cases.');
|
this.setTooltip(
|
||||||
|
"This function will run if there aren't any matching cases."
|
||||||
|
);
|
||||||
this.contextMenu = false;
|
this.contextMenu = false;
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
|
@ -1,51 +1,59 @@
|
|||||||
import * as Blockly from 'blockly/core';
|
import * as Blockly from "blockly/core";
|
||||||
import { getColour } from '../helpers/colour';
|
import { getColour } from "../helpers/colour";
|
||||||
import * as Types from '../helpers/types'
|
import * as Types from "../helpers/types";
|
||||||
import { FieldSlider } from '@blockly/field-slider';
|
import { FieldSlider } from "@blockly/field-slider";
|
||||||
|
|
||||||
|
Blockly.Blocks["sensebox_display_beginDisplay"] = {
|
||||||
Blockly.Blocks['sensebox_display_beginDisplay'] = {
|
|
||||||
init: function () {
|
init: function () {
|
||||||
this.appendDummyInput()
|
this.appendDummyInput().appendField(
|
||||||
.appendField(Blockly.Msg.senseBox_display_beginDisplay)
|
Blockly.Msg.senseBox_display_beginDisplay
|
||||||
|
);
|
||||||
this.setPreviousStatement(true, null);
|
this.setPreviousStatement(true, null);
|
||||||
this.setNextStatement(true, null);
|
this.setNextStatement(true, null);
|
||||||
this.setColour(getColour().sensebox);
|
this.setColour(getColour().sensebox);
|
||||||
this.setTooltip(Blockly.Msg.senseBox_display_beginDisplay_tooltip);
|
this.setTooltip(Blockly.Msg.senseBox_display_beginDisplay_tooltip);
|
||||||
this.setHelpUrl(Blockly.Msg.senseBox_display_helpurl);
|
this.setHelpUrl(Blockly.Msg.senseBox_display_helpurl);
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
Blockly.Blocks['sensebox_display_clearDisplay'] = {
|
Blockly.Blocks["sensebox_display_clearDisplay"] = {
|
||||||
init: function () {
|
init: function () {
|
||||||
this.appendDummyInput()
|
this.appendDummyInput().appendField(
|
||||||
.appendField(Blockly.Msg.senseBox_display_clearDisplay)
|
Blockly.Msg.senseBox_display_clearDisplay
|
||||||
|
);
|
||||||
this.setPreviousStatement(true, null);
|
this.setPreviousStatement(true, null);
|
||||||
this.setNextStatement(true, null);
|
this.setNextStatement(true, null);
|
||||||
this.setColour(getColour().sensebox);
|
this.setColour(getColour().sensebox);
|
||||||
this.setTooltip(Blockly.Msg.senseBox_display_clearDisplay_tooltip);
|
this.setTooltip(Blockly.Msg.senseBox_display_clearDisplay_tooltip);
|
||||||
this.setHelpUrl(Blockly.Msg.senseBox_display_helpurl);
|
this.setHelpUrl(Blockly.Msg.senseBox_display_helpurl);
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
Blockly.Blocks['sensebox_display_printDisplay'] = {
|
Blockly.Blocks["sensebox_display_printDisplay"] = {
|
||||||
init: function (block) {
|
init: function (block) {
|
||||||
this.setColour(getColour().sensebox);
|
this.setColour(getColour().sensebox);
|
||||||
this.appendDummyInput()
|
this.appendDummyInput().appendField(
|
||||||
.appendField(Blockly.Msg.senseBox_display_printDisplay);
|
Blockly.Msg.senseBox_display_printDisplay
|
||||||
|
);
|
||||||
this.appendDummyInput()
|
this.appendDummyInput()
|
||||||
.appendField(Blockly.Msg.senseBox_display_color)
|
.appendField(Blockly.Msg.senseBox_display_color)
|
||||||
.appendField(new Blockly.FieldDropdown([[Blockly.Msg.senseBox_display_white, "WHITE,BLACK"], [Blockly.Msg.senseBox_display_black, "BLACK,WHITE"]]), "COLOR");
|
.appendField(
|
||||||
|
new Blockly.FieldDropdown([
|
||||||
|
[Blockly.Msg.senseBox_display_white, "WHITE,BLACK"],
|
||||||
|
[Blockly.Msg.senseBox_display_black, "BLACK,WHITE"],
|
||||||
|
]),
|
||||||
|
"COLOR"
|
||||||
|
);
|
||||||
this.appendDummyInput()
|
this.appendDummyInput()
|
||||||
.appendField(Blockly.Msg.senseBox_display_setSize)
|
.appendField(Blockly.Msg.senseBox_display_setSize)
|
||||||
.appendField(new FieldSlider(1, 1, 4), "SIZE");
|
.appendField(new FieldSlider(1, 1, 4), "SIZE");
|
||||||
this.appendDummyInput()
|
this.appendDummyInput()
|
||||||
.appendField(Blockly.Msg.senseBox_display_printDisplay_x)
|
.appendField(Blockly.Msg.senseBox_display_printDisplay_x)
|
||||||
.appendField(new FieldSlider(0, 0, 64), "X");
|
.appendField(new FieldSlider(0, 0, 128), "X");
|
||||||
this.appendDummyInput()
|
this.appendDummyInput()
|
||||||
.appendField(Blockly.Msg.senseBox_display_printDisplay_y)
|
.appendField(Blockly.Msg.senseBox_display_printDisplay_y)
|
||||||
.appendField(new FieldSlider(0, 0, 128), "Y");
|
.appendField(new FieldSlider(0, 0, 64), "Y");
|
||||||
this.appendValueInput('printDisplay')
|
this.appendValueInput("printDisplay")
|
||||||
.appendField(Blockly.Msg.senseBox_display_printDisplay_value)
|
.appendField(Blockly.Msg.senseBox_display_printDisplay_value)
|
||||||
.setCheck(null);
|
.setCheck(null);
|
||||||
this.setPreviousStatement(true, null);
|
this.setPreviousStatement(true, null);
|
||||||
@ -76,26 +84,33 @@ Blockly.Blocks['sensebox_display_printDisplay'] = {
|
|||||||
this.setWarningText(Blockly.Msg.CONTROLS_FLOW_STATEMENTS_WARNING);
|
this.setWarningText(Blockly.Msg.CONTROLS_FLOW_STATEMENTS_WARNING);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
LOOP_TYPES: ['sensebox_display_show'],
|
LOOP_TYPES: ["sensebox_display_show"],
|
||||||
};
|
};
|
||||||
|
|
||||||
Blockly.Blocks['sensebox_display_fastPrint'] = {
|
Blockly.Blocks["sensebox_display_fastPrint"] = {
|
||||||
init: function (block) {
|
init: function (block) {
|
||||||
this.setColour(getColour().sensebox);
|
this.setColour(getColour().sensebox);
|
||||||
this.appendDummyInput()
|
this.appendDummyInput().appendField(
|
||||||
.appendField(Blockly.Msg.senseBox_display_fastPrint_show);
|
Blockly.Msg.senseBox_display_fastPrint_show
|
||||||
this.appendValueInput("Title1", 'Title1')
|
);
|
||||||
.appendField(Blockly.Msg.senseBox_display_fastPrint_title);
|
this.appendValueInput("Title1", "Title1").appendField(
|
||||||
this.appendValueInput("Value1", 'Value1')
|
Blockly.Msg.senseBox_display_fastPrint_title
|
||||||
.appendField(Blockly.Msg.senseBox_display_fastPrint_value);
|
);
|
||||||
this.appendValueInput("Dimension1", 'Dimension1')
|
this.appendValueInput("Value1", "Value1").appendField(
|
||||||
.appendField(Blockly.Msg.senseBox_display_fastPrint_dimension);
|
Blockly.Msg.senseBox_display_fastPrint_value
|
||||||
this.appendValueInput("Title2", 'Title2')
|
);
|
||||||
.appendField(Blockly.Msg.senseBox_display_fastPrint_title);
|
this.appendValueInput("Dimension1", "Dimension1").appendField(
|
||||||
this.appendValueInput("Value2", 'Value2')
|
Blockly.Msg.senseBox_display_fastPrint_dimension
|
||||||
.appendField(Blockly.Msg.senseBox_display_fastPrint_value);
|
);
|
||||||
this.appendValueInput("Dimension2", 'Dimension2')
|
this.appendValueInput("Title2", "Title2").appendField(
|
||||||
.appendField(Blockly.Msg.senseBox_display_fastPrint_dimension);
|
Blockly.Msg.senseBox_display_fastPrint_title
|
||||||
|
);
|
||||||
|
this.appendValueInput("Value2", "Value2").appendField(
|
||||||
|
Blockly.Msg.senseBox_display_fastPrint_value
|
||||||
|
);
|
||||||
|
this.appendValueInput("Dimension2", "Dimension2").appendField(
|
||||||
|
Blockly.Msg.senseBox_display_fastPrint_dimension
|
||||||
|
);
|
||||||
this.setPreviousStatement(true, null);
|
this.setPreviousStatement(true, null);
|
||||||
this.setNextStatement(true, null);
|
this.setNextStatement(true, null);
|
||||||
this.setTooltip(Blockly.Msg.sensebox_display_fastPrint_tooltip);
|
this.setTooltip(Blockly.Msg.sensebox_display_fastPrint_tooltip);
|
||||||
@ -124,37 +139,47 @@ Blockly.Blocks['sensebox_display_fastPrint'] = {
|
|||||||
this.setWarningText(Blockly.Msg.CONTROLS_FLOW_STATEMENTS_WARNING);
|
this.setWarningText(Blockly.Msg.CONTROLS_FLOW_STATEMENTS_WARNING);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
LOOP_TYPES: ['sensebox_display_show'],
|
LOOP_TYPES: ["sensebox_display_show"],
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Blockly.Blocks["sensebox_display_plotDisplay"] = {
|
||||||
Blockly.Blocks['sensebox_display_plotDisplay'] = {
|
|
||||||
init: function () {
|
init: function () {
|
||||||
this.setColour(getColour().sensebox);
|
this.setColour(getColour().sensebox);
|
||||||
this.appendDummyInput()
|
this.appendDummyInput().appendField(
|
||||||
.appendField(Blockly.Msg.senseBox_display_plotDisplay)
|
Blockly.Msg.senseBox_display_plotDisplay
|
||||||
this.appendValueInput("Title", 'Text')
|
);
|
||||||
.appendField(Blockly.Msg.senseBox_display_plotTitle);
|
this.appendValueInput("Title", "Text").appendField(
|
||||||
this.appendValueInput("YLabel", 'Text')
|
Blockly.Msg.senseBox_display_plotTitle
|
||||||
.appendField(Blockly.Msg.senseBox_display_plotYLabel);
|
);
|
||||||
this.appendValueInput("XLabel", 'Text')
|
this.appendValueInput("YLabel", "Text").appendField(
|
||||||
.appendField(Blockly.Msg.senseBox_display_plotXLabel);
|
Blockly.Msg.senseBox_display_plotYLabel
|
||||||
this.appendValueInput("XRange1", 'Number')
|
);
|
||||||
.appendField(Blockly.Msg.senseBox_display_plotXRange1);
|
this.appendValueInput("XLabel", "Text").appendField(
|
||||||
this.appendValueInput("XRange2", 'Number')
|
Blockly.Msg.senseBox_display_plotXLabel
|
||||||
.appendField(Blockly.Msg.senseBox_display_plotXRange2)
|
);
|
||||||
this.appendValueInput("YRange1", 'Number')
|
this.appendValueInput("XRange1", "Number").appendField(
|
||||||
.appendField(Blockly.Msg.senseBox_display_plotYRange1);
|
Blockly.Msg.senseBox_display_plotXRange1
|
||||||
this.appendValueInput("YRange2", 'Number')
|
);
|
||||||
.appendField(Blockly.Msg.senseBox_display_plotYRange2);
|
this.appendValueInput("XRange2", "Number").appendField(
|
||||||
|
Blockly.Msg.senseBox_display_plotXRange2
|
||||||
|
);
|
||||||
|
this.appendValueInput("YRange1", "Number").appendField(
|
||||||
|
Blockly.Msg.senseBox_display_plotYRange1
|
||||||
|
);
|
||||||
|
this.appendValueInput("YRange2", "Number").appendField(
|
||||||
|
Blockly.Msg.senseBox_display_plotYRange2
|
||||||
|
);
|
||||||
this.setInputsInline(false);
|
this.setInputsInline(false);
|
||||||
this.appendValueInput("XTick", 'Number')
|
this.appendValueInput("XTick", "Number").appendField(
|
||||||
.appendField(Blockly.Msg.senseBox_display_plotXTick);
|
Blockly.Msg.senseBox_display_plotXTick
|
||||||
this.appendValueInput("YTick", 'Number')
|
);
|
||||||
.appendField(Blockly.Msg.senseBox_display_plotYTick);
|
this.appendValueInput("YTick", "Number").appendField(
|
||||||
this.appendValueInput("TimeFrame", 'Number')
|
Blockly.Msg.senseBox_display_plotYTick
|
||||||
.appendField(Blockly.Msg.senseBox_display_plotTimeFrame);
|
);
|
||||||
this.appendValueInput('plotDisplay')
|
this.appendValueInput("TimeFrame", "Number").appendField(
|
||||||
|
Blockly.Msg.senseBox_display_plotTimeFrame
|
||||||
|
);
|
||||||
|
this.appendValueInput("plotDisplay")
|
||||||
.appendField(Blockly.Msg.senseBox_display_printDisplay_value)
|
.appendField(Blockly.Msg.senseBox_display_printDisplay_value)
|
||||||
.setCheck(null);
|
.setCheck(null);
|
||||||
this.setPreviousStatement(true, null);
|
this.setPreviousStatement(true, null);
|
||||||
@ -185,43 +210,42 @@ Blockly.Blocks['sensebox_display_plotDisplay'] = {
|
|||||||
this.setWarningText(Blockly.Msg.CONTROLS_FLOW_STATEMENTS_WARNING);
|
this.setWarningText(Blockly.Msg.CONTROLS_FLOW_STATEMENTS_WARNING);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
LOOP_TYPES: ['sensebox_display_show'],
|
LOOP_TYPES: ["sensebox_display_show"],
|
||||||
};
|
};
|
||||||
|
|
||||||
Blockly.Blocks['sensebox_display_show'] = {
|
Blockly.Blocks["sensebox_display_show"] = {
|
||||||
init: function () {
|
init: function () {
|
||||||
|
|
||||||
this.setColour(getColour().sensebox);
|
this.setColour(getColour().sensebox);
|
||||||
this.appendDummyInput()
|
this.appendDummyInput().appendField(Blockly.Msg.sensebox_display_show);
|
||||||
.appendField(Blockly.Msg.sensebox_display_show);
|
this.appendStatementInput("SHOW");
|
||||||
this.appendStatementInput('SHOW');
|
|
||||||
this.setTooltip(Blockly.Msg.sensebox_display_show_tip);
|
this.setTooltip(Blockly.Msg.sensebox_display_show_tip);
|
||||||
this.setHelpUrl('');
|
this.setHelpUrl("");
|
||||||
this.setPreviousStatement(true, null);
|
this.setPreviousStatement(true, null);
|
||||||
this.setNextStatement(true, null);
|
this.setNextStatement(true, null);
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
Blockly.Blocks['sensebox_display_fillCircle'] = {
|
Blockly.Blocks["sensebox_display_fillCircle"] = {
|
||||||
init: function () {
|
init: function () {
|
||||||
this.setColour(getColour().sensebox);
|
this.setColour(getColour().sensebox);
|
||||||
this.appendDummyInput()
|
this.appendDummyInput().appendField(
|
||||||
.appendField(Blockly.Msg.sensebox_display_fillCircle);
|
Blockly.Msg.sensebox_display_fillCircle
|
||||||
this.appendValueInput('X')
|
);
|
||||||
|
this.appendValueInput("X")
|
||||||
.appendField(Blockly.Msg.senseBox_display_printDisplay_x)
|
.appendField(Blockly.Msg.senseBox_display_printDisplay_x)
|
||||||
.setCheck(Types.NUMBER.compatibleTypes);
|
.setCheck(Types.NUMBER.compatibleTypes);
|
||||||
this.appendValueInput('Y')
|
this.appendValueInput("Y")
|
||||||
.appendField(Blockly.Msg.senseBox_display_printDisplay_y)
|
.appendField(Blockly.Msg.senseBox_display_printDisplay_y)
|
||||||
.setCheck(Types.NUMBER.compatibleTypes);
|
.setCheck(Types.NUMBER.compatibleTypes);
|
||||||
this.appendValueInput('Radius')
|
this.appendValueInput("Radius")
|
||||||
.appendField(Blockly.Msg.sensebox_display_fillCircle_radius)
|
.appendField(Blockly.Msg.sensebox_display_fillCircle_radius)
|
||||||
.setCheck(Types.NUMBER.compatibleTypes);
|
.setCheck(Types.NUMBER.compatibleTypes);
|
||||||
this.appendDummyInput('fill')
|
this.appendDummyInput("fill")
|
||||||
.appendField(Blockly.Msg.senseBox_display_filled)
|
.appendField(Blockly.Msg.senseBox_display_filled)
|
||||||
.appendField(new Blockly.FieldCheckbox("TRUE"), "FILL");
|
.appendField(new Blockly.FieldCheckbox("TRUE"), "FILL");
|
||||||
this.setInputsInline(false);
|
this.setInputsInline(false);
|
||||||
this.setTooltip(Blockly.Msg.senseBox_display_fillCircle_tooltip)
|
this.setTooltip(Blockly.Msg.senseBox_display_fillCircle_tooltip);
|
||||||
this.setHelpUrl(Blockly.Msg.senseBox_display_helpurl)
|
this.setHelpUrl(Blockly.Msg.senseBox_display_helpurl);
|
||||||
this.setPreviousStatement(true, null);
|
this.setPreviousStatement(true, null);
|
||||||
this.setNextStatement(true, null);
|
this.setNextStatement(true, null);
|
||||||
},
|
},
|
||||||
@ -248,32 +272,33 @@ Blockly.Blocks['sensebox_display_fillCircle'] = {
|
|||||||
this.setWarningText(Blockly.Msg.CONTROLS_FLOW_STATEMENTS_WARNING);
|
this.setWarningText(Blockly.Msg.CONTROLS_FLOW_STATEMENTS_WARNING);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
LOOP_TYPES: ['sensebox_display_show'],
|
LOOP_TYPES: ["sensebox_display_show"],
|
||||||
};
|
};
|
||||||
|
|
||||||
Blockly.Blocks['sensebox_display_drawRectangle'] = {
|
Blockly.Blocks["sensebox_display_drawRectangle"] = {
|
||||||
init: function () {
|
init: function () {
|
||||||
this.setColour(getColour().sensebox);
|
this.setColour(getColour().sensebox);
|
||||||
this.appendDummyInput()
|
this.appendDummyInput().appendField(
|
||||||
.appendField(Blockly.Msg.sensebox_display_drawRectangle);
|
Blockly.Msg.sensebox_display_drawRectangle
|
||||||
this.appendValueInput('X')
|
);
|
||||||
|
this.appendValueInput("X")
|
||||||
.appendField(Blockly.Msg.senseBox_display_printDisplay_x)
|
.appendField(Blockly.Msg.senseBox_display_printDisplay_x)
|
||||||
.setCheck(Types.NUMBER.compatibleTypes);
|
.setCheck(Types.NUMBER.compatibleTypes);
|
||||||
this.appendValueInput('Y')
|
this.appendValueInput("Y")
|
||||||
.appendField(Blockly.Msg.senseBox_display_printDisplay_y)
|
.appendField(Blockly.Msg.senseBox_display_printDisplay_y)
|
||||||
.setCheck(Types.NUMBER.compatibleTypes);
|
.setCheck(Types.NUMBER.compatibleTypes);
|
||||||
this.appendValueInput('width')
|
this.appendValueInput("width")
|
||||||
.appendField(Blockly.Msg.sensebox_display_drawRectangle_width)
|
.appendField(Blockly.Msg.sensebox_display_drawRectangle_width)
|
||||||
.setCheck(Types.NUMBER.compatibleTypes);
|
.setCheck(Types.NUMBER.compatibleTypes);
|
||||||
this.appendValueInput('height')
|
this.appendValueInput("height")
|
||||||
.appendField(Blockly.Msg.sensebox_display_drawRectangle_height)
|
.appendField(Blockly.Msg.sensebox_display_drawRectangle_height)
|
||||||
.setCheck(Types.NUMBER.compatibleTypes);
|
.setCheck(Types.NUMBER.compatibleTypes);
|
||||||
this.appendDummyInput('fill')
|
this.appendDummyInput("fill")
|
||||||
.appendField(Blockly.Msg.senseBox_display_filled)
|
.appendField(Blockly.Msg.senseBox_display_filled)
|
||||||
.appendField(new Blockly.FieldCheckbox("TRUE"), "FILL");
|
.appendField(new Blockly.FieldCheckbox("TRUE"), "FILL");
|
||||||
this.setInputsInline(false);
|
this.setInputsInline(false);
|
||||||
this.setTooltip(Blockly.Msg.senseBox_display_drawRectangle_tooltip)
|
this.setTooltip(Blockly.Msg.senseBox_display_drawRectangle_tooltip);
|
||||||
this.setHelpUrl(Blockly.Msg.senseBox_display_helpurl)
|
this.setHelpUrl(Blockly.Msg.senseBox_display_helpurl);
|
||||||
this.setPreviousStatement(true, null);
|
this.setPreviousStatement(true, null);
|
||||||
this.setNextStatement(true, null);
|
this.setNextStatement(true, null);
|
||||||
},
|
},
|
||||||
@ -300,5 +325,5 @@ Blockly.Blocks['sensebox_display_drawRectangle'] = {
|
|||||||
this.setWarningText(Blockly.Msg.CONTROLS_FLOW_STATEMENTS_WARNING);
|
this.setWarningText(Blockly.Msg.CONTROLS_FLOW_STATEMENTS_WARNING);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
LOOP_TYPES: ['sensebox_display_show'],
|
LOOP_TYPES: ["sensebox_display_show"],
|
||||||
};
|
};
|
||||||
|
@ -173,7 +173,7 @@ void writeMeasurementsToSdCard(char* timeStamp, uint32_t latitudes, uint32_t lon
|
|||||||
dtostrf(latitude, 1, 7, lat);
|
dtostrf(latitude, 1, 7, lat);
|
||||||
sprintf_P(buffer, PSTR("%s,%9.2f,%s,%02s,%02s"), measurements[i].sensorId, measurements[i].value, timeStamp, lng, lat);
|
sprintf_P(buffer, PSTR("%s,%9.2f,%s,%02s,%02s"), measurements[i].sensorId, measurements[i].value, timeStamp, lng, lat);
|
||||||
// transmit buffer to client
|
// transmit buffer to client
|
||||||
${filename}.print(buffer);
|
${filename}.println(buffer);
|
||||||
}
|
}
|
||||||
// reset num_measurements
|
// reset num_measurements
|
||||||
num_measurements = 0;
|
num_measurements = 0;
|
||||||
|
@ -3,40 +3,127 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
const sensebox_mcu = {
|
const sensebox_mcu = {
|
||||||
description: 'senseBox Microcontroller Unit based on Microchip SAMD21G18A',
|
description: "senseBox Microcontroller Unit based on Microchip SAMD21G18A",
|
||||||
compilerFlag: 'arduino:samd',
|
compilerFlag: "arduino:samd",
|
||||||
digitalPins: [['D1', '1'], ['D2', '2'], ['D3', '3'], ['D4', '4'], ['D5', '5'], ['D6', '6']],
|
digitalPins: [
|
||||||
digitalPinsLED: [['BUILTIN_1', '7'], ['BUILTIN_2', '8'], ['D1', '1'], ['D2', '2'], ['D3', '3'], ['D4', '4'], ['D5', '5'], ['D6', '6']],
|
["A1", "1"],
|
||||||
digitalPinsButton: [['on Board', '0'], ['D1', '1'], ['D2', '2'], ['D3', '3'], ['D4', '4'], ['D5', '5'], ['D6', '6']],
|
["A2", "2"],
|
||||||
pwmPins: [['D1', '1'], ['D2', '2'], ['D3', '3'], ['D4', '4'], ['D5', '5'], ['D6', '6']],
|
["B3", "3"],
|
||||||
serial: [['serial', 'SerialUSB'], ['serial_1', 'Serial1'], ['serial_2', 'Serial2']],
|
["B4", "4"],
|
||||||
|
["C5", "5"],
|
||||||
|
["C6", "6"],
|
||||||
|
],
|
||||||
|
digitalPinsLED: [
|
||||||
|
["BUILTIN_1", "7"],
|
||||||
|
["BUILTIN_2", "8"],
|
||||||
|
["A1", "1"],
|
||||||
|
["A2", "2"],
|
||||||
|
["B3", "3"],
|
||||||
|
["B4", "4"],
|
||||||
|
["C5", "5"],
|
||||||
|
["C6", "6"],
|
||||||
|
],
|
||||||
|
digitalPinsButton: [
|
||||||
|
["on Board", "0"],
|
||||||
|
["A1", "1"],
|
||||||
|
["A2", "2"],
|
||||||
|
["B3", "3"],
|
||||||
|
["B4", "4"],
|
||||||
|
["C5", "5"],
|
||||||
|
["C6", "6"],
|
||||||
|
],
|
||||||
|
pwmPins: [
|
||||||
|
["A1", "1"],
|
||||||
|
["A2", "2"],
|
||||||
|
["B3", "3"],
|
||||||
|
["B4", "4"],
|
||||||
|
["C5", "5"],
|
||||||
|
["C6", "6"],
|
||||||
|
],
|
||||||
|
serial: [
|
||||||
|
["serial", "SerialUSB"],
|
||||||
|
["serial_1", "Serial1"],
|
||||||
|
["serial_2", "Serial2"],
|
||||||
|
],
|
||||||
serialPins: {
|
serialPins: {
|
||||||
SerialUSB: [['RX', ''], ['TX', '']],
|
SerialUSB: [
|
||||||
Serial1: [['RX', '11'], ['TX', '10']],
|
["RX", ""],
|
||||||
Serial2: [['RX', '13'], ['TX', '12']]
|
["TX", ""],
|
||||||
|
],
|
||||||
|
Serial1: [
|
||||||
|
["RX", "11"],
|
||||||
|
["TX", "10"],
|
||||||
|
],
|
||||||
|
Serial2: [
|
||||||
|
["RX", "13"],
|
||||||
|
["TX", "12"],
|
||||||
|
],
|
||||||
},
|
},
|
||||||
serialSpeed: [['300', '300'], ['600', '600'], ['1200', '1200'],
|
serialSpeed: [
|
||||||
['2400', '2400'], ['4800', '4800'], ['9600', '9600'],
|
["300", "300"],
|
||||||
['14400', '14400'], ['19200', '19200'], ['28800', '28800'],
|
["600", "600"],
|
||||||
['31250', '31250'], ['38400', '38400'], ['57600', '57600'],
|
["1200", "1200"],
|
||||||
['115200', '115200']],
|
["2400", "2400"],
|
||||||
spi: [['SPI', 'SPI']],
|
["4800", "4800"],
|
||||||
spiPins: { SPI: [['MOSI', '19'], ['MISO', '21'], ['SCK', '20']] },
|
["9600", "9600"],
|
||||||
spiClockDivide: [['2 (8MHz)', 'SPI_CLOCK_DIV2'],
|
["14400", "14400"],
|
||||||
['4 (4MHz)', 'SPI_CLOCK_DIV4'],
|
["19200", "19200"],
|
||||||
['8 (2MHz)', 'SPI_CLOCK_DIV8'],
|
["28800", "28800"],
|
||||||
['16 (1MHz)', 'SPI_CLOCK_DIV16'],
|
["31250", "31250"],
|
||||||
['32 (500KHz)', 'SPI_CLOCK_DIV32'],
|
["38400", "38400"],
|
||||||
['64 (250KHz)', 'SPI_CLOCK_DIV64'],
|
["57600", "57600"],
|
||||||
['128 (125KHz)', 'SPI_CLOCK_DIV128']],
|
["115200", "115200"],
|
||||||
i2c: [['I2C', 'Wire']],
|
],
|
||||||
i2cPins: { Wire: [['SDA', '17'], ['SCL', '16']] },
|
spi: [["SPI", "SPI"]],
|
||||||
i2cSpeed: [['100kHz', '100000L'], ['400kHz', '400000L']],
|
spiPins: {
|
||||||
builtinLed: [['BUILTIN_1', '7'], ['BUILTIN_2', '8']],
|
SPI: [
|
||||||
interrupt: [['interrupt1', '1'], ['interrupt2', '2'], ['interrupt3', '3'], ['interrupt4', '4'], ['interrupt5', '5'], ['interrupt6', '6']],
|
["MOSI", "19"],
|
||||||
analogPins: [['A1', 'A1'], ['A2', 'A2'], ['A3', 'A3'], ['A4', 'A4'], ['A5', 'A5'], ['A6', 'A6']],
|
["MISO", "21"],
|
||||||
|
["SCK", "20"],
|
||||||
|
],
|
||||||
|
},
|
||||||
|
spiClockDivide: [
|
||||||
|
["2 (8MHz)", "SPI_CLOCK_DIV2"],
|
||||||
|
["4 (4MHz)", "SPI_CLOCK_DIV4"],
|
||||||
|
["8 (2MHz)", "SPI_CLOCK_DIV8"],
|
||||||
|
["16 (1MHz)", "SPI_CLOCK_DIV16"],
|
||||||
|
["32 (500KHz)", "SPI_CLOCK_DIV32"],
|
||||||
|
["64 (250KHz)", "SPI_CLOCK_DIV64"],
|
||||||
|
["128 (125KHz)", "SPI_CLOCK_DIV128"],
|
||||||
|
],
|
||||||
|
i2c: [["I2C", "Wire"]],
|
||||||
|
i2cPins: {
|
||||||
|
Wire: [
|
||||||
|
["SDA", "17"],
|
||||||
|
["SCL", "16"],
|
||||||
|
],
|
||||||
|
},
|
||||||
|
i2cSpeed: [
|
||||||
|
["100kHz", "100000L"],
|
||||||
|
["400kHz", "400000L"],
|
||||||
|
],
|
||||||
|
builtinLed: [
|
||||||
|
["BUILTIN_1", "7"],
|
||||||
|
["BUILTIN_2", "8"],
|
||||||
|
],
|
||||||
|
interrupt: [
|
||||||
|
["interrupt1", "1"],
|
||||||
|
["interrupt2", "2"],
|
||||||
|
["interrupt3", "3"],
|
||||||
|
["interrupt4", "4"],
|
||||||
|
["interrupt5", "5"],
|
||||||
|
["interrupt6", "6"],
|
||||||
|
],
|
||||||
|
analogPins: [
|
||||||
|
["A1", "A1"],
|
||||||
|
["A2", "A2"],
|
||||||
|
["B3", "A3"],
|
||||||
|
["B4", "A4"],
|
||||||
|
["C5", "A5"],
|
||||||
|
["C6", "A6"],
|
||||||
|
],
|
||||||
serial_baud_rate: 9600,
|
serial_baud_rate: 9600,
|
||||||
parseKey: '_*_'
|
parseKey: "_*_",
|
||||||
};
|
};
|
||||||
|
|
||||||
export const selectedBoard = () => {
|
export const selectedBoard = () => {
|
||||||
|
21
src/components/Blockly/helpers/maxInstances.js
Normal file
21
src/components/Blockly/helpers/maxInstances.js
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
/**
|
||||||
|
* To limit number of specific blocks in the workspace add block name and number of maxInstances here.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
const maxInstances = {
|
||||||
|
sensebox_wifi: 1,
|
||||||
|
sensebox_startap: 1,
|
||||||
|
sensebox_display_beginDisplay: 1,
|
||||||
|
sensebox_telegram: 1,
|
||||||
|
sensebox_telegram_do: 1,
|
||||||
|
sensebox_interval_timer: 1,
|
||||||
|
sensebox_osem_connection: 1,
|
||||||
|
sensebox_lora_initialize_otaa: 1,
|
||||||
|
sensebox_lora_initialize_abp: 1,
|
||||||
|
sensebox_phyphox_init: 1,
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getMaxInstances = () => {
|
||||||
|
return maxInstances;
|
||||||
|
};
|
@ -19,9 +19,11 @@ Das Kopieren der Programme unter MacOS funktioniert nicht über den Finder, es g
|
|||||||
Grundsätzlich kann die Programmierumgebung mit jeder senseBox mit senseBox MCU verwendet werden.
|
Grundsätzlich kann die Programmierumgebung mit jeder senseBox mit senseBox MCU verwendet werden.
|
||||||
`,
|
`,
|
||||||
|
|
||||||
|
|
||||||
faq_q3_question: `Ich habe einen Fehler gefunden oder etwas funktioniert nicht. Wo kann ich diesen melden?`,
|
faq_q3_question: `Ich habe einen Fehler gefunden oder etwas funktioniert nicht. Wo kann ich diesen melden?`,
|
||||||
faq_q3_answer: `
|
faq_q3_answer: `
|
||||||
Am besten legst du dazu ein Issue auf [Github](https://github.com/sensebox/React-Ardublockly/issues) an. Alternativ kannst du uns auch eine Email an info(at)sensebox.de senden
|
Am besten legst du dazu ein Issue auf [Github](https://github.com/sensebox/React-Ardublockly/issues) an. Alternativ kannst du uns auch eine Email an info(at)sensebox.de senden
|
||||||
`,
|
`,
|
||||||
}
|
|
||||||
|
faq_tablet_question: `Kann ich die senseBox auch über ein Tablet programmieren?`,
|
||||||
|
faq_tablet_answer: `Ja! Installiere dazu die senseBox Connect App aus dem App Store und rufe die Learn- und Programmierumgebung in deinem Browser am Tablet auf. Genaue Informationen zur Verwendung der App findest du unter [https://sensebox.de/app](https://sensebox.de/app)`,
|
||||||
|
};
|
||||||
|
@ -1,43 +1,56 @@
|
|||||||
export const LOGIC = {
|
export const LOGIC = {
|
||||||
|
|
||||||
CONTROLS_IF_ELSEIF_TOOLTIP: "Eine weitere Bedingung hinzufügen.",
|
CONTROLS_IF_ELSEIF_TOOLTIP: "Eine weitere Bedingung hinzufügen.",
|
||||||
CONTROLS_IF_ELSE_TOOLTIP: "Eine sonst-Bedingung hinzufügen, führt eine Anweisung aus, falls keine Bedingung zutrifft.",
|
CONTROLS_IF_ELSE_TOOLTIP:
|
||||||
|
"Eine sonst-Bedingung hinzufügen, führt eine Anweisung aus, falls keine Bedingung zutrifft.",
|
||||||
CONTROLS_IF_HELPURL: "https://github.com/google/blockly/wiki/IfElse", // untranslated
|
CONTROLS_IF_HELPURL: "https://github.com/google/blockly/wiki/IfElse", // untranslated
|
||||||
CONTROLS_IF_IF_TOOLTIP: "Hinzufügen, entfernen oder sortieren von Sektionen",
|
CONTROLS_IF_IF_TOOLTIP: "Hinzufügen, entfernen oder sortieren von Sektionen",
|
||||||
CONTROLS_IF_MSG_ELSE: "sonst",
|
CONTROLS_IF_MSG_ELSE: "sonst",
|
||||||
CONTROLS_IF_MSG_ELSEIF: "sonst wenn",
|
CONTROLS_IF_MSG_ELSEIF: "sonst wenn",
|
||||||
CONTROLS_IF_MSG_IF: "wenn",
|
CONTROLS_IF_MSG_IF: "wenn",
|
||||||
CONTROLS_IF_TOOLTIP_1: "Wenn eine Bedingung wahr (true) ist, dann führe eine Anweisung aus.",
|
CONTROLS_IF_TOOLTIP_1:
|
||||||
CONTROLS_IF_TOOLTIP_2: "Wenn eine Bedingung wahr (true) ist, dann führe die erste Anweisung aus. Ansonsten führe die zweite Anweisung aus.",
|
"Wenn eine Bedingung wahr (true) ist, dann führe eine Anweisung aus.",
|
||||||
CONTROLS_IF_TOOLTIP_3: "Wenn die erste Bedingung wahr (true) ist, dann führe die erste Anweisung aus. Oder wenn die zweite Bedingung wahr (true) ist, dann führe die zweite Anweisung aus.",
|
CONTROLS_IF_TOOLTIP_2:
|
||||||
CONTROLS_IF_TOOLTIP_4: "Wenn die erste Bedingung wahr (true) ist, dann führe die erste Anweisung aus. Oder wenn die zweite Bedingung wahr (true) ist, dann führe die zweite Anweisung aus. Falls keine der beiden Bedingungen wahr (true) ist, dann führe die dritte Anweisung aus.",
|
"Wenn eine Bedingung wahr (true) ist, dann führe die erste Anweisung aus. Ansonsten führe die zweite Anweisung aus.",
|
||||||
|
CONTROLS_IF_TOOLTIP_3:
|
||||||
|
"Wenn die erste Bedingung wahr (true) ist, dann führe die erste Anweisung aus. Oder wenn die zweite Bedingung wahr (true) ist, dann führe die zweite Anweisung aus.",
|
||||||
|
CONTROLS_IF_TOOLTIP_4:
|
||||||
|
"Wenn die erste Bedingung wahr (true) ist, dann führe die erste Anweisung aus. Oder wenn die zweite Bedingung wahr (true) ist, dann führe die zweite Anweisung aus. Falls keine der beiden Bedingungen wahr (true) ist, dann führe die dritte Anweisung aus.",
|
||||||
LOGIC_BOOLEAN_HELPURL: "https://github.com/google/blockly/wiki/Logic#values", // untranslated
|
LOGIC_BOOLEAN_HELPURL: "https://github.com/google/blockly/wiki/Logic#values", // untranslated
|
||||||
LOGIC_BOOLEAN_TOOLTIP: "Ist entweder wahr (true) oder falsch (false)",
|
LOGIC_BOOLEAN_TOOLTIP: "Ist entweder wahr (true) oder falsch (false)",
|
||||||
LOGIC_BOOLEAN_TRUE: "wahr",
|
LOGIC_BOOLEAN_TRUE: "wahr",
|
||||||
LOGIC_COMPARE_HELPURL: "https://de.wikipedia.org/wiki/Vergleich_%28Zahlen%29",
|
LOGIC_COMPARE_HELPURL: "https://de.wikipedia.org/wiki/Vergleich_%28Zahlen%29",
|
||||||
LOGIC_COMPARE_TOOLTIP_EQ: "Ist wahr (true), wenn beide Werte gleich sind.",
|
LOGIC_COMPARE_TOOLTIP_EQ: "Ist wahr (true), wenn beide Werte gleich sind.",
|
||||||
LOGIC_COMPARE_TOOLTIP_GT: "Ist wahr (true), wenn der erste Wert größer als der zweite Wert ist.",
|
LOGIC_COMPARE_TOOLTIP_GT:
|
||||||
LOGIC_COMPARE_TOOLTIP_GTE: "Ist wahr (true), wenn der erste Wert größer als oder gleich groß wie der zweite Wert ist.",
|
"Ist wahr (true), wenn der erste Wert größer als der zweite Wert ist.",
|
||||||
LOGIC_COMPARE_TOOLTIP_LT: "Ist wahr (true), wenn der erste Wert kleiner als der zweite Wert ist.",
|
LOGIC_COMPARE_TOOLTIP_GTE:
|
||||||
LOGIC_COMPARE_TOOLTIP_LTE: "Ist wahr (true), wenn der erste Wert kleiner als oder gleich groß wie der zweite Wert ist.",
|
"Ist wahr (true), wenn der erste Wert größer als oder gleich groß wie der zweite Wert ist.",
|
||||||
LOGIC_COMPARE_TOOLTIP_NEQ: "Ist wahr (true), wenn beide Werte unterschiedlich sind.",
|
LOGIC_COMPARE_TOOLTIP_LT:
|
||||||
|
"Ist wahr (true), wenn der erste Wert kleiner als der zweite Wert ist.",
|
||||||
|
LOGIC_COMPARE_TOOLTIP_LTE:
|
||||||
|
"Ist wahr (true), wenn der erste Wert kleiner als oder gleich groß wie der zweite Wert ist.",
|
||||||
|
LOGIC_COMPARE_TOOLTIP_NEQ:
|
||||||
|
"Ist wahr (true), wenn beide Werte unterschiedlich sind.",
|
||||||
LOGIC_NEGATE_HELPURL: "https://github.com/google/blockly/wiki/Logic#not", // untranslated
|
LOGIC_NEGATE_HELPURL: "https://github.com/google/blockly/wiki/Logic#not", // untranslated
|
||||||
LOGIC_NEGATE_TITLE: "nicht %1",
|
LOGIC_NEGATE_TITLE: "nicht %1",
|
||||||
LOGIC_NEGATE_TOOLTIP: "Ist wahr (true), wenn der Eingabewert falsch (false) ist. Ist falsch (false), wenn der Eingabewert wahr (true) ist.",
|
LOGIC_NEGATE_TOOLTIP:
|
||||||
|
"Ist wahr (true), wenn der Eingabewert falsch (false) ist. Ist falsch (false), wenn der Eingabewert wahr (true) ist.",
|
||||||
LOGIC_NULL: "null",
|
LOGIC_NULL: "null",
|
||||||
LOGIC_NULL_HELPURL: "https://de.wikipedia.org/wiki/Nullwert",
|
LOGIC_NULL_HELPURL: "https://de.wikipedia.org/wiki/Nullwert",
|
||||||
LOGIC_NULL_TOOLTIP: "Ist NULL.",
|
LOGIC_NULL_TOOLTIP: "Ist NULL.",
|
||||||
LOGIC_OPERATION_AND: "und",
|
LOGIC_OPERATION_AND: "und",
|
||||||
LOGIC_OPERATION_HELPURL: "https://github.com/google/blockly/wiki/Logic#logical-operations", // untranslated
|
LOGIC_OPERATION_HELPURL:
|
||||||
|
"https://github.com/google/blockly/wiki/Logic#logical-operations", // untranslated
|
||||||
LOGIC_OPERATION_OR: "oder",
|
LOGIC_OPERATION_OR: "oder",
|
||||||
LOGIC_OPERATION_TOOLTIP_AND: "Ist wahr (true), wenn beide Werte wahr (true) sind.",
|
LOGIC_OPERATION_TOOLTIP_AND:
|
||||||
LOGIC_OPERATION_TOOLTIP_OR: "Ist wahr (true), wenn einer der beiden Werte wahr (true) ist.",
|
"Ist wahr (true), wenn beide Werte wahr (true) sind.",
|
||||||
|
LOGIC_OPERATION_TOOLTIP_OR:
|
||||||
|
"Ist wahr (true), wenn einer der beiden Werte wahr (true) ist.",
|
||||||
LOGIC_TERNARY_CONDITION: "teste",
|
LOGIC_TERNARY_CONDITION: "teste",
|
||||||
LOGIC_TERNARY_HELPURL: "https://de.wikipedia.org/wiki/%3F:#Auswahloperator",
|
LOGIC_TERNARY_HELPURL: "https://de.wikipedia.org/wiki/%3F:#Auswahloperator",
|
||||||
LOGIC_TERNARY_IF_FALSE: "wenn falsch",
|
LOGIC_TERNARY_IF_FALSE: "wenn falsch",
|
||||||
LOGIC_TERNARY_IF_TRUE: "wenn wahr",
|
LOGIC_TERNARY_IF_TRUE: "wenn wahr",
|
||||||
LOGIC_TERNARY_TOOLTIP: "Überprüft eine Bedingung \"teste\". Wenn die Bedingung wahr ist, wird der \"wenn wahr\" Wert zurückgegeben, andernfalls der \"wenn falsch\" Wert",
|
LOGIC_TERNARY_TOOLTIP:
|
||||||
|
'Überprüft eine Bedingung "teste". Wenn die Bedingung wahr ist, wird der "wenn wahr" Wert zurückgegeben, andernfalls der "wenn falsch" Wert',
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cases
|
* Cases
|
||||||
@ -46,5 +59,6 @@ export const LOGIC = {
|
|||||||
cases_condition: "Fall (Variable): ",
|
cases_condition: "Fall (Variable): ",
|
||||||
cases_switch: "Variable",
|
cases_switch: "Variable",
|
||||||
cases_add: "Fall",
|
cases_add: "Fall",
|
||||||
cases_tooltip: "Führt den entsprechenden Fall aus, wenn die Überprüfung der Variable TRUE ergibt. Über das Zahnrad kannst du weitere Fälle hinzufügen. Über den 'Default' fall kannst du bestimmen, was passieren soll wenn keiner der vorher definierten Fälle eingetreten ist.",
|
cases_tooltip:
|
||||||
}
|
"Führt den entsprechenden Fall aus, wenn die Überprüfung der Variable TRUE ergibt. Über das Zahnrad kannst du weitere Fälle hinzufügen. Über den 'Default' fall kannst du bestimmen, was passieren soll wenn keiner der vorher definierten Fälle eingetreten ist.",
|
||||||
|
};
|
||||||
|
@ -244,7 +244,7 @@ export const TRANSLATIONS = {
|
|||||||
senseBox_serial_tip:
|
senseBox_serial_tip:
|
||||||
"Gibt Messwerte oder Daten auf dem Seriellen Monitor der Arduino IDE aus. Praktisch um ohne Display zu arbeiten",
|
"Gibt Messwerte oder Daten auf dem Seriellen Monitor der Arduino IDE aus. Praktisch um ohne Display zu arbeiten",
|
||||||
senseBox_output_timestamp: "Zeitstempel (RFC 3339)",
|
senseBox_output_timestamp: "Zeitstempel (RFC 3339)",
|
||||||
senseBox_led: "LED an digitalen",
|
senseBox_led: "LED an",
|
||||||
senseBox_led_tip:
|
senseBox_led_tip:
|
||||||
"Einfache LED. Beim Anschluss sollte immer ein Vorwiderstand verwendet werden",
|
"Einfache LED. Beim Anschluss sollte immer ein Vorwiderstand verwendet werden",
|
||||||
senseBox_piezo: "Piezo an digital",
|
senseBox_piezo: "Piezo an digital",
|
||||||
|
@ -49,7 +49,14 @@ export const UI = {
|
|||||||
tooltip_project_title: "Titel des Projektes",
|
tooltip_project_title: "Titel des Projektes",
|
||||||
tooltip_check_solution: "Lösung kontrollieren",
|
tooltip_check_solution: "Lösung kontrollieren",
|
||||||
tooltip_copy_code: "Code in die Zwischenablage kopieren",
|
tooltip_copy_code: "Code in die Zwischenablage kopieren",
|
||||||
|
tooltip_statistics_current: "Anzahl aktueller Blöcke",
|
||||||
|
tooltip_statistics_new: "Anzahl neuer Blöcke",
|
||||||
|
tooltip_statistics_changed: "Anzahl veränderter Blöcke",
|
||||||
|
tooltip_statistics_moved: "Anzahl bewegter Blöcke",
|
||||||
|
tooltip_statistics_deleted: "Anzahl gelöschter Blöcke",
|
||||||
|
tooltip_statistics_remaining: "Verbleibende Blöcke",
|
||||||
|
tooltip_statistics_show: "Statistiken anzeigen",
|
||||||
|
tooltip_start_tour: "Tour starten",
|
||||||
/**
|
/**
|
||||||
* Messages
|
* Messages
|
||||||
*
|
*
|
||||||
@ -190,7 +197,7 @@ export const UI = {
|
|||||||
/**
|
/**
|
||||||
* Tutorials
|
* Tutorials
|
||||||
*/
|
*/
|
||||||
|
tutorials_home_head: "Tutorial-Übersicht",
|
||||||
tutorials_assessment_task: "Aufgabe",
|
tutorials_assessment_task: "Aufgabe",
|
||||||
tutorials_hardware_head: "Für die Umsetzung benötigst du folgende Hardware:",
|
tutorials_hardware_head: "Für die Umsetzung benötigst du folgende Hardware:",
|
||||||
tutorials_hardware_moreInformation:
|
tutorials_hardware_moreInformation:
|
||||||
@ -202,7 +209,9 @@ export const UI = {
|
|||||||
/**
|
/**
|
||||||
* Tutorial Builder
|
* Tutorial Builder
|
||||||
*/
|
*/
|
||||||
|
builder_createNew: "neues Tutorial erstellen",
|
||||||
|
builder_changeExisting: "bestehendes Tutorial ändern",
|
||||||
|
builder_deleteExisting: "bestehendes Tutorial löschen",
|
||||||
builder_solution: "Lösung",
|
builder_solution: "Lösung",
|
||||||
builder_solution_submit: "Lösung einreichen",
|
builder_solution_submit: "Lösung einreichen",
|
||||||
builder_example_submit: "Beispiel einreichen",
|
builder_example_submit: "Beispiel einreichen",
|
||||||
@ -230,7 +239,7 @@ export const UI = {
|
|||||||
|
|
||||||
navbar_tutorials: "Tutorials",
|
navbar_tutorials: "Tutorials",
|
||||||
navbar_tutorialbuilder: "Tutorial erstellen",
|
navbar_tutorialbuilder: "Tutorial erstellen",
|
||||||
navbar_gallery: "Gallerie",
|
navbar_gallery: "Galerie",
|
||||||
navbar_projects: "Projekte",
|
navbar_projects: "Projekte",
|
||||||
|
|
||||||
navbar_menu: "Menü",
|
navbar_menu: "Menü",
|
||||||
|
@ -3,7 +3,6 @@ export const FAQ = {
|
|||||||
* FAQ
|
* FAQ
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
faq_q1_question: `How can I copy my program to the senseBox?`,
|
faq_q1_question: `How can I copy my program to the senseBox?`,
|
||||||
faq_q1_answer: `To copy programs to the senseBox, connect it to the computer with the Micro USB cable. Then double click on the red reset button on the senseBox MCU. The senseBox will now be recognized as a removable disk on your computer and the previously created programs can be copied via drag & drop. After each change of the program code the program must be recompiled and transferred again.
|
faq_q1_answer: `To copy programs to the senseBox, connect it to the computer with the Micro USB cable. Then double click on the red reset button on the senseBox MCU. The senseBox will now be recognized as a removable disk on your computer and the previously created programs can be copied via drag & drop. After each change of the program code the program must be recompiled and transferred again.
|
||||||
#### Activate learning mode of the MCU
|
#### Activate learning mode of the MCU
|
||||||
@ -20,10 +19,10 @@ Copying programs under MacOS does not work via the Finder, but there are still t
|
|||||||
Basically the programming environment can be used with any senseBox with senseBox MCU.
|
Basically the programming environment can be used with any senseBox with senseBox MCU.
|
||||||
`,
|
`,
|
||||||
|
|
||||||
|
|
||||||
faq_q3_question: `I found an error or something is not working. Where can I report it?`,
|
faq_q3_question: `I found an error or something is not working. Where can I report it?`,
|
||||||
faq_q3_answer: `
|
faq_q3_answer: `
|
||||||
The best way to do this is to create an issue on [Github](https://github.com/sensebox/React-Ardublockly/issues). Alternatively you can send us an email to info(at)sensebox.de
|
The best way to do this is to create an issue on [Github](https://github.com/sensebox/React-Ardublockly/issues). Alternatively you can send us an email to info(at)sensebox.de
|
||||||
`,
|
`,
|
||||||
|
faq_tablet_question: `Can I program the senseBox with a tablet?`,
|
||||||
}
|
faq_tablet_answer: `Yes! Install the senseBox Connect app from the App Store and call up the learning and programming environment in your browser on the tablet. Detailed information on how to use the app can be found at [https://sensebox.de/app](https://sensebox.de/app)`,
|
||||||
|
};
|
||||||
|
@ -1,8 +1,5 @@
|
|||||||
export const LED = {
|
export const LED = {
|
||||||
|
senseBox_led: "LED connected to",
|
||||||
|
|
||||||
|
|
||||||
senseBox_led: "LED connected to digital",
|
|
||||||
senseBox_led_tip: "simple LED. Don't forget the resistor",
|
senseBox_led_tip: "simple LED. Don't forget the resistor",
|
||||||
|
|
||||||
senseBox_rgb_led: "RGB-LED",
|
senseBox_rgb_led: "RGB-LED",
|
||||||
@ -15,8 +12,10 @@ export const LED = {
|
|||||||
senseBox_ws2818_rgb_led_init: "Initialise RGB LED (WS2818)",
|
senseBox_ws2818_rgb_led_init: "Initialise RGB LED (WS2818)",
|
||||||
senseBox_ws2818_rgb_led_position: "Position",
|
senseBox_ws2818_rgb_led_position: "Position",
|
||||||
senseBox_ws2818_rgb_led_brightness: "Brightness",
|
senseBox_ws2818_rgb_led_brightness: "Brightness",
|
||||||
senseBox_ws2818_rgb_led_tooltip: "Change the color of your RGB LED with this block. Link a block for the color. If multiple RGB LEDs are chained together you can use the position to determine which LED is controlled.",
|
senseBox_ws2818_rgb_led_tooltip:
|
||||||
senseBox_ws2818_rgb_led_init_tooltip: "Connect the RGB LED to one of the three **digital/analog ports**. If multiple RGB LEDs are daisy-chained together you can determine which LED is controlled by position.",
|
"Change the color of your RGB LED with this block. Link a block for the color. If multiple RGB LEDs are chained together you can use the position to determine which LED is controlled.",
|
||||||
|
senseBox_ws2818_rgb_led_init_tooltip:
|
||||||
|
"Connect the RGB LED to one of the three **digital/analog ports**. If multiple RGB LEDs are daisy-chained together you can determine which LED is controlled by position.",
|
||||||
senseBox_ws2818_rgb_led_color: "Color",
|
senseBox_ws2818_rgb_led_color: "Color",
|
||||||
senseBox_ws2818_rgb_led_number: "Number",
|
senseBox_ws2818_rgb_led_number: "Number",
|
||||||
|
|
||||||
@ -29,7 +28,8 @@ export const LED = {
|
|||||||
COLOUR_BLEND_HELPURL: "http://meyerweb.com/eric/tools/color-blend/",
|
COLOUR_BLEND_HELPURL: "http://meyerweb.com/eric/tools/color-blend/",
|
||||||
COLOUR_BLEND_RATIO: "ratio",
|
COLOUR_BLEND_RATIO: "ratio",
|
||||||
COLOUR_BLEND_TITLE: "blend",
|
COLOUR_BLEND_TITLE: "blend",
|
||||||
COLOUR_BLEND_TOOLTIP: "Blends two colours together with a given ratio (0.0 - 1.0).",
|
COLOUR_BLEND_TOOLTIP:
|
||||||
|
"Blends two colours together with a given ratio (0.0 - 1.0).",
|
||||||
COLOUR_PICKER_HELPURL: "https://en.wikipedia.org/wiki/Color",
|
COLOUR_PICKER_HELPURL: "https://en.wikipedia.org/wiki/Color",
|
||||||
COLOUR_PICKER_TOOLTIP: "Choose a colour from the palette.",
|
COLOUR_PICKER_TOOLTIP: "Choose a colour from the palette.",
|
||||||
COLOUR_RANDOM_HELPURL: "http://randomcolour.com",
|
COLOUR_RANDOM_HELPURL: "http://randomcolour.com",
|
||||||
@ -40,6 +40,6 @@ export const LED = {
|
|||||||
COLOUR_RGB_HELPURL: "http://www.december.com/html/spec/colorper.html",
|
COLOUR_RGB_HELPURL: "http://www.december.com/html/spec/colorper.html",
|
||||||
COLOUR_RGB_RED: "red",
|
COLOUR_RGB_RED: "red",
|
||||||
COLOUR_RGB_TITLE: "colour with",
|
COLOUR_RGB_TITLE: "colour with",
|
||||||
COLOUR_RGB_TOOLTIP: "Create a colour with the specified amount of red, green, and blue. All values must be between 0 and 255.",
|
COLOUR_RGB_TOOLTIP:
|
||||||
|
"Create a colour with the specified amount of red, green, and blue. All values must be between 0 and 255.",
|
||||||
}
|
};
|
||||||
|
@ -49,6 +49,14 @@ export const UI = {
|
|||||||
tooltip_project_title: "Project title",
|
tooltip_project_title: "Project title",
|
||||||
tooltip_check_solution: "Check solution",
|
tooltip_check_solution: "Check solution",
|
||||||
tooltip_copy_code: "Copy Code to clipboard",
|
tooltip_copy_code: "Copy Code to clipboard",
|
||||||
|
tooltip_statistics_current: "Number of current blocks",
|
||||||
|
tooltip_statistics_new: "Number of new blocks",
|
||||||
|
tooltip_statistics_changed: "Number of changed blocks",
|
||||||
|
tooltip_statistics_moved: "Number of moved blocks",
|
||||||
|
tooltip_statistics_deleted: "Number of deleted blocks",
|
||||||
|
tooltip_statistics_remaining: "Remaining blocks",
|
||||||
|
tooltip_statistics_show: "Show statistics",
|
||||||
|
tooltip_start_tour: "start Tour",
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Messages
|
* Messages
|
||||||
@ -183,7 +191,7 @@ export const UI = {
|
|||||||
/**
|
/**
|
||||||
* Tutorials
|
* Tutorials
|
||||||
*/
|
*/
|
||||||
|
tutorials_home_head: "Tutorials",
|
||||||
tutorials_assessment_task: "Task",
|
tutorials_assessment_task: "Task",
|
||||||
tutorials_hardware_head:
|
tutorials_hardware_head:
|
||||||
"For the implementation you need the following hardware:",
|
"For the implementation you need the following hardware:",
|
||||||
@ -196,7 +204,9 @@ export const UI = {
|
|||||||
/**
|
/**
|
||||||
* Tutorial Builder
|
* Tutorial Builder
|
||||||
*/
|
*/
|
||||||
|
uilder_createNew: "create new Tutorial",
|
||||||
|
builder_changeExisting: "change existing Tutorial",
|
||||||
|
builder_deleteExisting: "remove existing Tutorial",
|
||||||
builder_solution: "Solution",
|
builder_solution: "Solution",
|
||||||
builder_solution_submit: "Submit Solution",
|
builder_solution_submit: "Submit Solution",
|
||||||
builder_example_submit: "Submit example",
|
builder_example_submit: "Submit example",
|
||||||
|
@ -12,6 +12,8 @@ import BlocklyWindow from "./Blockly/BlocklyWindow";
|
|||||||
import CodeViewer from "./CodeViewer";
|
import CodeViewer from "./CodeViewer";
|
||||||
import TrashcanButtons from "./Workspace/TrashcanButtons";
|
import TrashcanButtons from "./Workspace/TrashcanButtons";
|
||||||
import HintTutorialExists from "./Tutorial/HintTutorialExists";
|
import HintTutorialExists from "./Tutorial/HintTutorialExists";
|
||||||
|
import Snackbar from "./Snackbar";
|
||||||
|
|
||||||
|
|
||||||
import Grid from "@material-ui/core/Grid";
|
import Grid from "@material-ui/core/Grid";
|
||||||
import IconButton from "@material-ui/core/IconButton";
|
import IconButton from "@material-ui/core/IconButton";
|
||||||
@ -136,14 +138,18 @@ class Home extends Component {
|
|||||||
style={{ position: "relative" }}
|
style={{ position: "relative" }}
|
||||||
>
|
>
|
||||||
<Tooltip
|
<Tooltip
|
||||||
title={this.state.codeOn ? "Code ausblenden" : "Code anzeigen"}
|
title={
|
||||||
|
this.state.codeOn
|
||||||
|
? Blockly.Msg.tooltip_hide_code
|
||||||
|
: Blockly.Msg.tooltip_show_code
|
||||||
|
}
|
||||||
>
|
>
|
||||||
<IconButton
|
<IconButton
|
||||||
className={`showCode ${
|
className={`showCode ${
|
||||||
this.state.codeOn
|
this.state.codeOn
|
||||||
? this.props.classes.codeOn
|
? this.props.classes.codeOn
|
||||||
: this.props.classes.codeOff
|
: this.props.classes.codeOff
|
||||||
}`}
|
}}
|
||||||
style={{
|
style={{
|
||||||
width: "40px",
|
width: "40px",
|
||||||
height: "40px",
|
height: "40px",
|
||||||
@ -213,6 +219,7 @@ Home.propTypes = {
|
|||||||
message: PropTypes.object.isRequired,
|
message: PropTypes.object.isRequired,
|
||||||
statistics: PropTypes.bool.isRequired,
|
statistics: PropTypes.bool.isRequired,
|
||||||
platform: PropTypes.object.isRequired,
|
platform: PropTypes.object.isRequired,
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const mapStateToProps = (state) => ({
|
const mapStateToProps = (state) => ({
|
||||||
|
@ -139,7 +139,7 @@ class Navbar extends Component {
|
|||||||
</Link>
|
</Link>
|
||||||
) : null}
|
) : null}
|
||||||
{isHome ? (
|
{isHome ? (
|
||||||
<Tooltip title="Hilfe starten" arrow>
|
<Tooltip title={Blockly.Msg.tooltip_start_tour} arrow>
|
||||||
<IconButton
|
<IconButton
|
||||||
color="inherit"
|
color="inherit"
|
||||||
className={`openTour ${this.props.classes.button}`}
|
className={`openTour ${this.props.classes.button}`}
|
||||||
@ -153,7 +153,7 @@ class Navbar extends Component {
|
|||||||
</Tooltip>
|
</Tooltip>
|
||||||
) : null}
|
) : null}
|
||||||
{isAssessment ? (
|
{isAssessment ? (
|
||||||
<Tooltip title="Hilfe starten" arrow>
|
<Tooltip title={Blockly.Msg.tooltip_start_tour} arrow>
|
||||||
<IconButton
|
<IconButton
|
||||||
color="inherit"
|
color="inherit"
|
||||||
className={`openTour ${this.props.classes.button}`}
|
className={`openTour ${this.props.classes.button}`}
|
||||||
|
@ -39,6 +39,7 @@ import InputLabel from "@material-ui/core/InputLabel";
|
|||||||
import MenuItem from "@material-ui/core/MenuItem";
|
import MenuItem from "@material-ui/core/MenuItem";
|
||||||
import FormControl from "@material-ui/core/FormControl";
|
import FormControl from "@material-ui/core/FormControl";
|
||||||
import Select from "@material-ui/core/Select";
|
import Select from "@material-ui/core/Select";
|
||||||
|
import * as Blockly from "blockly";
|
||||||
|
|
||||||
const styles = (theme) => ({
|
const styles = (theme) => ({
|
||||||
backdrop: {
|
backdrop: {
|
||||||
@ -392,7 +393,7 @@ class Builder extends Component {
|
|||||||
style={{ color: "black" }}
|
style={{ color: "black" }}
|
||||||
value="new"
|
value="new"
|
||||||
control={<Radio color="primary" />}
|
control={<Radio color="primary" />}
|
||||||
label="neues Tutorial erstellen"
|
label={Blockly.Msg.builder_createNew}
|
||||||
labelPlacement="end"
|
labelPlacement="end"
|
||||||
/>
|
/>
|
||||||
{filteredTutorials.length > 0 ? (
|
{filteredTutorials.length > 0 ? (
|
||||||
@ -402,7 +403,7 @@ class Builder extends Component {
|
|||||||
disabled={this.props.index === 0}
|
disabled={this.props.index === 0}
|
||||||
value="change"
|
value="change"
|
||||||
control={<Radio color="primary" />}
|
control={<Radio color="primary" />}
|
||||||
label="bestehendes Tutorial ändern"
|
label={Blockly.Msg.builder_changeExisting}
|
||||||
labelPlacement="end"
|
labelPlacement="end"
|
||||||
/>
|
/>
|
||||||
<FormControlLabel
|
<FormControlLabel
|
||||||
@ -410,7 +411,7 @@ class Builder extends Component {
|
|||||||
disabled={this.props.index === 0}
|
disabled={this.props.index === 0}
|
||||||
value="delete"
|
value="delete"
|
||||||
control={<Radio color="primary" />}
|
control={<Radio color="primary" />}
|
||||||
label="bestehendes Tutorial löschen"
|
label={Blockly.Msg.builder_deleteExisting}
|
||||||
labelPlacement="end"
|
labelPlacement="end"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,56 +1,59 @@
|
|||||||
import React, { Component } from 'react';
|
import React, { Component } from "react";
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from "prop-types";
|
||||||
import { connect } from 'react-redux';
|
import { connect } from "react-redux";
|
||||||
import { getTutorials, resetTutorial, tutorialProgress } from '../../actions/tutorialActions';
|
import {
|
||||||
import { clearMessages } from '../../actions/messageActions';
|
getTutorials,
|
||||||
|
resetTutorial,
|
||||||
|
tutorialProgress,
|
||||||
|
} from "../../actions/tutorialActions";
|
||||||
|
import { clearMessages } from "../../actions/messageActions";
|
||||||
|
|
||||||
import clsx from 'clsx';
|
import clsx from "clsx";
|
||||||
|
|
||||||
import Breadcrumbs from '../Breadcrumbs';
|
import Breadcrumbs from "../Breadcrumbs";
|
||||||
|
|
||||||
import { Link } from 'react-router-dom';
|
import { Link } from "react-router-dom";
|
||||||
|
|
||||||
import { fade } from '@material-ui/core/styles/colorManipulator';
|
import { fade } from "@material-ui/core/styles/colorManipulator";
|
||||||
import { withStyles } from '@material-ui/core/styles';
|
import { withStyles } from "@material-ui/core/styles";
|
||||||
import Grid from '@material-ui/core/Grid';
|
import Grid from "@material-ui/core/Grid";
|
||||||
import Paper from '@material-ui/core/Paper';
|
import Paper from "@material-ui/core/Paper";
|
||||||
import Typography from '@material-ui/core/Typography';
|
import Typography from "@material-ui/core/Typography";
|
||||||
|
|
||||||
import { faCheck, faTimes } from "@fortawesome/free-solid-svg-icons";
|
import { faCheck, faTimes } from "@fortawesome/free-solid-svg-icons";
|
||||||
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
||||||
|
import * as Blockly from "blockly";
|
||||||
|
|
||||||
const styles = (theme) => ({
|
const styles = (theme) => ({
|
||||||
outerDiv: {
|
outerDiv: {
|
||||||
position: 'absolute',
|
position: "absolute",
|
||||||
right: '-30px',
|
right: "-30px",
|
||||||
bottom: '-30px',
|
bottom: "-30px",
|
||||||
width: '160px',
|
width: "160px",
|
||||||
height: '160px',
|
height: "160px",
|
||||||
color: fade(theme.palette.secondary.main, 0.6)
|
color: fade(theme.palette.secondary.main, 0.6),
|
||||||
},
|
},
|
||||||
outerDivError: {
|
outerDivError: {
|
||||||
stroke: fade(theme.palette.error.dark, 0.6),
|
stroke: fade(theme.palette.error.dark, 0.6),
|
||||||
color: fade(theme.palette.error.dark, 0.6)
|
color: fade(theme.palette.error.dark, 0.6),
|
||||||
},
|
},
|
||||||
outerDivSuccess: {
|
outerDivSuccess: {
|
||||||
stroke: fade(theme.palette.primary.main, 0.6),
|
stroke: fade(theme.palette.primary.main, 0.6),
|
||||||
color: fade(theme.palette.primary.main, 0.6)
|
color: fade(theme.palette.primary.main, 0.6),
|
||||||
},
|
},
|
||||||
outerDivOther: {
|
outerDivOther: {
|
||||||
stroke: fade(theme.palette.secondary.main, 0.6)
|
stroke: fade(theme.palette.secondary.main, 0.6),
|
||||||
},
|
},
|
||||||
innerDiv: {
|
innerDiv: {
|
||||||
width: 'inherit',
|
width: "inherit",
|
||||||
height: 'inherit',
|
height: "inherit",
|
||||||
display: 'table-cell',
|
display: "table-cell",
|
||||||
verticalAlign: 'middle',
|
verticalAlign: "middle",
|
||||||
textAlign: 'center'
|
textAlign: "center",
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
class TutorialHome extends Component {
|
class TutorialHome extends Component {
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
this.props.tutorialProgress();
|
this.props.tutorialProgress();
|
||||||
// retrieve tutorials only if a potential user is loaded - authentication
|
// retrieve tutorials only if a potential user is loaded - authentication
|
||||||
@ -65,7 +68,7 @@ class TutorialHome extends Component {
|
|||||||
// authentication is completed
|
// authentication is completed
|
||||||
this.props.getTutorials();
|
this.props.getTutorials();
|
||||||
}
|
}
|
||||||
if(this.props.message.id === 'GET_TUTORIALS_FAIL'){
|
if (this.props.message.id === "GET_TUTORIALS_FAIL") {
|
||||||
alert(this.props.message.msg);
|
alert(this.props.message.msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -78,52 +81,144 @@ class TutorialHome extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
return (
|
return this.props.isLoading ? null : (
|
||||||
this.props.isLoading ? null :
|
|
||||||
<div>
|
<div>
|
||||||
<Breadcrumbs content={[{ link: '/tutorial', title: 'Tutorial' }]} />
|
<Breadcrumbs content={[{ link: "/tutorial", title: "Tutorial" }]} />
|
||||||
|
|
||||||
<h1>Tutorial-Übersicht</h1>
|
<h1>{Blockly.Msg.tutorials_home_head}</h1>
|
||||||
<Grid container spacing={2}>
|
<Grid container spacing={2}>
|
||||||
{this.props.tutorials.map((tutorial, i) => {
|
{this.props.tutorials.map((tutorial, i) => {
|
||||||
var status = this.props.status.filter(status => status._id === tutorial._id)[0];
|
var status = this.props.status.filter(
|
||||||
|
(status) => status._id === tutorial._id
|
||||||
|
)[0];
|
||||||
var tasks = status.tasks;
|
var tasks = status.tasks;
|
||||||
var error = status.tasks.filter(task => task.type === 'error').length > 0;
|
var error =
|
||||||
var success = status.tasks.filter(task => task.type === 'success').length / tasks.length
|
status.tasks.filter((task) => task.type === "error").length > 0;
|
||||||
var tutorialStatus = success === 1 ? 'Success' : error ? 'Error' : 'Other';
|
var success =
|
||||||
|
status.tasks.filter((task) => task.type === "success").length /
|
||||||
|
tasks.length;
|
||||||
|
var tutorialStatus =
|
||||||
|
success === 1 ? "Success" : error ? "Error" : "Other";
|
||||||
return (
|
return (
|
||||||
<Grid item xs={12} sm={6} md={4} xl={3} key={i} style={{}}>
|
<Grid item xs={12} sm={6} md={4} xl={3} key={i} style={{}}>
|
||||||
<Link to={`/tutorial/${tutorial._id}`} style={{ textDecoration: 'none', color: 'inherit' }}>
|
<Link
|
||||||
<Paper style={{ height: '150px', padding: '10px', position: 'relative', overflow: 'hidden' }}>
|
to={`/tutorial/${tutorial._id}`}
|
||||||
|
style={{ textDecoration: "none", color: "inherit" }}
|
||||||
|
>
|
||||||
|
<Paper
|
||||||
|
style={{
|
||||||
|
height: "150px",
|
||||||
|
padding: "10px",
|
||||||
|
position: "relative",
|
||||||
|
overflow: "hidden",
|
||||||
|
}}
|
||||||
|
>
|
||||||
{tutorial.title}
|
{tutorial.title}
|
||||||
<div className={clsx(this.props.classes.outerDiv)} style={{ width: '160px', height: '160px', border: 0 }}>
|
<div
|
||||||
<svg style={{ width: '100%', height: '100%' }}>
|
className={clsx(this.props.classes.outerDiv)}
|
||||||
{error || success === 1 ?
|
style={{ width: "160px", height: "160px", border: 0 }}
|
||||||
<circle className={error ? this.props.classes.outerDivError : this.props.classes.outerDivSuccess} style={{ transform: 'rotate(-44deg)', transformOrigin: "50% 50%" }} r="75" cx="50%" cy="50%" fill="none" stroke-width="10"></circle>
|
>
|
||||||
: <circle className={this.props.classes.outerDivOther} style={{ transform: 'rotate(-44deg)', transformOrigin: "50% 50%" }} r="75" cx="50%" cy="50%" fill="none" stroke-width="10" stroke-dashoffset={`${(75 * 2 * Math.PI) * (1 - (50 / 100 + success / 2))}`} stroke-dasharray={`${(75 * 2 * Math.PI) * (1 - (50 / 100 - success / 2))} ${(75 * 2 * Math.PI) * (1 - (50 / 100 + success / 2))}`}></circle>}
|
<svg style={{ width: "100%", height: "100%" }}>
|
||||||
{success < 1 && !error ?
|
{error || success === 1 ? (
|
||||||
<circle className={this.props.classes.outerDivSuccess} style={{ transform: 'rotate(-44deg)', transformOrigin: "50% 50%" }} r="75" cx="50%" cy="50%" fill="none" stroke-width="10" stroke-dashoffset={`${(75 * 2 * Math.PI) * (1 - (50 / 100 + success / 2))}`} stroke-dasharray={`${(75 * 2 * Math.PI)}`}>
|
<circle
|
||||||
</circle>
|
className={
|
||||||
: null}
|
error
|
||||||
|
? this.props.classes.outerDivError
|
||||||
|
: this.props.classes.outerDivSuccess
|
||||||
|
}
|
||||||
|
style={{
|
||||||
|
transform: "rotate(-44deg)",
|
||||||
|
transformOrigin: "50% 50%",
|
||||||
|
}}
|
||||||
|
r="75"
|
||||||
|
cx="50%"
|
||||||
|
cy="50%"
|
||||||
|
fill="none"
|
||||||
|
stroke-width="10"
|
||||||
|
></circle>
|
||||||
|
) : (
|
||||||
|
<circle
|
||||||
|
className={this.props.classes.outerDivOther}
|
||||||
|
style={{
|
||||||
|
transform: "rotate(-44deg)",
|
||||||
|
transformOrigin: "50% 50%",
|
||||||
|
}}
|
||||||
|
r="75"
|
||||||
|
cx="50%"
|
||||||
|
cy="50%"
|
||||||
|
fill="none"
|
||||||
|
stroke-width="10"
|
||||||
|
stroke-dashoffset={`${
|
||||||
|
75 * 2 * Math.PI * (1 - (50 / 100 + success / 2))
|
||||||
|
}`}
|
||||||
|
stroke-dasharray={`${
|
||||||
|
75 * 2 * Math.PI * (1 - (50 / 100 - success / 2))
|
||||||
|
} ${
|
||||||
|
75 * 2 * Math.PI * (1 - (50 / 100 + success / 2))
|
||||||
|
}`}
|
||||||
|
></circle>
|
||||||
|
)}
|
||||||
|
{success < 1 && !error ? (
|
||||||
|
<circle
|
||||||
|
className={this.props.classes.outerDivSuccess}
|
||||||
|
style={{
|
||||||
|
transform: "rotate(-44deg)",
|
||||||
|
transformOrigin: "50% 50%",
|
||||||
|
}}
|
||||||
|
r="75"
|
||||||
|
cx="50%"
|
||||||
|
cy="50%"
|
||||||
|
fill="none"
|
||||||
|
stroke-width="10"
|
||||||
|
stroke-dashoffset={`${
|
||||||
|
75 * 2 * Math.PI * (1 - (50 / 100 + success / 2))
|
||||||
|
}`}
|
||||||
|
stroke-dasharray={`${75 * 2 * Math.PI}`}
|
||||||
|
></circle>
|
||||||
|
) : null}
|
||||||
</svg>
|
</svg>
|
||||||
</div>
|
</div>
|
||||||
<div className={clsx(this.props.classes.outerDiv, tutorialStatus === 'Error' ? this.props.classes.outerDivError : tutorialStatus === 'Success' ? this.props.classes.outerDivSuccess : null)}>
|
<div
|
||||||
|
className={clsx(
|
||||||
|
this.props.classes.outerDiv,
|
||||||
|
tutorialStatus === "Error"
|
||||||
|
? this.props.classes.outerDivError
|
||||||
|
: tutorialStatus === "Success"
|
||||||
|
? this.props.classes.outerDivSuccess
|
||||||
|
: null
|
||||||
|
)}
|
||||||
|
>
|
||||||
<div className={this.props.classes.innerDiv}>
|
<div className={this.props.classes.innerDiv}>
|
||||||
{error || success === 1 ?
|
{error || success === 1 ? (
|
||||||
<FontAwesomeIcon size='4x' icon={tutorialStatus === 'Success' ? faCheck : faTimes} />
|
<FontAwesomeIcon
|
||||||
: <Typography variant='h3' className={success > 0 ? this.props.classes.outerDivSuccess : {}}>{Math.round(success * 100)}%</Typography>
|
size="4x"
|
||||||
|
icon={
|
||||||
|
tutorialStatus === "Success" ? faCheck : faTimes
|
||||||
}
|
}
|
||||||
|
/>
|
||||||
|
) : (
|
||||||
|
<Typography
|
||||||
|
variant="h3"
|
||||||
|
className={
|
||||||
|
success > 0
|
||||||
|
? this.props.classes.outerDivSuccess
|
||||||
|
: {}
|
||||||
|
}
|
||||||
|
>
|
||||||
|
{Math.round(success * 100)}%
|
||||||
|
</Typography>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</Paper>
|
</Paper>
|
||||||
</Link>
|
</Link>
|
||||||
</Grid>
|
</Grid>
|
||||||
)
|
);
|
||||||
})}
|
})}
|
||||||
</Grid>
|
</Grid>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TutorialHome.propTypes = {
|
TutorialHome.propTypes = {
|
||||||
@ -136,16 +231,21 @@ TutorialHome.propTypes = {
|
|||||||
tutorials: PropTypes.array.isRequired,
|
tutorials: PropTypes.array.isRequired,
|
||||||
isLoading: PropTypes.bool.isRequired,
|
isLoading: PropTypes.bool.isRequired,
|
||||||
message: PropTypes.object.isRequired,
|
message: PropTypes.object.isRequired,
|
||||||
progress: PropTypes.bool.isRequired
|
progress: PropTypes.bool.isRequired,
|
||||||
};
|
};
|
||||||
|
|
||||||
const mapStateToProps = state => ({
|
const mapStateToProps = (state) => ({
|
||||||
change: state.tutorial.change,
|
change: state.tutorial.change,
|
||||||
status: state.tutorial.status,
|
status: state.tutorial.status,
|
||||||
tutorials: state.tutorial.tutorials,
|
tutorials: state.tutorial.tutorials,
|
||||||
isLoading: state.tutorial.progress,
|
isLoading: state.tutorial.progress,
|
||||||
message: state.message,
|
message: state.message,
|
||||||
progress: state.auth.progress
|
progress: state.auth.progress,
|
||||||
});
|
});
|
||||||
|
|
||||||
export default connect(mapStateToProps, { getTutorials, resetTutorial, clearMessages, tutorialProgress })(withStyles(styles, { withTheme: true })(TutorialHome));
|
export default connect(mapStateToProps, {
|
||||||
|
getTutorials,
|
||||||
|
resetTutorial,
|
||||||
|
clearMessages,
|
||||||
|
tutorialProgress,
|
||||||
|
})(withStyles(styles, { withTheme: true })(TutorialHome));
|
||||||
|
@ -124,6 +124,7 @@ export class Login extends Component {
|
|||||||
type={this.state.type}
|
type={this.state.type}
|
||||||
key={this.state.key}
|
key={this.state.key}
|
||||||
/>
|
/>
|
||||||
|
<form onSubmit={this.onSubmit}>
|
||||||
<TextField
|
<TextField
|
||||||
style={{ marginBottom: "10px" }}
|
style={{ marginBottom: "10px" }}
|
||||||
// variant='outlined'
|
// variant='outlined'
|
||||||
@ -163,7 +164,7 @@ export class Login extends Component {
|
|||||||
<Button
|
<Button
|
||||||
color="primary"
|
color="primary"
|
||||||
variant="contained"
|
variant="contained"
|
||||||
onClick={this.onSubmit}
|
type="submit"
|
||||||
style={{ width: "100%" }}
|
style={{ width: "100%" }}
|
||||||
>
|
>
|
||||||
{this.props.progress ? (
|
{this.props.progress ? (
|
||||||
@ -175,6 +176,7 @@ export class Login extends Component {
|
|||||||
)}
|
)}
|
||||||
</Button>
|
</Button>
|
||||||
</p>
|
</p>
|
||||||
|
</form>
|
||||||
<p style={{ textAlign: "center", fontSize: "0.8rem" }}>
|
<p style={{ textAlign: "center", fontSize: "0.8rem" }}>
|
||||||
<Link
|
<Link
|
||||||
rel="noreferrer"
|
rel="noreferrer"
|
||||||
|
@ -1,117 +1,176 @@
|
|||||||
import React, { Component } from 'react';
|
import React, { Component } from "react";
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from "prop-types";
|
||||||
import { connect } from 'react-redux';
|
import { connect } from "react-redux";
|
||||||
|
|
||||||
import * as Blockly from 'blockly/core';
|
import * as Blockly from "blockly/core";
|
||||||
|
|
||||||
import withWidth, { isWidthDown } from '@material-ui/core/withWidth';
|
import withWidth, { isWidthDown } from "@material-ui/core/withWidth";
|
||||||
import { withStyles } from '@material-ui/core/styles';
|
import { withStyles } from "@material-ui/core/styles";
|
||||||
import Tooltip from '@material-ui/core/Tooltip';
|
import Tooltip from "@material-ui/core/Tooltip";
|
||||||
import IconButton from '@material-ui/core/IconButton';
|
import IconButton from "@material-ui/core/IconButton";
|
||||||
import Chip from '@material-ui/core/Chip';
|
import Chip from "@material-ui/core/Chip";
|
||||||
import Avatar from '@material-ui/core/Avatar';
|
import Avatar from "@material-ui/core/Avatar";
|
||||||
import Popover from '@material-ui/core/Popover';
|
import Popover from "@material-ui/core/Popover";
|
||||||
|
|
||||||
import { faPuzzlePiece, faTrash, faPlus, faPen, faArrowsAlt, faEllipsisH } from "@fortawesome/free-solid-svg-icons";
|
import {
|
||||||
|
faPuzzlePiece,
|
||||||
|
faTrash,
|
||||||
|
faPlus,
|
||||||
|
faPen,
|
||||||
|
faArrowsAlt,
|
||||||
|
faEllipsisH,
|
||||||
|
} from "@fortawesome/free-solid-svg-icons";
|
||||||
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
||||||
|
|
||||||
const styles = (theme) => ({
|
const styles = (theme) => ({
|
||||||
stats: {
|
stats: {
|
||||||
backgroundColor: theme.palette.primary.main,
|
backgroundColor: theme.palette.primary.main,
|
||||||
display: 'inline',
|
display: "inline",
|
||||||
marginLeft: '50px',
|
marginLeft: "50px",
|
||||||
padding: '3px 10px',
|
padding: "3px 10px",
|
||||||
// borderRadius: '25%'
|
// borderRadius: '25%'
|
||||||
},
|
},
|
||||||
menu: {
|
menu: {
|
||||||
backgroundColor: theme.palette.secondary.main,
|
backgroundColor: theme.palette.secondary.main,
|
||||||
color: theme.palette.secondary.contrastText,
|
color: theme.palette.secondary.contrastText,
|
||||||
width: '40px',
|
width: "40px",
|
||||||
height: '40px',
|
height: "40px",
|
||||||
'&:hover': {
|
"&:hover": {
|
||||||
backgroundColor: theme.palette.secondary.main,
|
backgroundColor: theme.palette.secondary.main,
|
||||||
color: theme.palette.primary.main,
|
color: theme.palette.primary.main,
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
class WorkspaceStats extends Component {
|
class WorkspaceStats extends Component {
|
||||||
|
|
||||||
state = {
|
state = {
|
||||||
anchor: null
|
anchor: null,
|
||||||
}
|
};
|
||||||
|
|
||||||
handleClose = () => {
|
handleClose = () => {
|
||||||
this.setState({ anchor: null });
|
this.setState({ anchor: null });
|
||||||
}
|
};
|
||||||
|
|
||||||
handleClick = (event) => {
|
handleClick = (event) => {
|
||||||
this.setState({ anchor: event.currentTarget });
|
this.setState({ anchor: event.currentTarget });
|
||||||
};
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
const bigDisplay = !isWidthDown("sm", this.props.width);
|
||||||
const bigDisplay = !isWidthDown('sm', this.props.width);
|
|
||||||
const workspace = Blockly.getMainWorkspace();
|
const workspace = Blockly.getMainWorkspace();
|
||||||
const remainingBlocksInfinity = workspace ? workspace.remainingCapacity() !== Infinity : null;
|
const remainingBlocksInfinity = workspace
|
||||||
const stats = <div style={bigDisplay ? { display: 'flex' } : { display: 'inline' }}>
|
? workspace.remainingCapacity() !== Infinity
|
||||||
<Tooltip title="Anzahl aktueller Blöcke" arrow>
|
: null;
|
||||||
|
const stats = (
|
||||||
|
<div style={bigDisplay ? { display: "flex" } : { display: "inline" }}>
|
||||||
|
<Tooltip title={Blockly.Msg.tooltip_statistics_current} arrow>
|
||||||
<Chip
|
<Chip
|
||||||
style={bigDisplay ? { marginRight: '1rem' } : { marginRight: '1rem', marginBottom: '5px' }}
|
style={
|
||||||
|
bigDisplay
|
||||||
|
? { marginRight: "1rem" }
|
||||||
|
: { marginRight: "1rem", marginBottom: "5px" }
|
||||||
|
}
|
||||||
color="primary"
|
color="primary"
|
||||||
avatar={<Avatar><FontAwesomeIcon icon={faPuzzlePiece} /></Avatar>}
|
avatar={
|
||||||
label={workspace ? workspace.getAllBlocks().length : 0}>
|
<Avatar>
|
||||||
|
<FontAwesomeIcon icon={faPuzzlePiece} />
|
||||||
|
</Avatar>
|
||||||
|
}
|
||||||
|
label={workspace ? workspace.getAllBlocks().length : 0}
|
||||||
|
></Chip>
|
||||||
|
</Tooltip>
|
||||||
|
<Tooltip title={Blockly.Msg.tooltip_statistics_new} arrow>
|
||||||
|
<Chip
|
||||||
|
style={
|
||||||
|
bigDisplay
|
||||||
|
? { marginRight: "1rem" }
|
||||||
|
: { marginRight: "1rem", marginBottom: "5px" }
|
||||||
|
}
|
||||||
|
color="primary"
|
||||||
|
avatar={
|
||||||
|
<Avatar>
|
||||||
|
<FontAwesomeIcon icon={faPlus} />
|
||||||
|
</Avatar>
|
||||||
|
}
|
||||||
|
label={this.props.create > 0 ? this.props.create : 0}
|
||||||
|
>
|
||||||
|
{" "}
|
||||||
|
{/* initialXML is created automatically, Block is not part of the statistics */}
|
||||||
</Chip>
|
</Chip>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
<Tooltip title="Anzahl neuer Blöcke" arrow>
|
<Tooltip title={Blockly.Msg.tooltip_statistics_changed} arrow>
|
||||||
<Chip
|
<Chip
|
||||||
style={bigDisplay ? { marginRight: '1rem' } : { marginRight: '1rem', marginBottom: '5px' }}
|
style={
|
||||||
|
bigDisplay
|
||||||
|
? { marginRight: "1rem" }
|
||||||
|
: { marginRight: "1rem", marginBottom: "5px" }
|
||||||
|
}
|
||||||
color="primary"
|
color="primary"
|
||||||
avatar={<Avatar><FontAwesomeIcon icon={faPlus} /></Avatar>}
|
avatar={
|
||||||
label={this.props.create > 0 ? this.props.create : 0}> {/* initialXML is created automatically, Block is not part of the statistics */}
|
<Avatar>
|
||||||
|
<FontAwesomeIcon icon={faPen} />
|
||||||
|
</Avatar>
|
||||||
|
}
|
||||||
|
label={this.props.change}
|
||||||
|
></Chip>
|
||||||
|
</Tooltip>
|
||||||
|
<Tooltip title={Blockly.Msg.tooltip_statistics_moved} arrow>
|
||||||
|
<Chip
|
||||||
|
style={
|
||||||
|
bigDisplay
|
||||||
|
? { marginRight: "1rem" }
|
||||||
|
: { marginRight: "1rem", marginBottom: "5px" }
|
||||||
|
}
|
||||||
|
color="primary"
|
||||||
|
avatar={
|
||||||
|
<Avatar>
|
||||||
|
<FontAwesomeIcon icon={faArrowsAlt} />
|
||||||
|
</Avatar>
|
||||||
|
}
|
||||||
|
label={this.props.move > 0 ? this.props.move : 0}
|
||||||
|
>
|
||||||
|
{" "}
|
||||||
|
{/* initialXML is moved automatically, Block is not part of the statistics */}
|
||||||
</Chip>
|
</Chip>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
<Tooltip title="Anzahl veränderter Blöcke" arrow>
|
<Tooltip title={Blockly.Msg.tooltip_statistics_deleted} arrow>
|
||||||
<Chip
|
<Chip
|
||||||
style={bigDisplay ? { marginRight: '1rem' } : { marginRight: '1rem', marginBottom: '5px' }}
|
style={
|
||||||
|
remainingBlocksInfinity
|
||||||
|
? bigDisplay
|
||||||
|
? { marginRight: "1rem" }
|
||||||
|
: { marginRight: "1rem", marginBottom: "5px" }
|
||||||
|
: {}
|
||||||
|
}
|
||||||
color="primary"
|
color="primary"
|
||||||
avatar={<Avatar><FontAwesomeIcon icon={faPen} /></Avatar>}
|
avatar={
|
||||||
label={this.props.change}>
|
<Avatar>
|
||||||
</Chip>
|
<FontAwesomeIcon icon={faTrash} />
|
||||||
|
</Avatar>
|
||||||
|
}
|
||||||
|
label={this.props.delete}
|
||||||
|
></Chip>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
<Tooltip title="Anzahl bewegter Blöcke" arrow>
|
{remainingBlocksInfinity ? (
|
||||||
|
<Tooltip title={Blockly.Msg.tooltip_statistics_remaining} arrow>
|
||||||
<Chip
|
<Chip
|
||||||
style={bigDisplay ? { marginRight: '1rem' } : { marginRight: '1rem', marginBottom: '5px' }}
|
style={
|
||||||
|
bigDisplay
|
||||||
|
? { marginRight: "1rem" }
|
||||||
|
: { marginRight: "1rem", marginBottom: "5px" }
|
||||||
|
}
|
||||||
color="primary"
|
color="primary"
|
||||||
avatar={<Avatar><FontAwesomeIcon icon={faArrowsAlt} /></Avatar>}
|
label={workspace.remainingCapacity()}
|
||||||
label={this.props.move > 0 ? this.props.move : 0}> {/* initialXML is moved automatically, Block is not part of the statistics */}
|
></Chip>
|
||||||
</Chip>
|
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
<Tooltip title="Anzahl gelöschter Blöcke" arrow>
|
) : null}
|
||||||
<Chip
|
|
||||||
style={remainingBlocksInfinity ? bigDisplay ? { marginRight: '1rem' } : { marginRight: '1rem', marginBottom: '5px' } : {}}
|
|
||||||
color="primary"
|
|
||||||
avatar={<Avatar><FontAwesomeIcon icon={faTrash} /></Avatar>}
|
|
||||||
label={this.props.delete}>
|
|
||||||
</Chip>
|
|
||||||
</Tooltip>
|
|
||||||
{remainingBlocksInfinity ?
|
|
||||||
<Tooltip title="Verbleibende Blöcke" arrow>
|
|
||||||
<Chip
|
|
||||||
style={bigDisplay ? { marginRight: '1rem' } : { marginRight: '1rem', marginBottom: '5px' }}
|
|
||||||
color="primary"
|
|
||||||
label={workspace.remainingCapacity()}>
|
|
||||||
</Chip>
|
|
||||||
</Tooltip> : null}
|
|
||||||
</div>
|
</div>
|
||||||
return (
|
);
|
||||||
bigDisplay ?
|
return bigDisplay ? (
|
||||||
<div style={{ bottom: 0, position: 'absolute' }}>
|
<div style={{ bottom: 0, position: "absolute" }}>{stats}</div>
|
||||||
{stats}
|
) : (
|
||||||
</div>
|
|
||||||
:
|
|
||||||
<div>
|
<div>
|
||||||
<Tooltip title='Statistiken anzeigen' arrow>
|
<Tooltip title={Blockly.Msg.tooltip_statistics_show} arrow>
|
||||||
<IconButton
|
<IconButton
|
||||||
className={this.props.classes.menu}
|
className={this.props.classes.menu}
|
||||||
onClick={(event) => this.handleClick(event)}
|
onClick={(event) => this.handleClick(event)}
|
||||||
@ -124,24 +183,22 @@ class WorkspaceStats extends Component {
|
|||||||
anchorEl={this.state.anchor}
|
anchorEl={this.state.anchor}
|
||||||
onClose={this.handleClose}
|
onClose={this.handleClose}
|
||||||
anchorOrigin={{
|
anchorOrigin={{
|
||||||
vertical: 'bottom',
|
vertical: "bottom",
|
||||||
horizontal: 'center',
|
horizontal: "center",
|
||||||
}}
|
}}
|
||||||
transformOrigin={{
|
transformOrigin={{
|
||||||
vertical: 'top',
|
vertical: "top",
|
||||||
horizontal: 'center',
|
horizontal: "center",
|
||||||
}}
|
}}
|
||||||
PaperProps={{
|
PaperProps={{
|
||||||
style: { margin: '5px' }
|
style: { margin: "5px" },
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<div style={{ margin: '10px' }}>
|
<div style={{ margin: "10px" }}>{stats}</div>
|
||||||
{stats}
|
|
||||||
</div>
|
|
||||||
</Popover>
|
</Popover>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
WorkspaceStats.propTypes = {
|
WorkspaceStats.propTypes = {
|
||||||
@ -149,15 +206,18 @@ WorkspaceStats.propTypes = {
|
|||||||
change: PropTypes.number.isRequired,
|
change: PropTypes.number.isRequired,
|
||||||
delete: PropTypes.number.isRequired,
|
delete: PropTypes.number.isRequired,
|
||||||
move: PropTypes.number.isRequired,
|
move: PropTypes.number.isRequired,
|
||||||
workspaceChange: PropTypes.number.isRequired
|
workspaceChange: PropTypes.number.isRequired,
|
||||||
};
|
};
|
||||||
|
|
||||||
const mapStateToProps = state => ({
|
const mapStateToProps = (state) => ({
|
||||||
create: state.workspace.stats.create,
|
create: state.workspace.stats.create,
|
||||||
change: state.workspace.stats.change,
|
change: state.workspace.stats.change,
|
||||||
delete: state.workspace.stats.delete,
|
delete: state.workspace.stats.delete,
|
||||||
move: state.workspace.stats.move,
|
move: state.workspace.stats.move,
|
||||||
workspaceChange: state.workspace.change
|
workspaceChange: state.workspace.change,
|
||||||
});
|
});
|
||||||
|
|
||||||
export default connect(mapStateToProps, null)(withStyles(styles, { withTheme: true })(withWidth()(WorkspaceStats)));
|
export default connect(
|
||||||
|
mapStateToProps,
|
||||||
|
null
|
||||||
|
)(withStyles(styles, { withTheme: true })(withWidth()(WorkspaceStats)));
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
import * as Blockly from 'blockly/core';
|
import * as Blockly from "blockly/core";
|
||||||
|
|
||||||
|
|
||||||
export const FaqQuestions = () => {
|
export const FaqQuestions = () => {
|
||||||
return (
|
return [
|
||||||
[
|
|
||||||
{
|
{
|
||||||
question: `${Blockly.Msg.faq_q1_question}`,
|
question: `${Blockly.Msg.faq_q1_question}`,
|
||||||
answer: `${Blockly.Msg.faq_q1_answer}`,
|
answer: `${Blockly.Msg.faq_q1_answer}`,
|
||||||
@ -12,10 +10,13 @@ export const FaqQuestions = () => {
|
|||||||
question: `${Blockly.Msg.faq_q2_question}`,
|
question: `${Blockly.Msg.faq_q2_question}`,
|
||||||
answer: `${Blockly.Msg.faq_q2_answer}`,
|
answer: `${Blockly.Msg.faq_q2_answer}`,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
question: `${Blockly.Msg.faq_tablet_question}`,
|
||||||
|
answer: `${Blockly.Msg.faq_tablet_answer}`,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
question: `${Blockly.Msg.faq_q3_question}`,
|
question: `${Blockly.Msg.faq_q3_question}`,
|
||||||
answer: `${Blockly.Msg.faq_q3_answer}`,
|
answer: `${Blockly.Msg.faq_q3_answer}`,
|
||||||
},
|
},
|
||||||
|
];
|
||||||
])
|
};
|
||||||
}
|
|
||||||
|
@ -86,7 +86,7 @@
|
|||||||
{
|
{
|
||||||
"id": "bluetooth-bee",
|
"id": "bluetooth-bee",
|
||||||
"name": "Bluetooth-Bee",
|
"name": "Bluetooth-Bee",
|
||||||
"src": "lora-bee.png",
|
"src": "ble-bee.png",
|
||||||
"url": "https://docs.sensebox.de/hardware/bee-ble/"
|
"url": "https://docs.sensebox.de/hardware/bee-ble/"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user