From eb31746a1a7750a69b9df1faea023428014b9fd6 Mon Sep 17 00:00:00 2001 From: Brett Swift Date: Wed, 21 Jan 2015 13:05:29 -0500 Subject: [PATCH 01/38] Remove blockly xml log statement --- support/client/lib/vwf/view/blockly.js | 1 - 1 file changed, 1 deletion(-) diff --git a/support/client/lib/vwf/view/blockly.js b/support/client/lib/vwf/view/blockly.js index f5262ce7f..e0f343739 100644 --- a/support/client/lib/vwf/view/blockly.js +++ b/support/client/lib/vwf/view/blockly.js @@ -156,7 +156,6 @@ define( [ "module", "vwf/view", "jquery", "vwf/model/blockly/JS-Interpreter/acor // Set the appropriate model properties based on this change var xmlDom = Blockly.Xml.workspaceToDom( Blockly.getMainWorkspace() ); - console.log (xmlDom); if ( xmlDom ) { var newXmlText = Blockly.Xml.domToText( xmlDom ); self.kernel.setProperty( self.state.blockly.node.ID, "blockly_xml", From fc37efeeff22259fc5293f230348c8329a1c8bbf Mon Sep 17 00:00:00 2001 From: Brett Swift Date: Wed, 21 Jan 2015 13:15:22 -0500 Subject: [PATCH 02/38] Remove console.log in blockly driver --- support/client/lib/vwf/view/blockly.js | 1 - 1 file changed, 1 deletion(-) diff --git a/support/client/lib/vwf/view/blockly.js b/support/client/lib/vwf/view/blockly.js index e0f343739..d79f2f292 100644 --- a/support/client/lib/vwf/view/blockly.js +++ b/support/client/lib/vwf/view/blockly.js @@ -500,7 +500,6 @@ define( [ "module", "vwf/view", "jquery", "vwf/model/blockly/JS-Interpreter/acor } } if ( xmlDom ) { - console.log (xmlDom); clearBeforeSet && Blockly.mainWorkspace.clear(); domCopyToWorkspace( Blockly.mainWorkspace, xmlDom ); } From abe8d1a525624bf9aaa42629329e56ce9acd8e59 Mon Sep 17 00:00:00 2001 From: Brett Swift Date: Thu, 22 Jan 2015 13:15:31 -0500 Subject: [PATCH 03/38] Comment out line generating errors with repeat blocks --- support/client/lib/vwf/model/blockly.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/support/client/lib/vwf/model/blockly.js b/support/client/lib/vwf/model/blockly.js index 5bdea9eac..237c9d231 100644 --- a/support/client/lib/vwf/model/blockly.js +++ b/support/client/lib/vwf/model/blockly.js @@ -389,7 +389,9 @@ define( [ "module", "vwf/model", "vwf/utility", nextStep( blocklyNode ); - this.kernel.fireEvent( nodeID, "blocklyExecuted", [ blocklyNode.interpreter.value ] ); + // Does this serve any real purpose? It's not handled in any application. + // Certain blocks, such as repeat blocks, break with the recursive node reference changes. + // this.kernel.fireEvent( nodeID, "blocklyExecuted", [ blocklyNode.interpreter.value ] ); } } } From d137c8464384dad636622f57145d743a0d276650 Mon Sep 17 00:00:00 2001 From: Nathan Marshak Date: Wed, 11 Mar 2015 14:50:18 -0400 Subject: [PATCH 04/38] we can now stop execution on a particular Blockly node,as opposed to just one of them. --- support/client/lib/vwf/model/blockly.js | 19 ++++++++++++++++++- support/client/lib/vwf/view/blockly.js | 4 ++-- .../vwf.example.com/blockly/manager.vwf.yaml | 2 +- 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/support/client/lib/vwf/model/blockly.js b/support/client/lib/vwf/model/blockly.js index 237c9d231..0fb8c8c7e 100644 --- a/support/client/lib/vwf/model/blockly.js +++ b/support/client/lib/vwf/model/blockly.js @@ -307,7 +307,7 @@ define( [ "module", "vwf/model", "vwf/utility", // -- callingMethod -------------------------------------------------------------------------- - callingMethod: function( nodeID, methodName /* [, parameter1, parameter2, ... ] */ ) { // TODO: parameters + callingMethod: function( nodeID, methodName, methodParameters ) { var node = this.state.nodes[ nodeID ]; if ( this.debug.methods ) { @@ -318,6 +318,23 @@ define( [ "module", "vwf/model", "vwf/utility", switch ( methodName ) { + case "stopExecutionForNode": + if ( methodParameters ) { + var id = methodParameters; + var currBlockly3Node= this.state.executingBlocks[ id ]; + if ( currBlockly3Node ) { + currBlockly3Node.interpreterStatus = "completed"; + this.kernel.setProperty( id, 'blockly_executing', false ); + this.kernel.fireEvent( id, "blocklyStopped", [ true ] ); + } else { + this.logger.errorx("stopExecutionForNode", "Node with", id, + "is not currently executing Blockly!"); + } + } else { + this.logger.errorx("stopExecutionForNode", "No node specified!"); + } + break; + case "stopAllExecution": for ( var id in this.state.executingBlocks ) { this.state.executingBlocks[ id ].interpreterStatus = "completed"; diff --git a/support/client/lib/vwf/view/blockly.js b/support/client/lib/vwf/view/blockly.js index d79f2f292..b27df8b2f 100644 --- a/support/client/lib/vwf/view/blockly.js +++ b/support/client/lib/vwf/view/blockly.js @@ -245,7 +245,7 @@ define( [ "module", "vwf/view", "jquery", "vwf/model/blockly/JS-Interpreter/acor getBlockXML( previousActiveNode ); setBlocklyUIVisibility( previousActiveNode, false ); show = ( previousActiveNode.ID !== newActiveNodeId ); - this.state.blockly.node = undefined; + this.state.blockly.node = undefined; } // If the new active node is different than the old, @@ -269,7 +269,7 @@ define( [ "module", "vwf/view", "jquery", "vwf/model/blockly/JS-Interpreter/acor if ( previousActiveNode !== undefined ) { getBlockXML( previousActiveNode ); setBlocklyUIVisibility( previousActiveNode, false ); - this.state.blockly.node = undefined; + this.state.blockly.node = undefined; } } break; diff --git a/support/proxy/vwf.example.com/blockly/manager.vwf.yaml b/support/proxy/vwf.example.com/blockly/manager.vwf.yaml index 2cae95f56..1ea052bc6 100644 --- a/support/proxy/vwf.example.com/blockly/manager.vwf.yaml +++ b/support/proxy/vwf.example.com/blockly/manager.vwf.yaml @@ -27,6 +27,6 @@ properties: methods: startAllExecution: stopAllExecution: + stopExecutionForNode: events: blocklyContentChanged: - \ No newline at end of file From 579961d01efe5bbaa5537328bdf801a71c405e2c Mon Sep 17 00:00:00 2001 From: Nathan Marshak Date: Fri, 13 Mar 2015 03:22:37 -0400 Subject: [PATCH 05/38] Now, per Brett's suggestion, we changed stopExecutingForNode in manager.vwf.yaml to stopExecuting in controller.vwf.yaml. This way we don't have to pass the node ID as an argument. --- support/client/lib/vwf/model/blockly.js | 30 +++++++------------ .../blockly/controller.vwf.yaml | 1 + .../vwf.example.com/blockly/manager.vwf.yaml | 1 - 3 files changed, 12 insertions(+), 20 deletions(-) diff --git a/support/client/lib/vwf/model/blockly.js b/support/client/lib/vwf/model/blockly.js index 0fb8c8c7e..5948c6f12 100644 --- a/support/client/lib/vwf/model/blockly.js +++ b/support/client/lib/vwf/model/blockly.js @@ -317,23 +317,6 @@ define( [ "module", "vwf/model", "vwf/utility", if ( nodeID == this.kernel.application() ) { switch ( methodName ) { - - case "stopExecutionForNode": - if ( methodParameters ) { - var id = methodParameters; - var currBlockly3Node= this.state.executingBlocks[ id ]; - if ( currBlockly3Node ) { - currBlockly3Node.interpreterStatus = "completed"; - this.kernel.setProperty( id, 'blockly_executing', false ); - this.kernel.fireEvent( id, "blocklyStopped", [ true ] ); - } else { - this.logger.errorx("stopExecutionForNode", "Node with", id, - "is not currently executing Blockly!"); - } - } else { - this.logger.errorx("stopExecutionForNode", "No node specified!"); - } - break; case "stopAllExecution": for ( var id in this.state.executingBlocks ) { @@ -349,8 +332,6 @@ define( [ "module", "vwf/model", "vwf/utility", this.kernel.fireEvent( id, "blocklyStarted", [ true ] ); } break; - - } } else if ( node !== undefined ) { switch ( methodName ) { @@ -361,6 +342,17 @@ define( [ "module", "vwf/model", "vwf/utility", this.kernel.setProperty( nodeID, "blockly_xml", '' ); } break; + case "stopExecution": + var currBlockly3Node = this.state.executingBlocks[ nodeID ]; + if ( currBlockly3Node ) { + currBlockly3Node.interpreterStatus = "completed"; + this.kernel.setProperty( nodeID, 'blockly_executing', false ); + this.kernel.fireEvent( nodeID, "blocklyStopped", [ true ] ); + } else { + this.logger.errorx("stopExecutionForNode", "Node with", nodeID, + "is not currently executing Blockly!"); + } + break; } } }, diff --git a/support/proxy/vwf.example.com/blockly/controller.vwf.yaml b/support/proxy/vwf.example.com/blockly/controller.vwf.yaml index bc120d91b..fe9c506be 100644 --- a/support/proxy/vwf.example.com/blockly/controller.vwf.yaml +++ b/support/proxy/vwf.example.com/blockly/controller.vwf.yaml @@ -55,6 +55,7 @@ properties: methods: getWorldXYVector: blocklyClear: + stopExecution: events: blocklyStarted: blocklyExecuted: diff --git a/support/proxy/vwf.example.com/blockly/manager.vwf.yaml b/support/proxy/vwf.example.com/blockly/manager.vwf.yaml index 1ea052bc6..a5143b347 100644 --- a/support/proxy/vwf.example.com/blockly/manager.vwf.yaml +++ b/support/proxy/vwf.example.com/blockly/manager.vwf.yaml @@ -27,6 +27,5 @@ properties: methods: startAllExecution: stopAllExecution: - stopExecutionForNode: events: blocklyContentChanged: From 682ab1948aa24ac26266d8ae1ef2162680ba2484 Mon Sep 17 00:00:00 2001 From: Brett Swift Date: Thu, 12 Mar 2015 13:28:23 -0400 Subject: [PATCH 06/38] Remove UI visibility code from blockly_activeNodeID handler --- support/client/lib/vwf/view/blockly.js | 51 +++++++++----------------- 1 file changed, 18 insertions(+), 33 deletions(-) diff --git a/support/client/lib/vwf/view/blockly.js b/support/client/lib/vwf/view/blockly.js index b27df8b2f..8ef5a4ced 100644 --- a/support/client/lib/vwf/view/blockly.js +++ b/support/client/lib/vwf/view/blockly.js @@ -232,45 +232,30 @@ define( [ "module", "vwf/view", "jquery", "vwf/model/blockly/JS-Interpreter/acor // If the new node is the same as the old - exit early to prevent // breaking synchronization. - if ( previousActiveNode === newActiveNodeId ) { + if ( previousActiveNode === blocklyNode ) { break; } - if ( blocklyNode !== undefined ) { - var show = true; - - //If there was already an active blockly node, deal with it before - //activating the new one - if ( previousActiveNode !== undefined ) { - getBlockXML( previousActiveNode ); - setBlocklyUIVisibility( previousActiveNode, false ); - show = ( previousActiveNode.ID !== newActiveNodeId ); - this.state.blockly.node = undefined; - } + if ( previousActiveNode !== undefined ) { + getBlockXML( previousActiveNode ); + this.state.blockly.node = undefined; + } + if ( blocklyNode !== undefined ) { // If the new active node is different than the old, // then we need to load its program into the toolbox - if ( show ) { - if ( blocklyNode.toolbox !== undefined ) { - loadToolbox( blocklyNode.toolbox ); - } else if ( app.toolbox !== undefined ) { - loadToolbox( app.toolbox ); - } - if ( blocklyNode.defaultXml !== undefined ) { - loadDefaultXml( blocklyNode.defaultXml ); - } else if ( app.defaultXml !== undefined ) { - loadDefaultXml( app.defaultXml ); - } - this.state.blockly.node = blocklyNode; - setBlockXML( blocklyNode ); - setBlocklyUIVisibility( blocklyNode, true ); - } - } else { - if ( previousActiveNode !== undefined ) { - getBlockXML( previousActiveNode ); - setBlocklyUIVisibility( previousActiveNode, false ); - this.state.blockly.node = undefined; - } + if ( blocklyNode.toolbox !== undefined ) { + loadToolbox( blocklyNode.toolbox ); + } else if ( app.toolbox !== undefined ) { + loadToolbox( app.toolbox ); + } + if ( blocklyNode.defaultXml !== undefined ) { + loadDefaultXml( blocklyNode.defaultXml ); + } else if ( app.defaultXml !== undefined ) { + loadDefaultXml( app.defaultXml ); + } + this.state.blockly.node = blocklyNode; + setBlockXML( blocklyNode ); } break; From 432ab44bdd65d0e834ab18568e4982b6b7418c12 Mon Sep 17 00:00:00 2001 From: Brett Swift Date: Thu, 12 Mar 2015 13:46:56 -0400 Subject: [PATCH 07/38] Add blockly_interfaceVisible property --- support/client/lib/vwf/view/blockly.js | 4 ++++ support/proxy/vwf.example.com/blockly/manager.vwf.yaml | 1 + 2 files changed, 5 insertions(+) diff --git a/support/client/lib/vwf/view/blockly.js b/support/client/lib/vwf/view/blockly.js index 8ef5a4ced..46e8e3187 100644 --- a/support/client/lib/vwf/view/blockly.js +++ b/support/client/lib/vwf/view/blockly.js @@ -276,6 +276,10 @@ define( [ "module", "vwf/view", "jquery", "vwf/model/blockly/JS-Interpreter/acor this.delayedProperties.blockly_autoClose = Boolean( propertyValue ); } break; + + case "blockly_interfaceVisible": + setBlocklyUIVisibility( this.state.blockly.node, propertyValue ); + break; } } else if ( this.state.blockly.node && ( nodeID === this.state.blockly.node.ID ) ) { diff --git a/support/proxy/vwf.example.com/blockly/manager.vwf.yaml b/support/proxy/vwf.example.com/blockly/manager.vwf.yaml index a5143b347..3716ff9b7 100644 --- a/support/proxy/vwf.example.com/blockly/manager.vwf.yaml +++ b/support/proxy/vwf.example.com/blockly/manager.vwf.yaml @@ -24,6 +24,7 @@ properties: blockly_toolbox: blockly_defaultXml: blockly_autoClose: + blockly_interfaceVisible: methods: startAllExecution: stopAllExecution: From 86be9af090bc3c0fdfae3231f94cccb5e90fbefd Mon Sep 17 00:00:00 2001 From: Brett Swift Date: Thu, 12 Mar 2015 14:40:25 -0400 Subject: [PATCH 08/38] Only fire blocklyVisibleChanged if active node is defined --- support/client/lib/vwf/view/blockly.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/support/client/lib/vwf/view/blockly.js b/support/client/lib/vwf/view/blockly.js index 46e8e3187..17ddf5ff3 100644 --- a/support/client/lib/vwf/view/blockly.js +++ b/support/client/lib/vwf/view/blockly.js @@ -388,7 +388,9 @@ define( [ "module", "vwf/view", "jquery", "vwf/model/blockly/JS-Interpreter/acor self.delayedProperties = undefined; } - self.kernel.fireEvent( node.ID, "blocklyVisibleChanged", [ show ] ); + if ( node && node.ID ) { + self.kernel.fireEvent( node.ID, "blocklyVisibleChanged", [ show ] ); + } } function loadToolbox( toolboxDef ) { From 25655c154cdf2aee2ae524b63973859d656851aa Mon Sep 17 00:00:00 2001 From: Brett Swift Date: Thu, 12 Mar 2015 16:25:49 -0400 Subject: [PATCH 09/38] Fire blocklyVisibleChanged when active node changes --- support/client/lib/vwf/view/blockly.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/support/client/lib/vwf/view/blockly.js b/support/client/lib/vwf/view/blockly.js index 17ddf5ff3..d9bb766d1 100644 --- a/support/client/lib/vwf/view/blockly.js +++ b/support/client/lib/vwf/view/blockly.js @@ -256,6 +256,7 @@ define( [ "module", "vwf/view", "jquery", "vwf/model/blockly/JS-Interpreter/acor } this.state.blockly.node = blocklyNode; setBlockXML( blocklyNode ); + this.kernel.fireEvent( blocklyNode.ID, "blocklyVisibleChanged", [ getBlocklyUIVisibility() ] ); } break; @@ -393,6 +394,12 @@ define( [ "module", "vwf/view", "jquery", "vwf/model/blockly/JS-Interpreter/acor } } + function getBlocklyUIVisibility() { + var div = document.getElementById( self.options.divParent ); + var result = div.style.visibility === "visible" ? true : false; + return result; + } + function loadToolbox( toolboxDef ) { // check the 'Changing the Toolbox' section at // https://code.google.com/p/blockly/wiki/Toolbox From 554d2f0f182462e3c040ba0d46dcff3bd93e5a19 Mon Sep 17 00:00:00 2001 From: Spencer Frazier Date: Tue, 7 Apr 2015 13:59:08 -0400 Subject: [PATCH 10/38] Brings back the trashcan and removes an offset that isn't needed (which should fix tooltips and mutator callout origins for Blockly). --- support/client/lib/vwf/view/blockly.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/support/client/lib/vwf/view/blockly.js b/support/client/lib/vwf/view/blockly.js index d9bb766d1..f5c4d024c 100644 --- a/support/client/lib/vwf/view/blockly.js +++ b/support/client/lib/vwf/view/blockly.js @@ -101,7 +101,6 @@ define( [ "module", "vwf/view", "jquery", "vwf/model/blockly/JS-Interpreter/acor Blockly.inject( document.getElementById( self.options.divName ), { path: this.options.blocklyPath, toolbox: document.getElementById( self.options.toolbox ), - trashcan: false, } ); // HACK: Fix Blockly's hijacking of the backspace and delete keys in password fields @@ -451,10 +450,12 @@ define( [ "module", "vwf/view", "jquery", "vwf/model/blockly/JS-Interpreter/acor function cleanUpdateToolbox( xml ) { // negateOverlap is being use to negate some of the effect of the MARGIN variable // in Blockly.createDom_ when deleting blocks over the flyout - var negateOverlap = 35; + // SJF: Overlap not present in Blockly with categories enabled + + //var negateOverlap = 35; Blockly.updateToolbox( xml ); - Blockly.mainWorkspace.scrollX = Blockly.mainWorkspace.flyout_.width_ + negateOverlap; - var translation = 'translate(' + Blockly.mainWorkspace.scrollX + ', 0)'; + //Blockly.mainWorkspace.scrollX = Blockly.mainWorkspace.flyout_.width_ + negateOverlap; + var translation = 'translate( 0, 0)'; Blockly.mainWorkspace.getCanvas().setAttribute('transform', translation); } From c376e3b8c6d52322adf5c4a58fd5961824b17184 Mon Sep 17 00:00:00 2001 From: Spencer Frazier Date: Tue, 7 Apr 2015 14:08:21 -0400 Subject: [PATCH 11/38] Clean up changes --- support/client/lib/vwf/view/blockly.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/support/client/lib/vwf/view/blockly.js b/support/client/lib/vwf/view/blockly.js index f5c4d024c..30943b858 100644 --- a/support/client/lib/vwf/view/blockly.js +++ b/support/client/lib/vwf/view/blockly.js @@ -100,7 +100,7 @@ define( [ "module", "vwf/view", "jquery", "vwf/model/blockly/JS-Interpreter/acor self.kernel.setProperty( childID, "toolbox", self.options.toolbox ); Blockly.inject( document.getElementById( self.options.divName ), { path: this.options.blocklyPath, - toolbox: document.getElementById( self.options.toolbox ), + toolbox: document.getElementById( self.options.toolbox ) } ); // HACK: Fix Blockly's hijacking of the backspace and delete keys in password fields @@ -452,11 +452,11 @@ define( [ "module", "vwf/view", "jquery", "vwf/model/blockly/JS-Interpreter/acor // in Blockly.createDom_ when deleting blocks over the flyout // SJF: Overlap not present in Blockly with categories enabled - //var negateOverlap = 35; + // var negateOverlap = 35; Blockly.updateToolbox( xml ); - //Blockly.mainWorkspace.scrollX = Blockly.mainWorkspace.flyout_.width_ + negateOverlap; - var translation = 'translate( 0, 0)'; - Blockly.mainWorkspace.getCanvas().setAttribute('transform', translation); + // Blockly.mainWorkspace.scrollX = Blockly.mainWorkspace.flyout_.width_ + negateOverlap; + // var translation = 'translate( ' + Blockly.mainWorkspace.scrollX + ', 0 )'; + // Blockly.mainWorkspace.getCanvas().setAttribute('transform', translation); } // domCopyToWorkspace copies the saved blocks to the workspace exactly From 4406299596c612d4018d5211512f8850a1904980 Mon Sep 17 00:00:00 2001 From: Spencer Frazier Date: Thu, 9 Apr 2015 12:37:56 -0400 Subject: [PATCH 12/38] Adds support to change the execution time of Blockly depending on the length of the task to be completed in the Blockly block. --- support/client/lib/vwf/model/blockly.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/support/client/lib/vwf/model/blockly.js b/support/client/lib/vwf/model/blockly.js index 5948c6f12..ce2af3f05 100644 --- a/support/client/lib/vwf/model/blockly.js +++ b/support/client/lib/vwf/model/blockly.js @@ -231,6 +231,10 @@ define( [ "module", "vwf/model", "vwf/utility", value = node.blocks = propertyValue; break; + case "blockly_timeBetweenLines": + this.state.blockly.node.timeBetweenLines = propertyValue; + break; + case "blockly_executing": var exe = Boolean( propertyValue ); if ( exe ) { @@ -376,6 +380,7 @@ define( [ "module", "vwf/model", "vwf/utility", for ( var nodeID in this.state.executingBlocks ) { blocklyNode = this.state.executingBlocks[ nodeID ]; + var executeNextLine = false; if ( blocklyNode.interpreter === undefined || @@ -387,6 +392,7 @@ define( [ "module", "vwf/model", "vwf/utility", } else { var elaspedTime = vwfTime - blocklyNode.lastLineExeTime; if ( elaspedTime >= blocklyNode.timeBetweenLines ) { + console.log( 'm'+ blocklyNode.timeBetweenLines ); executeNextLine = true; blocklyNode.lastLineExeTime = vwfTime; } From 54e7bdc12c3c6869a13e535e95f29da22e08f075 Mon Sep 17 00:00:00 2001 From: Spencer Frazier Date: Fri, 10 Apr 2015 11:51:32 -0400 Subject: [PATCH 13/38] Remove log messages --- support/client/lib/vwf/model/blockly.js | 1 - 1 file changed, 1 deletion(-) diff --git a/support/client/lib/vwf/model/blockly.js b/support/client/lib/vwf/model/blockly.js index ce2af3f05..01bafb704 100644 --- a/support/client/lib/vwf/model/blockly.js +++ b/support/client/lib/vwf/model/blockly.js @@ -392,7 +392,6 @@ define( [ "module", "vwf/model", "vwf/utility", } else { var elaspedTime = vwfTime - blocklyNode.lastLineExeTime; if ( elaspedTime >= blocklyNode.timeBetweenLines ) { - console.log( 'm'+ blocklyNode.timeBetweenLines ); executeNextLine = true; blocklyNode.lastLineExeTime = vwfTime; } From 84141c7239a4f2cfc62a7507872fd4ed281ef4c4 Mon Sep 17 00:00:00 2001 From: Spencer Frazier Date: Tue, 28 Apr 2015 10:03:35 -0400 Subject: [PATCH 14/38] Refinements in progress... --- support/client/lib/vwf/model/blockly.js | 30 ++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/support/client/lib/vwf/model/blockly.js b/support/client/lib/vwf/model/blockly.js index 01bafb704..d03284b64 100644 --- a/support/client/lib/vwf/model/blockly.js +++ b/support/client/lib/vwf/model/blockly.js @@ -64,6 +64,7 @@ define( [ "module", "vwf/model", "vwf/utility", "code": undefined, "lastLineExeTime": undefined, "timeBetweenLines": 1, + "baseExecutionSpeed": 1, "interpreter": undefined, "interpreterStatus": "" }; @@ -235,6 +236,17 @@ define( [ "module", "vwf/model", "vwf/utility", this.state.blockly.node.timeBetweenLines = propertyValue; break; + case "blockly_baseExecutionSpeed": + + if ( propertyValue > 0 && propertyValue <= 10 ) { + this.state.blockly.node.baseExecutionSpeed = propertyValue; + } else { + this.logger.errorx("baseExecutionSpeed", "Blockly node with", nodeID, + "must have base execution greater than 0 and less than 10."); + } + + break; + case "blockly_executing": var exe = Boolean( propertyValue ); if ( exe ) { @@ -357,6 +369,22 @@ define( [ "module", "vwf/model", "vwf/utility", "is not currently executing Blockly!"); } break; + case "changeBaseExecutionSpeed": + if ( !methodParameters || methodParameters.length !== 1 ) { + this.logger.errorx("changeBaseExecutionSpeed", "Node with", nodeID, + "takes one argument to change the Blockly base execution speed!"); + break; + } + + var newValue = methodParameters[ 0 ]; + + if ( newValue > 0 && newValue <= 10 ) { + this.kernel.setProperty( nodeID, 'blockly_baseExecutionSpeed',newValue ); + } else { + this.logger.errorx("changeBaseExecutionSpeed", "Blockly node with", + nodeID, "must have base execution greater than 0 and less than 10."); + } + break; } } }, @@ -391,7 +419,7 @@ define( [ "module", "vwf/model", "vwf/utility", executeNextLine = true; } else { var elaspedTime = vwfTime - blocklyNode.lastLineExeTime; - if ( elaspedTime >= blocklyNode.timeBetweenLines ) { + if ( elaspedTime >= blocklyNode.timeBetweenLines * blocklyNode.baseExecutionSpeed ) { executeNextLine = true; blocklyNode.lastLineExeTime = vwfTime; } From fb1c255280b6099623bb5632b512e4dae42a382e Mon Sep 17 00:00:00 2001 From: Spencer Frazier Date: Tue, 28 Apr 2015 12:30:59 -0400 Subject: [PATCH 15/38] Speed up working. --- support/client/lib/vwf/model/blockly.js | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/support/client/lib/vwf/model/blockly.js b/support/client/lib/vwf/model/blockly.js index d03284b64..9a5e77134 100644 --- a/support/client/lib/vwf/model/blockly.js +++ b/support/client/lib/vwf/model/blockly.js @@ -240,6 +240,7 @@ define( [ "module", "vwf/model", "vwf/utility", if ( propertyValue > 0 && propertyValue <= 10 ) { this.state.blockly.node.baseExecutionSpeed = propertyValue; + console.log('speed set'); } else { this.logger.errorx("baseExecutionSpeed", "Blockly node with", nodeID, "must have base execution greater than 0 and less than 10."); @@ -369,22 +370,6 @@ define( [ "module", "vwf/model", "vwf/utility", "is not currently executing Blockly!"); } break; - case "changeBaseExecutionSpeed": - if ( !methodParameters || methodParameters.length !== 1 ) { - this.logger.errorx("changeBaseExecutionSpeed", "Node with", nodeID, - "takes one argument to change the Blockly base execution speed!"); - break; - } - - var newValue = methodParameters[ 0 ]; - - if ( newValue > 0 && newValue <= 10 ) { - this.kernel.setProperty( nodeID, 'blockly_baseExecutionSpeed',newValue ); - } else { - this.logger.errorx("changeBaseExecutionSpeed", "Blockly node with", - nodeID, "must have base execution greater than 0 and less than 10."); - } - break; } } }, @@ -410,7 +395,7 @@ define( [ "module", "vwf/model", "vwf/utility", blocklyNode = this.state.executingBlocks[ nodeID ]; var executeNextLine = false; - + if ( blocklyNode.interpreter === undefined || blocklyNode.interpreterStatus === "completed" ) { blocklyNode.interpreter = createInterpreter( acorn, blocklyNode.code ); @@ -419,7 +404,7 @@ define( [ "module", "vwf/model", "vwf/utility", executeNextLine = true; } else { var elaspedTime = vwfTime - blocklyNode.lastLineExeTime; - if ( elaspedTime >= blocklyNode.timeBetweenLines * blocklyNode.baseExecutionSpeed ) { + if ( elaspedTime >= ( blocklyNode.timeBetweenLines * blocklyNode.baseExecutionSpeed ) ) { executeNextLine = true; blocklyNode.lastLineExeTime = vwfTime; } From 9b5e74bf58d1b7af488e7fc1094b026626aeaa9f Mon Sep 17 00:00:00 2001 From: Spencer Frazier Date: Thu, 30 Apr 2015 16:23:31 -0400 Subject: [PATCH 16/38] Remove a log message --- support/client/lib/vwf/model/blockly.js | 1 - 1 file changed, 1 deletion(-) diff --git a/support/client/lib/vwf/model/blockly.js b/support/client/lib/vwf/model/blockly.js index 9a5e77134..74100e6be 100644 --- a/support/client/lib/vwf/model/blockly.js +++ b/support/client/lib/vwf/model/blockly.js @@ -240,7 +240,6 @@ define( [ "module", "vwf/model", "vwf/utility", if ( propertyValue > 0 && propertyValue <= 10 ) { this.state.blockly.node.baseExecutionSpeed = propertyValue; - console.log('speed set'); } else { this.logger.errorx("baseExecutionSpeed", "Blockly node with", nodeID, "must have base execution greater than 0 and less than 10."); From 0019b8224a3bd37ccac201ae6c5c455641faefe1 Mon Sep 17 00:00:00 2001 From: Spencer Frazier Date: Tue, 5 May 2015 09:14:31 -0400 Subject: [PATCH 17/38] Fix error message --- support/client/lib/vwf/model/blockly.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/support/client/lib/vwf/model/blockly.js b/support/client/lib/vwf/model/blockly.js index 74100e6be..1f76830e7 100644 --- a/support/client/lib/vwf/model/blockly.js +++ b/support/client/lib/vwf/model/blockly.js @@ -242,7 +242,7 @@ define( [ "module", "vwf/model", "vwf/utility", this.state.blockly.node.baseExecutionSpeed = propertyValue; } else { this.logger.errorx("baseExecutionSpeed", "Blockly node with", nodeID, - "must have base execution greater than 0 and less than 10."); + "must be in the range (0,10)."); } break; From 58649301f3d0710a4c3902d470e63cefd2c9cf00 Mon Sep 17 00:00:00 2001 From: Spencer Frazier Date: Mon, 18 May 2015 12:28:44 -0400 Subject: [PATCH 18/38] Prevents invalid xml from being loaded --- support/client/lib/vwf/model/blockly.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/support/client/lib/vwf/model/blockly.js b/support/client/lib/vwf/model/blockly.js index 1f76830e7..1f23d6f74 100644 --- a/support/client/lib/vwf/model/blockly.js +++ b/support/client/lib/vwf/model/blockly.js @@ -229,7 +229,11 @@ define( [ "module", "vwf/model", "vwf/utility", break; case "blockly_xml": - value = node.blocks = propertyValue; + if ( propertyValue.indexOf('http://www.w3.org/1999/xhtml') !== -1 ) { + } else { + node.blocks = propertyValue; + value = propertyValue; + } break; case "blockly_timeBetweenLines": @@ -412,7 +416,6 @@ define( [ "module", "vwf/model", "vwf/utility", if ( executeNextLine ) { self.state.executionHalted = false; - nextStep( blocklyNode ); // Does this serve any real purpose? It's not handled in any application. From 41862ee3eba7fab283f02a0fa6a0f2f46bf69638 Mon Sep 17 00:00:00 2001 From: Spencer Frazier Date: Mon, 18 May 2015 13:03:13 -0400 Subject: [PATCH 19/38] Fix handling of Blockly clear --- support/client/lib/vwf/model/blockly.js | 1 + support/client/lib/vwf/view/blockly.js | 11 ++++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/support/client/lib/vwf/model/blockly.js b/support/client/lib/vwf/model/blockly.js index 1f23d6f74..2f4e846f4 100644 --- a/support/client/lib/vwf/model/blockly.js +++ b/support/client/lib/vwf/model/blockly.js @@ -230,6 +230,7 @@ define( [ "module", "vwf/model", "vwf/utility", case "blockly_xml": if ( propertyValue.indexOf('http://www.w3.org/1999/xhtml') !== -1 ) { + //SJF: Invalid XML being passed in as default on Blockly clear sometimes } else { node.blocks = propertyValue; value = propertyValue; diff --git a/support/client/lib/vwf/view/blockly.js b/support/client/lib/vwf/view/blockly.js index 30943b858..d44297bc1 100644 --- a/support/client/lib/vwf/view/blockly.js +++ b/support/client/lib/vwf/view/blockly.js @@ -232,6 +232,7 @@ define( [ "module", "vwf/view", "jquery", "vwf/model/blockly/JS-Interpreter/acor // breaking synchronization. if ( previousActiveNode === blocklyNode ) { + setBlockXML( blocklyNode ); break; } @@ -248,11 +249,11 @@ define( [ "module", "vwf/view", "jquery", "vwf/model/blockly/JS-Interpreter/acor } else if ( app.toolbox !== undefined ) { loadToolbox( app.toolbox ); } - if ( blocklyNode.defaultXml !== undefined ) { - loadDefaultXml( blocklyNode.defaultXml ); - } else if ( app.defaultXml !== undefined ) { - loadDefaultXml( app.defaultXml ); - } + // if ( blocklyNode.defaultXml !== undefined ) { + // loadDefaultXml( blocklyNode.defaultXml ); + // } else if ( app.defaultXml !== undefined ) { + // loadDefaultXml( app.defaultXml ); + // } this.state.blockly.node = blocklyNode; setBlockXML( blocklyNode ); this.kernel.fireEvent( blocklyNode.ID, "blocklyVisibleChanged", [ getBlocklyUIVisibility() ] ); From 1904adac4b7184469f57025748cd99970da37121 Mon Sep 17 00:00:00 2001 From: Spencer Frazier Date: Tue, 19 May 2015 16:01:52 -0400 Subject: [PATCH 20/38] Adds a grid and updates blockly version for new goodness. --- .../vwf/model/blockly/blockly_compressed.js | 1483 +++++++++-------- .../vwf/model/blockly/blocks_compressed.js | 212 +-- .../model/blockly/javascript_compressed.js | 39 +- support/client/lib/vwf/view/blockly.js | 3 +- 4 files changed, 951 insertions(+), 786 deletions(-) diff --git a/support/client/lib/vwf/model/blockly/blockly_compressed.js b/support/client/lib/vwf/model/blockly/blockly_compressed.js index 9a0ab7c43..babc3efba 100644 --- a/support/client/lib/vwf/model/blockly/blockly_compressed.js +++ b/support/client/lib/vwf/model/blockly/blockly_compressed.js @@ -1,199 +1,219 @@ // Do not edit this file; automatically generated by build.py. "use strict"; -var COMPILED=!0,goog=goog||{};goog.global=this;goog.exportPath_=function(a,b,c){a=a.split(".");c=c||goog.global;a[0]in c||!c.execScript||c.execScript("var "+a[0]);for(var d;a.length&&(d=a.shift());)a.length||void 0===b?c=c[d]?c[d]:c[d]={}:c[d]=b};goog.define=function(a,b){var c=b;COMPILED||goog.global.CLOSURE_DEFINES&&Object.prototype.hasOwnProperty.call(goog.global.CLOSURE_DEFINES,a)&&(c=goog.global.CLOSURE_DEFINES[a]);goog.exportPath_(a,c)};goog.DEBUG=!0;goog.LOCALE="en";goog.TRUSTED_SITE=!0; -goog.provide=function(a){if(!COMPILED){if(goog.isProvided_(a))throw Error('Namespace "'+a+'" already declared.');delete goog.implicitNamespaces_[a];for(var b=a;(b=b.substring(0,b.lastIndexOf(".")))&&!goog.getObjectByName(b);)goog.implicitNamespaces_[b]=!0}goog.exportPath_(a)};goog.setTestOnly=function(a){if(COMPILED&&!goog.DEBUG)throw a=a||"",Error("Importing test-only code into non-debug environment"+a?": "+a:".");}; -COMPILED||(goog.isProvided_=function(a){return!goog.implicitNamespaces_[a]&&!!goog.getObjectByName(a)},goog.implicitNamespaces_={});goog.getObjectByName=function(a,b){for(var c=a.split("."),d=b||goog.global,e;e=c.shift();)if(goog.isDefAndNotNull(d[e]))d=d[e];else return null;return d};goog.globalize=function(a,b){var c=b||goog.global,d;for(d in a)c[d]=a[d]}; -goog.addDependency=function(a,b,c){if(goog.DEPENDENCIES_ENABLED){var d;a=a.replace(/\\/g,"/");for(var e=goog.dependencies_,f=0;d=b[f];f++)e.nameToPath[d]=a,a in e.pathToNames||(e.pathToNames[a]={}),e.pathToNames[a][d]=!0;for(d=0;b=c[d];d++)a in e.requires||(e.requires[a]={}),e.requires[a][b]=!0}};goog.ENABLE_DEBUG_LOADER=!0; -goog.require=function(a){if(!COMPILED&&!goog.isProvided_(a)){if(goog.ENABLE_DEBUG_LOADER){var b=goog.getPathFromDeps_(a);if(b){goog.included_[b]=!0;goog.writeScripts_();return}}a="goog.require could not find: "+a;goog.global.console&&goog.global.console.error(a);throw Error(a);}};goog.basePath="";goog.nullFunction=function(){};goog.identityFunction=function(a,b){return a};goog.abstractMethod=function(){throw Error("unimplemented abstract method");}; -goog.addSingletonGetter=function(a){a.getInstance=function(){if(a.instance_)return a.instance_;goog.DEBUG&&(goog.instantiatedSingletons_[goog.instantiatedSingletons_.length]=a);return a.instance_=new a}};goog.instantiatedSingletons_=[];goog.DEPENDENCIES_ENABLED=!COMPILED&&goog.ENABLE_DEBUG_LOADER; -goog.DEPENDENCIES_ENABLED&&(goog.included_={},goog.dependencies_={pathToNames:{},nameToPath:{},requires:{},visited:{},written:{}},goog.inHtmlDocument_=function(){var a=goog.global.document;return"undefined"!=typeof a&&"write"in a},goog.findBasePath_=function(){if(goog.global.CLOSURE_BASE_PATH)goog.basePath=goog.global.CLOSURE_BASE_PATH;else if(goog.inHtmlDocument_())for(var a=goog.global.document.getElementsByTagName("script"),b=a.length-1;0<=b;--b){var c=a[b].src,d=c.lastIndexOf("?"),d=-1==d?c.length: -d;if("base.js"==c.substr(d-7,7)){goog.basePath=c.substr(0,d-7);break}}},goog.importScript_=function(a){var b=goog.global.CLOSURE_IMPORT_SCRIPT||goog.writeScriptTag_;!goog.dependencies_.written[a]&&b(a)&&(goog.dependencies_.written[a]=!0)},goog.writeScriptTag_=function(a){if(goog.inHtmlDocument_()){var b=goog.global.document;if("complete"==b.readyState){if(/\bdeps.js$/.test(a))return!1;throw Error('Cannot write "'+a+'" after document load');}b.write('