Skip to content

Commit 7f4644b

Browse files
authored
Merge pull request #630 from parallaxinc/develop
Release 1.5.11
2 parents 0bd9c9d + 8bde21a commit 7f4644b

17 files changed

+910
-871
lines changed

package-lock.json

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/modules/blockly/generators/propc/control.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -532,6 +532,7 @@ Blockly.propc.control_repeat_for_loop = function() {
532532
};
533533

534534
/**
535+
* Return from function call block
535536
*
536537
* @type {{
537538
* init: Blockly.Blocks.controls_return.init,
@@ -555,7 +556,7 @@ Blockly.Blocks.controls_return = {
555556
* @return {string}
556557
*/
557558
Blockly.propc.controls_return = function() {
558-
return 'return;';
559+
return 'return;\n';
559560
};
560561

561562
/**

src/modules/blockly/generators/propc/procedures.js

+103-44
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ import Blockly from 'blockly/core';
3131
import {getDefaultProfile} from '../../../project';
3232
import {colorPalette} from '../propc';
3333

34+
const leftDblQuoteMark = '\u201C';
35+
const rightDblQuoteMark = '\u201D';
36+
3437
/**
3538
* Block for defining a procedure with no return value.
3639
* Procedures DefNoReturn
@@ -436,7 +439,8 @@ Blockly.Blocks['procedures_defnoreturn'] = {
436439
};
437440

438441
/**
439-
* Procedure Call No Return
442+
* Block Run Function
443+
* Procedure Call block that has no return value
440444
*
441445
* @type {{
442446
* init: Blockly.Blocks.procedures_callnoreturn.init,
@@ -462,42 +466,67 @@ Blockly.Blocks['procedures_callnoreturn'] = {
462466
* @this Blockly.Block
463467
*/
464468
init: function() {
469+
// Look into the current profile
465470
const profile = getDefaultProfile();
466-
if (profile.description === 'Scribbler Robot') {
467-
this.setHelpUrl(Blockly.MSG_S3_FUNCTIONS_HELPURL);
468-
} else {
469-
this.setHelpUrl(Blockly.MSG_FUNCTIONS_HELPURL);
470-
}
471+
this.setHelpUrl( (profile.name === 's3') ?
472+
Blockly.MSG_S3_FUNCTIONS_HELPURL:Blockly.MSG_FUNCTIONS_HELPURL);
471473
this.setTooltip(Blockly.MSG_PROCEDURES_CALLNORETURN_TOOLTIP);
472474
this.setColour(colorPalette.getColor('functions'));
475+
473476
this.appendDummyInput('TOPROW')
474-
.appendField('run function \u201C' + this.id + '\u201D', 'NAME');
477+
.appendField(
478+
`run function ${leftDblQuoteMark}${this.id}${rightDblQuoteMark}`,
479+
'NAME');
480+
475481
this.setPreviousStatement(true);
476482
this.setNextStatement(true);
483+
484+
/**
485+
* Function parameters array
486+
* @type {*[]}
487+
* @private
488+
*/
477489
this.arguments_ = [];
490+
491+
/**
492+
* Function parameter data types
493+
* @type {*[]}
494+
* @private
495+
*/
478496
this.argumentVarModels_ = [];
497+
498+
/**
499+
* No idea what a quark connection is or what it does
500+
* @type {{}}
501+
* @private
502+
*/
479503
this.quarkConnections_ = {};
504+
505+
/**
506+
* More quarkness but now with ID fields
507+
* @type {null}
508+
* @private
509+
*/
480510
this.quarkIds_ = null;
481511

482512
/**
483513
* Set the previous disabled state to false (off)
484-
*
485514
* @type {boolean}
486515
* @private
487516
*/
488517
this.previousDisabledState_ = false;
489518
},
490519

491520
/**
492-
* Returns the name of the procedure this block calls.
521+
* Returns the name of the function block that this block calls.
493522
* @return {string} Procedure name.
494523
* @this Blockly.Block
524+
* @description The NAME field is guaranteed to exist, null will never be returned.
495525
*/
496526
getProcedureCall: function() {
497-
// The NAME field is guaranteed to exist, null will never be returned.
498-
return /** @type {string} */ (
499-
(this.getFieldValue('NAME'))
500-
.split('\u201C'))[1].slice(0, -1);
527+
return /** @type {string} */ ((this.getFieldValue('NAME'))
528+
.split(leftDblQuoteMark))[1]
529+
.slice(0, -1);
501530
},
502531

503532
/**
@@ -509,7 +538,9 @@ Blockly.Blocks['procedures_callnoreturn'] = {
509538
*/
510539
renameProcedure: function(oldName, newName) {
511540
if (Blockly.Names.equals(oldName, this.getProcedureCall())) {
512-
this.setFieldValue('run function \u201C' + newName + '\u201D', 'NAME');
541+
this.setFieldValue(
542+
`run function ${leftDblQuoteMark}${newName}${rightDblQuoteMark}`,
543+
'NAME');
513544
}
514545
},
515546

@@ -533,8 +564,10 @@ Blockly.Blocks['procedures_callnoreturn'] = {
533564
// Existing param IDs.
534565
// Note that quarkConnections_ may include IDs that no longer exist, but
535566
// which might reappear if a param is reattached in the mutator.
536-
const defBlock = Blockly.Procedures.getDefinition(this.getProcedureCall(),
567+
const defBlock = Blockly.Procedures.getDefinition(
568+
this.getProcedureCall(),
537569
this.workspace);
570+
538571
const mutatorOpen = defBlock && defBlock.mutator &&
539572
defBlock.mutator.isVisible();
540573
if (!mutatorOpen) {
@@ -547,12 +580,12 @@ Blockly.Blocks['procedures_callnoreturn'] = {
547580
}
548581
// Test arguments (arrays of strings) for changes. '\n' is not a valid
549582
// argument name character, so it is a valid delimiter here.
550-
if (paramNames.join('\n') == this.arguments_.join('\n')) {
583+
if (paramNames.join('\n') === this.arguments_.join('\n')) {
551584
// No change.
552585
this.quarkIds_ = paramIds;
553586
return;
554587
}
555-
if (paramIds.length != paramNames.length) {
588+
if (paramIds.length !== paramNames.length) {
556589
throw new RangeError('paramNames and paramIds must be the same length.');
557590
}
558591
this.setCollapsed(false);
@@ -712,50 +745,73 @@ Blockly.Blocks['procedures_callnoreturn'] = {
712745
* @this Blockly.Block
713746
*/
714747
onchange: function(event) {
748+
console.log(`Event: ${event.type}`);
749+
750+
if (event.type === Blockly.Events.BLOCK_MOVE) {
751+
try {
752+
console.log(`Block is moving`);
753+
} catch (err) {
754+
console.log(`Block move error: ${err.message}`);
755+
}
756+
}
757+
758+
// Get the block attached to the top of this block
715759
const tBlock = this.previousConnection.targetBlock();
716-
if (tBlock) {
717-
if (tBlock.toString().indexOf('new processor ') === 0) {
718-
// Solo-497
719-
// Cannot set nextStatement to false if there is a block attached
720-
// below the current block. Detach the block first.
721-
const nextBlock = this.getNextBlock();
722-
if (nextBlock !== null) {
723-
console.log(`NextBlock: ${nextBlock.type.toString()}`);
724-
// nextBlock.nextConnection.disconnect();
725-
}
726-
try {
727-
this.setNextStatement(false);
728-
} catch (event) {
729-
console.log(event.message);
730-
this.nextConnection.disconnect();
760+
761+
try {
762+
// If a block is attached, and it is a new processor block, disconnect
763+
// the block attached to the bottom of this block, if one is attached.
764+
// The new processor block supports a single function call and that
765+
// function call cannot chain to any other blocks.
766+
if (tBlock) {
767+
if (tBlock.toString().indexOf('new processor ') === 0) {
768+
// Solo-497
769+
// Cannot set nextStatement to false if there is a block attached
770+
// below the current block. Detach the block first.
771+
const nextBlock = this.getNextBlock();
772+
console.log(`RunFunction: Bottom block attachment is: ${nextBlock}`);
773+
774+
if (nextBlock !== null) {
775+
console.log(`NextBlock: ${nextBlock.type.toString()}`);
776+
this.nextConnection.disconnect();
777+
}
731778
this.setNextStatement(false);
779+
} else {
780+
this.setNextStatement(true);
732781
}
733782
} else {
734783
this.setNextStatement(true);
735784
}
736-
} else {
737-
this.setNextStatement(true);
785+
} catch (event) {
786+
console.log(event.message);
787+
this.nextConnection.disconnect();
788+
this.setNextStatement(false);
738789
}
790+
739791
if (!this.workspace || this.workspace.isFlyout) {
740792
// Block is deleted or is in a flyout.
741793
return;
742794
}
795+
743796
if (!event.recordUndo) {
744797
// Events not generated by user. Skip handling.
745798
return;
746799
}
747-
if (event.type == Blockly.Events.BLOCK_CREATE &&
748-
event.ids.indexOf(this.id) != -1) {
800+
801+
if (event.type === Blockly.Events.BLOCK_CREATE &&
802+
event.ids.indexOf(this.id) !== -1) {
749803
// Look for the case where a procedure call was created (usually through
750804
// paste) and there is no matching definition. In this case, create
751805
// an empty definition block with the correct signature.
752806
const name = this.getProcedureCall();
753807
let def = Blockly.Procedures.getDefinition(name, this.workspace);
754-
if (def && (def.type != this.defType_ ||
755-
JSON.stringify(def.arguments_) != JSON.stringify(this.arguments_))) {
808+
if (def &&
809+
(def.type !== this.defType_ ||
810+
JSON.stringify(def.arguments_) !== JSON.stringify(this.arguments_))) {
756811
// The signatures don't match.
757812
def = null;
758813
}
814+
759815
if (!def) {
760816
Blockly.Events.setGroup(event.group);
761817
/**
@@ -787,7 +843,7 @@ Blockly.Blocks['procedures_callnoreturn'] = {
787843
Blockly.Xml.domToWorkspace(xml, this.workspace);
788844
Blockly.Events.setGroup(false);
789845
}
790-
} else if (event.type == Blockly.Events.BLOCK_DELETE) {
846+
} else if (event.type === Blockly.Events.BLOCK_DELETE) {
791847
// Look for the case where a procedure definition has been deleted,
792848
// leaving this block (a procedure call) orphaned. In this case, delete
793849
// the orphan.
@@ -798,11 +854,11 @@ Blockly.Blocks['procedures_callnoreturn'] = {
798854
this.dispose(true, false);
799855
Blockly.Events.setGroup(false);
800856
}
801-
} else if (event.type == Blockly.Events.CHANGE &&
802-
event.element == 'disabled') {
857+
} else if (event.type === Blockly.Events.CHANGE &&
858+
event.element === 'disabled') {
803859
const name = this.getProcedureCall();
804860
const def = Blockly.Procedures.getDefinition(name, this.workspace);
805-
if (def && def.id == event.blockId) {
861+
if (def && def.id === event.blockId) {
806862
// in most cases the old group should be ''
807863
const oldGroup = Blockly.Events.getGroup();
808864
if (oldGroup) {
@@ -900,8 +956,11 @@ Blockly.propc.procedures_defnoreturn = Blockly.propc.procedures_defreturn;
900956
Blockly.propc.procedures_callreturn = function() {
901957
// Call a procedure with a return value.
902958
const funcName = Blockly.propc.variableDB_.getName(
903-
((this.getFieldValue('NAME')).split('\u201C'))[1].slice(0, -1),
904-
Blockly.Procedures.NAME_TYPE);
959+
((this.getFieldValue('NAME'))
960+
.split(leftDblQuoteMark))[1]
961+
.slice(0, -1),
962+
// Blockly.Procedures.NAME_TYPE);
963+
Blockly.PROCEDURE_CATEGORY_NAME);
905964
const args = [];
906965
for (let x = 0; x < this.arguments_.length; x++) {
907966
args[x] = Blockly.propc.valueToCode(this, 'ARG' + x,

src/modules/blockly/language/en/page_text_labels.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ PageTextLabels['client_update_danger'] =
5252
PageTextLabels['editor_edit-details'] = 'Edit Project Details';
5353
PageTextLabels['menu_help_reference'] = 'Help & Reference';
5454
PageTextLabels['menu_download_simpleide'] = 'Download SimpleIDE files';
55-
PageTextLabels['editor_upload'] = 'Import Project';
55+
PageTextLabels['editor_open_project_title'] = 'Open Project';
56+
PageTextLabels['editor_upload'] = 'Import project';
5657
PageTextLabels['editor_run_configure'] = 'Configure client';
5758
PageTextLabels['editor_about_solo'] = 'About Solo';
5859
PageTextLabels['editor_license'] = 'License';
@@ -64,7 +65,7 @@ PageTextLabels['editor_client_available'] = '<strong>Select the correct port,</s
6465
PageTextLabels['editor_client_available_short'] = '<strong>Select the correct port,</strong> then click <svg xmlns="http://www.w3.org/2000/svg" width="14" height="15" style="vertical-align: middle;"><path d="M4.4,0 L6.8,0 6.8,4.8 10,4.8 5.6,9.2 1.2,4.8 4.4,4.8 Z M0.4,9.6 L10.8,9.6 10.8,11.6 0.4,11.6 Z" style="stroke:#000;stroke-width:1;fill:#000;"/></svg>.';
6566
PageTextLabels['editor_client_not-available'] = 'Unable to contact the BlocklyProp Launcher. Click for more information.';
6667
PageTextLabels['editor_client_title'] = 'BlocklyProp Launcher';
67-
PageTextLabels['editor_import'] = 'Import project file';
68+
PageTextLabels['editor_import'] = 'Import Project';
6869
PageTextLabels['editor_append'] = 'Append project file';
6970
PageTextLabels['editor_view_xml'] = 'XML';
7071
PageTextLabels['editor_new_button'] = 'New';

src/modules/client_connection.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ export const findClient = function() {
125125
logConsoleMessage('Connecting to BP Launcher client');
126126
establishBPLauncherConnection();
127127
}
128-
}
128+
};
129129

130130
/**
131131
* Checks for and, if found, uses a newer WebSockets-only client

src/modules/constants.js

+13-2
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,19 @@ export const EnableSentry = true;
4444
* {b#} is the beta release number.
4545
* {rc#} is the release candidate number.
4646
*/
47-
export const APP_VERSION = '1.5.10';
48-
export const APP_BUILD = '213';
47+
export const APP_VERSION = '1.5.11';
48+
49+
/**
50+
* Incremental build number. This gets updated before any release
51+
* to QA or production.
52+
* @type {string}
53+
*/
54+
export const APP_BUILD = '217';
55+
56+
/**
57+
* Development build stage designator
58+
* @type {string}
59+
*/
4960
export const APP_QA = 'release';
5061

5162
/**

0 commit comments

Comments
 (0)