Skip to content

Commit e0867b4

Browse files
committed
Fix issues with menu generations: should be class method
1 parent 8fca27b commit e0867b4

5 files changed

Lines changed: 11 additions & 9 deletions

File tree

blockly/blocks/arduino/stepper.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ Blockly.Blocks['stepper_step'] = {
172172
this.setWarningText(null);
173173
} else {
174174
// Set a warning to select a valid stepper config
175-
this.setWarningText(Blockly.Msg.ARD_STEPPER_STEP_WARN1);
175+
this.setWarningText(Blockly.Msg.ARD_COMPONENT_WARN1.replace('%1', Blockly.Msg.ARD_STEPPER_COMPONENT).replace('%1', Blockly.Msg.ARD_STEPPER_COMPONENT));
176176
}
177177
}
178178
};

blockly/blocks/component_variable.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,11 @@ goog.require('Blockly.Blocks');
4040
* @constructor
4141
*/
4242
Blockly.Blocks.ComponentFieldVariable = function(varname, component_type, opt_validator) {
43-
Blockly.Blocks.ComponentFieldVariable['component_type'] = component_type
43+
this.component_type = component_type
4444
//override the dropdownCreate to use for this field
45-
Blockly.FieldVariable.dropdownCreate = Blockly.Blocks.ComponentFieldVariable.dropdownCreateComponents;
45+
this.dropdownCreate = Blockly.Blocks.ComponentFieldVariable.dropdownCreateComponents;
4646
Blockly.Blocks.ComponentFieldVariable.superClass_.constructor.call(this,
47-
Blockly.Blocks.ComponentFieldVariable.dropdownCreateComponents, opt_validator);
47+
varname, opt_validator);
4848
this.setValue(varname || '');
4949
};
5050
goog.inherits(Blockly.Blocks.ComponentFieldVariable, Blockly.FieldVariable);
@@ -106,7 +106,7 @@ Blockly.Blocks.ComponentFieldVariable.dropdownCreateComponents = function() {
106106
if (this.sourceBlock_ && this.sourceBlock_.workspace) {
107107
var variableList =
108108
Blockly.Blocks.ComponentFieldVariable.ComponentVariables(this.sourceBlock_.workspace,
109-
Blockly.Blocks.ComponentFieldVariable['component_type']);
109+
this.component_type);
110110
} else {
111111
var variableList = [];
112112
}

blockly/core/field_variable.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ goog.require('goog.string');
4444
*/
4545
Blockly.FieldVariable = function(varname, opt_validator) {
4646
Blockly.FieldVariable.superClass_.constructor.call(this,
47-
Blockly.FieldVariable.dropdownCreate, opt_validator);
47+
this.dropdownCreate, opt_validator);
4848
this.setValue(varname || '');
4949
};
5050
goog.inherits(Blockly.FieldVariable, Blockly.FieldDropdown);
@@ -124,7 +124,7 @@ Blockly.FieldVariable.prototype.setValue = function(newValue) {
124124
* @return {!Array.<string>} Array of variable names.
125125
* @this {!Blockly.FieldVariable}
126126
*/
127-
Blockly.FieldVariable.dropdownCreate = function() {
127+
Blockly.FieldVariable.prototype.dropdownCreate = function() {
128128
if (this.sourceBlock_ && this.sourceBlock_.workspace) {
129129
var variableList =
130130
Blockly.Variables.allVariables(this.sourceBlock_.workspace);

blockly/msg/json/nl.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,8 @@
437437
"ARD_STEPPER_STEP": "beweeg stappenmotor",
438438
"ARD_STEPPER_STEPS": "stappen",
439439
"ARD_STEPPER_STEP_TIP": "Draait de stappenmotor een opgegeven aantal stappen",
440-
"ARD_STEPPER_STEP_WARN1": "Een Stappenmotor Definieer blok met dezelfde stappenmotor naam moet toegevoegd worden om dit blok te gebruiken!",
440+
"ARD_STEPPER_COMPONENT": "stappenmotor",
441+
"ARD_COMPONENT_WARN1": "Een %1 Definieer blok met dezelfde %1 naam moet toegevoegd worden om dit blok te gebruiken!",
441442
"ARD_TIME_DELAY": "wacht",
442443
"ARD_TIME_MS": "milliseconden",
443444
"ARD_TIME_DELAY_TIP": "Wacht de opgegeven tijd in milliseconden (duizendsten van een seconde)",

blockly/msg/messages.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1183,7 +1183,8 @@ Blockly.Msg.ARD_STEPPER_SETUP_TIP = 'Configures a stepper motor pinout and other
11831183
Blockly.Msg.ARD_STEPPER_STEP = 'move stepper';
11841184
Blockly.Msg.ARD_STEPPER_STEPS = 'steps';
11851185
Blockly.Msg.ARD_STEPPER_STEP_TIP = 'Turns the stepper motor a specific number of steps.';
1186-
Blockly.Msg.ARD_STEPPER_STEP_WARN1 = 'A STEPPER configuration block with the same stepper name must be added to use this block!';
1186+
Blockly.Msg.ARD_STEPPER_COMPONENT = 'stepper';
1187+
Blockly.Msg.ARD_COMPONENT_WARN1 = 'A %1 configuration block with the same %1 name must be added to use this block!';
11871188
Blockly.Msg.ARD_TIME_DELAY = 'wait';
11881189
Blockly.Msg.ARD_TIME_MS = 'milliseconds';
11891190
Blockly.Msg.ARD_TIME_DELAY_TIP = 'Wait specific time in milliseconds';

0 commit comments

Comments
 (0)