1091 lines
38 KiB
Diff
1091 lines
38 KiB
Diff
From 66eeefe02e5b4690beed014e863ddfa0c69b4a75 Mon Sep 17 00:00:00 2001
|
|
From: c0repwn3r <core@coredoes.dev>
|
|
Date: Tue, 23 May 2023 09:22:48 -0400
|
|
Subject: [PATCH] pyblocks basics - framework, disable useless scratch blocks -
|
|
add a couple blocks from a few categories
|
|
|
|
---
|
|
.idea/.gitignore | 5 +
|
|
blocks_vertical/control.js | 20 +-
|
|
blocks_vertical/default_toolbox.js | 245 +++++++++++++++++++
|
|
blocks_vertical/display.js | 63 +++++
|
|
blocks_vertical/hub.js | 42 ++++
|
|
blocks_vertical/hub_status_light.js | 43 ++++
|
|
blocks_vertical/imu.js | 118 +++++++++
|
|
blocks_vertical/input.js | 34 +++
|
|
blocks_vertical/{ => upstream}/data.js | 0
|
|
blocks_vertical/{ => upstream}/event.js | 0
|
|
blocks_vertical/{ => upstream}/extensions.js | 0
|
|
blocks_vertical/{ => upstream}/looks.js | 0
|
|
blocks_vertical/{ => upstream}/motion.js | 0
|
|
blocks_vertical/{ => upstream}/procedures.js | 0
|
|
blocks_vertical/{ => upstream}/sensing.js | 0
|
|
blocks_vertical/{ => upstream}/sound.js | 0
|
|
blocks_vertical/vertical_extensions.js | 3 +-
|
|
core/colours.js | 70 +++++-
|
|
core/constants.js | 24 +-
|
|
msg/js/en.js | 12 +
|
|
msg/json/en.json | 14 +-
|
|
msg/messages.js | 67 +++++
|
|
package.json | 2 +-
|
|
tests/custom_procedure_playground.html | 14 +-
|
|
tests/vertical_playground.html | 26 +-
|
|
tests/workspace_svg/index.html | 4 +-
|
|
26 files changed, 764 insertions(+), 42 deletions(-)
|
|
create mode 100644 .idea/.gitignore
|
|
create mode 100644 blocks_vertical/display.js
|
|
create mode 100644 blocks_vertical/hub.js
|
|
create mode 100644 blocks_vertical/hub_status_light.js
|
|
create mode 100644 blocks_vertical/imu.js
|
|
create mode 100644 blocks_vertical/input.js
|
|
rename blocks_vertical/{ => upstream}/data.js (100%)
|
|
rename blocks_vertical/{ => upstream}/event.js (100%)
|
|
rename blocks_vertical/{ => upstream}/extensions.js (100%)
|
|
rename blocks_vertical/{ => upstream}/looks.js (100%)
|
|
rename blocks_vertical/{ => upstream}/motion.js (100%)
|
|
rename blocks_vertical/{ => upstream}/procedures.js (100%)
|
|
rename blocks_vertical/{ => upstream}/sensing.js (100%)
|
|
rename blocks_vertical/{ => upstream}/sound.js (100%)
|
|
|
|
diff --git a/.idea/.gitignore b/.idea/.gitignore
|
|
new file mode 100644
|
|
index 00000000..b58b603f
|
|
--- /dev/null
|
|
+++ b/.idea/.gitignore
|
|
@@ -0,0 +1,5 @@
|
|
+# Default ignored files
|
|
+/shelf/
|
|
+/workspace.xml
|
|
+# Editor-based HTTP Client requests
|
|
+/httpRequests/
|
|
diff --git a/blocks_vertical/control.js b/blocks_vertical/control.js
|
|
index e5bb20b5..ac42c4bf 100644
|
|
--- a/blocks_vertical/control.js
|
|
+++ b/blocks_vertical/control.js
|
|
@@ -175,27 +175,27 @@ Blockly.Blocks['control_stop'] = {
|
|
* @this Blockly.Block
|
|
*/
|
|
init: function() {
|
|
- var ALL_SCRIPTS = 'all';
|
|
- var THIS_SCRIPT = 'this script';
|
|
- var OTHER_SCRIPTS = 'other scripts in sprite';
|
|
+ var AND_EXIT_PROGRAM = 'and exit program';
|
|
+ var AND_RESTART_PROGRAM = 'and restart program';
|
|
+ var AND_SHUTDOWN_HUB = 'and turn off hub';
|
|
var stopDropdown = new Blockly.FieldDropdown(function() {
|
|
if (this.sourceBlock_ &&
|
|
this.sourceBlock_.nextConnection &&
|
|
this.sourceBlock_.nextConnection.isConnected()) {
|
|
- return [
|
|
- [Blockly.Msg.CONTROL_STOP_OTHER, OTHER_SCRIPTS]
|
|
- ];
|
|
+ return [[Blockly.Msg.CONTROL_STOP_EXIT, AND_EXIT_PROGRAM],
|
|
+ [Blockly.Msg.CONTROL_STOP_RESTART, AND_RESTART_PROGRAM],
|
|
+ [Blockly.Msg.CONTROL_STOP_SHUTDOWN, AND_SHUTDOWN_HUB]];
|
|
}
|
|
- return [[Blockly.Msg.CONTROL_STOP_ALL, ALL_SCRIPTS],
|
|
- [Blockly.Msg.CONTROL_STOP_THIS, THIS_SCRIPT],
|
|
- [Blockly.Msg.CONTROL_STOP_OTHER, OTHER_SCRIPTS]
|
|
+ return [[Blockly.Msg.CONTROL_STOP_EXIT, AND_EXIT_PROGRAM],
|
|
+ [Blockly.Msg.CONTROL_STOP_RESTART, AND_RESTART_PROGRAM],
|
|
+ [Blockly.Msg.CONTROL_STOP_SHUTDOWN, AND_SHUTDOWN_HUB]
|
|
];
|
|
}, function(option) {
|
|
// Create an event group to keep field value and mutator in sync
|
|
// Return null at the end because setValue is called here already.
|
|
Blockly.Events.setGroup(true);
|
|
var oldMutation = Blockly.Xml.domToText(this.sourceBlock_.mutationToDom());
|
|
- this.sourceBlock_.setNextStatement(option == OTHER_SCRIPTS);
|
|
+ this.sourceBlock_.setNextStatement(option == AND_SHUTDOWN_HUB);
|
|
var newMutation = Blockly.Xml.domToText(this.sourceBlock_.mutationToDom());
|
|
Blockly.Events.fire(new Blockly.Events.BlockChange(this.sourceBlock_,
|
|
'mutation', null, oldMutation, newMutation));
|
|
diff --git a/blocks_vertical/default_toolbox.js b/blocks_vertical/default_toolbox.js
|
|
index 8c5624fa..8516e0db 100644
|
|
--- a/blocks_vertical/default_toolbox.js
|
|
+++ b/blocks_vertical/default_toolbox.js
|
|
@@ -28,6 +28,248 @@ goog.require('Blockly.Blocks');
|
|
* @fileoverview Provide a default toolbox XML.
|
|
*/
|
|
|
|
+Blockly.Blocks.defaultToolbox = '<xml id="toolbox-categories" style="display: none">' +
|
|
+ '<category name="%{BKY_CATEGORY_HUB}" id="hub" colour="#4C97FF" secondaryColour="#3373CC">' +
|
|
+ '<block type="hub_init" id="hub_init">' +
|
|
+ '<value name="UPSIDE">_axis_z_</value>' +
|
|
+ '<value name="FRONTSIDE">_axis_x_</value>' +
|
|
+ '</block>' +
|
|
+ '<block type="hub_statuslight_set" id="hub_statuslight_set">' +
|
|
+ '<value name="COLOR">' +
|
|
+ '<shadow type="colour_picker"></shadow>' +
|
|
+ '</value>' +
|
|
+ '</block>' +
|
|
+ '<block type="hub_statuslight_off" id="hub_statuslight_off"></block>' +
|
|
+ '</category>' +
|
|
+ '<category name="%{BKY_CATEGORY_DISPLAY}" id="display" colour="#9966FF" secondaryColour="#3373CC">' +
|
|
+ '<block type="hub_display_off" id="hub_display_off"></block>' +
|
|
+ '<block type="hub_display_num" id="hub_display_num">' +
|
|
+ '<value name="VALUE">' +
|
|
+ '<shadow type="math_integer">' +
|
|
+ '<field name="NUM">10</field>' +
|
|
+ '</shadow>' +
|
|
+ '</value>' +
|
|
+ '</block>' +
|
|
+ '<block type="hub_display_string" id="hub_display_string"></block>' +
|
|
+ '</category>' +
|
|
+ '<category name="%{BKY_CATEGORY_INPUT}" id="input" colour="#CF63CF" secondaryColour="#3373CC">' +
|
|
+ '<block type="hub_input_isbuttonpressed" id="hub_input_isbuttonpressed">' +
|
|
+ '<value name="BUTTON">_button_left_</value>' +
|
|
+ '</block>' +
|
|
+ '</category>' +
|
|
+ '<category name="%{BKY_CATEGORY_IMU}" id="imu" colour="#FFAB19" secondaryColour="#3373CC">' +
|
|
+ '<block type="hub_imu_isready" id="hub_imu_isready"></block>' +
|
|
+ '<block type="hub_imu_ismoving" id="hub_imu_ismoving"></block>' +
|
|
+ '<block type="hub_imu_pitch" id="hub_imu_pitch"></block>' +
|
|
+ '<block type="hub_imu_roll" id="hub_imu_roll"></block>' +
|
|
+ '<block type="hub_imu_accel" id="hub_imu_accel"></block>' +
|
|
+ '<block type="hub_imu_avel" id="hub_imu_avel"></block>' +
|
|
+ '</category>' +
|
|
+ '<category name="%{BKY_CATEGORY_SOUND}" id="sound" colour="#FFBF00" secondaryColour="#3373CC">' +
|
|
+ '</category>' +
|
|
+ '<category name="%{BKY_CATEGORY_BATTERY}" id="battery" colour="#5CB1D6" secondaryColour="#3373CC">' +
|
|
+ '</category>' +
|
|
+ '<category name="%{BKY_CATEGORY_SYSTEM}" id="system" colour="#0fBD8C" secondaryColour="#3373CC">' +
|
|
+ '</category>' +
|
|
+ '<category name="%{BKY_CATEGORY_DCMOTORS}" id="dcmotors" colour="#59C059" secondaryColour="#3373CC">' +
|
|
+ '</category>' +
|
|
+ '<category name="%{BKY_CATEGORY_MOTORS}" id="motors" colour="#FF8C1A" secondaryColour="#3373CC">' +
|
|
+ '</category>' +
|
|
+ '<category name="%{BKY_CATEGORY_SENSORS}" id="sensors" colour="#FF661A" secondaryColour="#3373CC">' +
|
|
+ '</category>' +
|
|
+ '<category name="%{BKY_CATEGORY_MISC}" id="misc" colour="#FF6680" secondaryColour="#3373CC">' +
|
|
+ '</category>' +
|
|
+ '<category name="%{BKY_CATEGORY_MOVEMENT}" id="movement" colour="#FF6680" secondaryColour="#3373CC">' +
|
|
+ '</category>' +
|
|
+ '<category name="%{BKY_CATEGORY_RNG}" id="rng" colour="#FF6680" secondaryColour="#3373CC">' +
|
|
+ '</category>' +
|
|
+ '<category name="%{BKY_CATEGORY_CONTROL}" id="control" colour="#FFAB19" secondaryColour="#CF8B17">' +
|
|
+ '<block type="control_wait" id="control_wait">' +
|
|
+ '<value name="DURATION">' +
|
|
+ '<shadow type="math_positive_number">' +
|
|
+ '<field name="NUM">1</field>' +
|
|
+ '</shadow>' +
|
|
+ '</value>' +
|
|
+ '</block>' +
|
|
+ '<block type="control_repeat" id="control_repeat">' +
|
|
+ '<value name="TIMES">' +
|
|
+ '<shadow type="math_whole_number">' +
|
|
+ '<field name="NUM">10</field>' +
|
|
+ '</shadow>' +
|
|
+ '</value>' +
|
|
+ '</block>' +
|
|
+ '<block type="control_forever" id="control_forever"></block>' +
|
|
+ '<block type="control_if" id="control_if"></block>' +
|
|
+ '<block type="control_if_else" id="control_if_else"></block>' +
|
|
+ '<block type="control_wait_until" id="control_wait_until"></block>' +
|
|
+ '<block type="control_repeat_until" id="control_repeat_until"></block>' +
|
|
+ '<block type="control_stop" id="control_stop"></block>' +
|
|
+ '</category>' +
|
|
+ '<category name="%{BKY_CATEGORY_OPERATORS}" id="operators" colour="#40BF4A" secondaryColour="#389438">' +
|
|
+ '<block type="operator_add" id="operator_add">' +
|
|
+ '<value name="NUM1">' +
|
|
+ '<shadow type="math_number">' +
|
|
+ '<field name="NUM"></field>' +
|
|
+ '</shadow>' +
|
|
+ '</value>' +
|
|
+ '<value name="NUM2">' +
|
|
+ '<shadow type="math_number">' +
|
|
+ '<field name="NUM"></field>' +
|
|
+ '</shadow>' +
|
|
+ '</value>' +
|
|
+ '</block>' +
|
|
+ '<block type="operator_subtract" id="operator_subtract">' +
|
|
+ '<value name="NUM1">' +
|
|
+ '<shadow type="math_number">' +
|
|
+ '<field name="NUM"></field>' +
|
|
+ '</shadow>' +
|
|
+ '</value>' +
|
|
+ '<value name="NUM2">' +
|
|
+ '<shadow type="math_number">' +
|
|
+ '<field name="NUM"></field>' +
|
|
+ '</shadow>' +
|
|
+ '</value>' +
|
|
+ '</block>' +
|
|
+ '<block type="operator_multiply" id="operator_multiply">' +
|
|
+ '<value name="NUM1">' +
|
|
+ '<shadow type="math_number">' +
|
|
+ '<field name="NUM"></field>' +
|
|
+ '</shadow>' +
|
|
+ '</value>' +
|
|
+ '<value name="NUM2">' +
|
|
+ '<shadow type="math_number">' +
|
|
+ '<field name="NUM"></field>' +
|
|
+ '</shadow>' +
|
|
+ '</value>' +
|
|
+ '</block>' +
|
|
+ '<block type="operator_divide" id="operator_divide">' +
|
|
+ '<value name="NUM1">' +
|
|
+ '<shadow type="math_number">' +
|
|
+ '<field name="NUM"></field>' +
|
|
+ '</shadow>' +
|
|
+ '</value>' +
|
|
+ '<value name="NUM2">' +
|
|
+ '<shadow type="math_number">' +
|
|
+ '<field name="NUM"></field>' +
|
|
+ '</shadow>' +
|
|
+ '</value>' +
|
|
+ '</block>' +
|
|
+ '<block type="operator_lt" id="operator_lt">' +
|
|
+ '<value name="OPERAND1">' +
|
|
+ '<shadow type="text">' +
|
|
+ '<field name="TEXT"></field>' +
|
|
+ '</shadow>' +
|
|
+ '</value>' +
|
|
+ '<value name="OPERAND2">' +
|
|
+ '<shadow type="text">' +
|
|
+ '<field name="TEXT"></field>' +
|
|
+ '</shadow>' +
|
|
+ '</value>' +
|
|
+ '</block>' +
|
|
+ '<block type="operator_equals" id="operator_equals">' +
|
|
+ '<value name="OPERAND1">' +
|
|
+ '<shadow type="text">' +
|
|
+ '<field name="TEXT"></field>' +
|
|
+ '</shadow>' +
|
|
+ '</value>' +
|
|
+ '<value name="OPERAND2">' +
|
|
+ '<shadow type="text">' +
|
|
+ '<field name="TEXT"></field>' +
|
|
+ '</shadow>' +
|
|
+ '</value>' +
|
|
+ '</block>' +
|
|
+ '<block type="operator_gt" id="operator_gt">' +
|
|
+ '<value name="OPERAND1">' +
|
|
+ '<shadow type="text">' +
|
|
+ '<field name="TEXT"></field>' +
|
|
+ '</shadow>' +
|
|
+ '</value>' +
|
|
+ '<value name="OPERAND2">' +
|
|
+ '<shadow type="text">' +
|
|
+ '<field name="TEXT"></field>' +
|
|
+ '</shadow>' +
|
|
+ '</value>' +
|
|
+ '</block>' +
|
|
+ '<block type="operator_and" id="operator_and"></block>' +
|
|
+ '<block type="operator_or" id="operator_or"></block>' +
|
|
+ '<block type="operator_not" id="operator_not"></block>' +
|
|
+ '<block type="operator_join" id="operator_join">' +
|
|
+ '<value name="STRING1">' +
|
|
+ '<shadow type="text">' +
|
|
+ '<field name="TEXT">hello</field>' +
|
|
+ '</shadow>' +
|
|
+ '</value>' +
|
|
+ '<value name="STRING2">' +
|
|
+ '<shadow type="text">' +
|
|
+ '<field name="TEXT">world</field>' +
|
|
+ '</shadow>' +
|
|
+ '</value>' +
|
|
+ '</block>' +
|
|
+ '<block type="operator_letter_of" id="operator_letter_of">' +
|
|
+ '<value name="LETTER">' +
|
|
+ '<shadow type="math_whole_number">' +
|
|
+ '<field name="NUM">1</field>' +
|
|
+ '</shadow>' +
|
|
+ '</value>' +
|
|
+ '<value name="STRING">' +
|
|
+ '<shadow type="text">' +
|
|
+ '<field name="TEXT">world</field>' +
|
|
+ '</shadow>' +
|
|
+ '</value>' +
|
|
+ '</block>' +
|
|
+ '<block type="operator_length" id="operator_length">' +
|
|
+ '<value name="STRING">' +
|
|
+ '<shadow type="text">' +
|
|
+ '<field name="TEXT">world</field>' +
|
|
+ '</shadow>' +
|
|
+ '</value>' +
|
|
+ '</block>' +
|
|
+ '<block type="operator_contains" id="operator_contains">' +
|
|
+ '<value name="STRING1">' +
|
|
+ '<shadow type="text">' +
|
|
+ '<field name="TEXT">hello</field>' +
|
|
+ '</shadow>' +
|
|
+ '</value>' +
|
|
+ '<value name="STRING2">' +
|
|
+ '<shadow type="text">' +
|
|
+ '<field name="TEXT">world</field>' +
|
|
+ '</shadow>' +
|
|
+ '</value>' +
|
|
+ '</block>' +
|
|
+ '<block type="operator_mod" id="operator_mod">' +
|
|
+ '<value name="NUM1">' +
|
|
+ '<shadow type="math_number">' +
|
|
+ '<field name="NUM"></field>' +
|
|
+ '</shadow>' +
|
|
+ '</value>' +
|
|
+ '<value name="NUM2">' +
|
|
+ '<shadow type="math_number">' +
|
|
+ '<field name="NUM"></field>' +
|
|
+ '</shadow>' +
|
|
+ '</value>' +
|
|
+ '</block>' +
|
|
+ '<block type="operator_round" id="operator_round">' +
|
|
+ '<value name="NUM">' +
|
|
+ '<shadow type="math_number">' +
|
|
+ '<field name="NUM"></field>' +
|
|
+ '</shadow>' +
|
|
+ '</value>' +
|
|
+ '</block>' +
|
|
+ '<block type="operator_mathop" id="operator_mathop">' +
|
|
+ '<value name="NUM">' +
|
|
+ '<shadow type="math_number">' +
|
|
+ '<field name="NUM"></field>' +
|
|
+ '</shadow>' +
|
|
+ '</value>' +
|
|
+ '</block>' +
|
|
+ '</category>' +
|
|
+ '<category name="%{BKY_CATEGORY_VARIABLES}" id="data" colour="#FF8C1A" secondaryColour="#DB6E00" custom="VARIABLE">' +
|
|
+ '</category>' +
|
|
+ '<category name="%{BKY_CATEGORY_MYBLOCKS}" id="more" colour="#FF6680" secondaryColour="#FF4D6A" custom="PROCEDURE">' +
|
|
+ '</category>' +
|
|
+ '</xml>';
|
|
+
|
|
+/*
|
|
Blockly.Blocks.defaultToolbox = '<xml id="toolbox-categories" style="display: none">' +
|
|
'<category name="%{BKY_CATEGORY_MOTION}" id="motion" colour="#4C97FF" secondaryColour="#3373CC">' +
|
|
'<block type="motion_movesteps" id="motion_movesteps">' +
|
|
@@ -562,3 +804,6 @@ Blockly.Blocks.defaultToolbox = '<xml id="toolbox-categories" style="display: no
|
|
'</block>' +
|
|
'</category>' +
|
|
'</xml>';
|
|
+
|
|
+
|
|
+ */
|
|
diff --git a/blocks_vertical/display.js b/blocks_vertical/display.js
|
|
new file mode 100644
|
|
index 00000000..22338b5e
|
|
--- /dev/null
|
|
+++ b/blocks_vertical/display.js
|
|
@@ -0,0 +1,63 @@
|
|
+'use strict';
|
|
+
|
|
+goog.provide('Blockly.Blocks.Hub.Display');
|
|
+
|
|
+goog.require('Blockly.Blocks');
|
|
+goog.require('Blockly.Colours');
|
|
+goog.require('Blockly.constants');
|
|
+goog.require('Blockly.ScratchBlocks.VerticalExtensions');
|
|
+
|
|
+Blockly.Blocks['hub_display_off'] = {
|
|
+ /**
|
|
+ * Block to turn off all pixels on the hub display.
|
|
+ * @this Blockly.Block
|
|
+ */
|
|
+ init: function() {
|
|
+ this.jsonInit({
|
|
+ "message0": Blockly.Msg.HUB_DISPLAY_OFF,
|
|
+ "args0": [],
|
|
+ "category": Blockly.Categories.hub,
|
|
+ "extensions": ["colours_display", "shape_statement"]
|
|
+ });
|
|
+ }
|
|
+};
|
|
+
|
|
+Blockly.Blocks['hub_display_num'] = {
|
|
+ /**
|
|
+ * Block to show a number from -99 to 99 on the display
|
|
+ * @this Blockly.Block
|
|
+ */
|
|
+ init: function() {
|
|
+ this.jsonInit({
|
|
+ "message0": Blockly.Msg.HUB_DISPLAY_NUM,
|
|
+ "args0": [
|
|
+ {
|
|
+ "type": "input_value",
|
|
+ "name": "VALUE"
|
|
+ }
|
|
+ ],
|
|
+ "category": Blockly.Categories.hub,
|
|
+ "extensions": ["colours_display", "shape_statement"]
|
|
+ });
|
|
+ }
|
|
+};
|
|
+
|
|
+Blockly.Blocks['hub_display_string'] = {
|
|
+ /**
|
|
+ * Block to scroll text or numbers across the display
|
|
+ * @this Blockly.Block
|
|
+ */
|
|
+ init: function() {
|
|
+ this.jsonInit({
|
|
+ "message0": Blockly.Msg.HUB_DISPLAY_STRING,
|
|
+ "args0": [
|
|
+ {
|
|
+ "type": "input_value",
|
|
+ "name": "VALUE"
|
|
+ }
|
|
+ ],
|
|
+ "category": Blockly.Categories.hub,
|
|
+ "extensions": ["colours_display", "shape_statement"]
|
|
+ });
|
|
+ }
|
|
+};
|
|
diff --git a/blocks_vertical/hub.js b/blocks_vertical/hub.js
|
|
new file mode 100644
|
|
index 00000000..2941f14d
|
|
--- /dev/null
|
|
+++ b/blocks_vertical/hub.js
|
|
@@ -0,0 +1,42 @@
|
|
+'use strict';
|
|
+
|
|
+goog.provide('Blockly.Blocks.Hub.Hub');
|
|
+
|
|
+goog.require('Blockly.Blocks');
|
|
+goog.require('Blockly.Colours');
|
|
+goog.require('Blockly.constants');
|
|
+goog.require('Blockly.ScratchBlocks.VerticalExtensions');
|
|
+
|
|
+Blockly.Blocks['hub_init'] = {
|
|
+ /**
|
|
+ * Block to initialize the hub with custom axis directions.
|
|
+ * @this Blockly.Block
|
|
+ */
|
|
+ init: function() {
|
|
+ this.jsonInit({
|
|
+ "message0": Blockly.Msg.HUB_INIT,
|
|
+ "args0": [
|
|
+ {
|
|
+ "type": "field_dropdown",
|
|
+ "name": "UPSIDE",
|
|
+ "options": [
|
|
+ [Blockly.Msg.AXIS_Z, '_axis_z_'],
|
|
+ [Blockly.Msg.AXIS_X, '_axis_x_'],
|
|
+ [Blockly.Msg.AXIS_Y, '_axis_y_'],
|
|
+ ]
|
|
+ },
|
|
+ {
|
|
+ "type": "field_dropdown",
|
|
+ "name": "FRONTSIDE",
|
|
+ "options": [
|
|
+ [Blockly.Msg.AXIS_X, '_axis_x_'],
|
|
+ [Blockly.Msg.AXIS_Y, '_axis_y_'],
|
|
+ [Blockly.Msg.AXIS_Z, '_axis_z_'],
|
|
+ ]
|
|
+ },
|
|
+ ],
|
|
+ "category": Blockly.Categories.hub,
|
|
+ "extensions": ["colours_hub", "shape_statement"]
|
|
+ });
|
|
+ }
|
|
+};
|
|
diff --git a/blocks_vertical/hub_status_light.js b/blocks_vertical/hub_status_light.js
|
|
new file mode 100644
|
|
index 00000000..8bcea378
|
|
--- /dev/null
|
|
+++ b/blocks_vertical/hub_status_light.js
|
|
@@ -0,0 +1,43 @@
|
|
+'use strict';
|
|
+
|
|
+goog.provide('Blockly.Blocks.Hub.StatusLight');
|
|
+
|
|
+goog.require('Blockly.Blocks');
|
|
+goog.require('Blockly.Colours');
|
|
+goog.require('Blockly.constants');
|
|
+goog.require('Blockly.ScratchBlocks.VerticalExtensions');
|
|
+
|
|
+Blockly.Blocks['hub_statuslight_set'] = {
|
|
+ /**
|
|
+ * Block to turn on the hub status light to a specific color.
|
|
+ * @this Blockly.Block
|
|
+ */
|
|
+ init: function() {
|
|
+ this.jsonInit({
|
|
+ "message0": Blockly.Msg.HUB_STATUSLIGHT_SET,
|
|
+ "args0": [
|
|
+ {
|
|
+ "type": "input_value",
|
|
+ "name": "COLOR"
|
|
+ }
|
|
+ ],
|
|
+ "category": Blockly.Categories.hub,
|
|
+ "extensions": ["colours_hub", "shape_statement"]
|
|
+ });
|
|
+ }
|
|
+};
|
|
+
|
|
+Blockly.Blocks['hub_statuslight_off'] = {
|
|
+ /**
|
|
+ * Block to turn off the hub status light.
|
|
+ * @this Blockly.Block
|
|
+ */
|
|
+ init: function() {
|
|
+ this.jsonInit({
|
|
+ "message0": Blockly.Msg.HUB_STATUSLIGHT_OFF,
|
|
+ "args0": [],
|
|
+ "category": Blockly.Categories.hub,
|
|
+ "extensions": ["colours_hub", "shape_statement"]
|
|
+ });
|
|
+ }
|
|
+};
|
|
diff --git a/blocks_vertical/imu.js b/blocks_vertical/imu.js
|
|
new file mode 100644
|
|
index 00000000..0e09a248
|
|
--- /dev/null
|
|
+++ b/blocks_vertical/imu.js
|
|
@@ -0,0 +1,118 @@
|
|
+'use strict';
|
|
+
|
|
+goog.provide('Blockly.Blocks.Hub.Imu');
|
|
+
|
|
+goog.require('Blockly.Blocks');
|
|
+goog.require('Blockly.Colours');
|
|
+goog.require('Blockly.constants');
|
|
+goog.require('Blockly.ScratchBlocks.VerticalExtensions');
|
|
+
|
|
+Blockly.Blocks['hub_imu_isready'] = {
|
|
+ /**
|
|
+ * Block to check if the IMU is ready.
|
|
+ * @this Blockly.Block
|
|
+ */
|
|
+ init: function() {
|
|
+ this.jsonInit({
|
|
+ "message0": Blockly.Msg.HUB_IMU_ISREADY,
|
|
+ "args0": [],
|
|
+ "category": Blockly.Categories.imu,
|
|
+ "extensions": ["colours_imu", "output_boolean"]
|
|
+ });
|
|
+ }
|
|
+};
|
|
+
|
|
+Blockly.Blocks['hub_imu_ismoving'] = {
|
|
+ /**
|
|
+ * Block to check if the hub is moving, or still for >1 second.
|
|
+ * @this Blockly.Block
|
|
+ */
|
|
+ init: function() {
|
|
+ this.jsonInit({
|
|
+ "message0": Blockly.Msg.HUB_IMU_ISMOVING,
|
|
+ "args0": [],
|
|
+ "category": Blockly.Categories.imu,
|
|
+ "extensions": ["colours_imu", "output_boolean"]
|
|
+ });
|
|
+ }
|
|
+};
|
|
+
|
|
+Blockly.Blocks['hub_imu_pitch'] = {
|
|
+ /**
|
|
+ * Block to get the current pitch angle
|
|
+ * @this Blockly.Block
|
|
+ */
|
|
+ init: function() {
|
|
+ this.jsonInit({
|
|
+ "message0": Blockly.Msg.HUB_IMU_PITCH,
|
|
+ "args0": [],
|
|
+ "category": Blockly.Categories.imu,
|
|
+ "extensions": ["colours_imu", "output_number"]
|
|
+ });
|
|
+ }
|
|
+};
|
|
+
|
|
+Blockly.Blocks['hub_imu_roll'] = {
|
|
+ /**
|
|
+ * Block to get the current roll angle.
|
|
+ * @this Blockly.Block
|
|
+ */
|
|
+ init: function() {
|
|
+ this.jsonInit({
|
|
+ "message0": Blockly.Msg.HUB_IMU_ROLL,
|
|
+ "args0": [],
|
|
+ "category": Blockly.Categories.imu,
|
|
+ "extensions": ["colours_imu", "output_number"]
|
|
+ });
|
|
+ }
|
|
+};
|
|
+
|
|
+Blockly.Blocks['hub_imu_accel'] = {
|
|
+ /**
|
|
+ * Block to get the acceleration on an axis.
|
|
+ * @this Blockly.Block
|
|
+ */
|
|
+ init: function() {
|
|
+ this.jsonInit({
|
|
+ "message0": Blockly.Msg.HUB_IMU_ACCEL,
|
|
+ "args0": [
|
|
+ {
|
|
+ "type": "field_dropdown",
|
|
+ "name": "AXIS",
|
|
+ "options": [
|
|
+ [Blockly.Msg.AXIS_X, "_axis_x_"],
|
|
+ [Blockly.Msg.AXIS_Y, "_axis_y_"],
|
|
+ [Blockly.Msg.AXIS_Z, "_axis_z_"]
|
|
+ ]
|
|
+ }
|
|
+ ],
|
|
+ "category": Blockly.Categories.imu,
|
|
+ "extensions": ["colours_imu", "output_boolean"]
|
|
+ });
|
|
+ }
|
|
+};
|
|
+
|
|
+Blockly.Blocks['hub_imu_avel'] = {
|
|
+ /**
|
|
+ * Block to get the angular velocity on an axis.
|
|
+ * @this Blockly.Block
|
|
+ */
|
|
+ init: function() {
|
|
+ this.jsonInit({
|
|
+ "message0": Blockly.Msg.HUB_IMU_AVEL,
|
|
+ "args0": [
|
|
+ {
|
|
+ "type": "field_dropdown",
|
|
+ "name": "AXIS",
|
|
+ "options": [
|
|
+ [Blockly.Msg.AXIS_X, "_axis_x_"],
|
|
+ [Blockly.Msg.AXIS_Y, "_axis_y_"],
|
|
+ [Blockly.Msg.AXIS_Z, "_axis_z_"]
|
|
+ ]
|
|
+ }
|
|
+ ],
|
|
+ "category": Blockly.Categories.imu,
|
|
+ "extensions": ["colours_imu", "output_boolean"]
|
|
+ });
|
|
+ }
|
|
+};
|
|
diff --git a/blocks_vertical/input.js b/blocks_vertical/input.js
|
|
new file mode 100644
|
|
index 00000000..271e2d46
|
|
--- /dev/null
|
|
+++ b/blocks_vertical/input.js
|
|
@@ -0,0 +1,34 @@
|
|
+'use strict';
|
|
+
|
|
+goog.provide('Blockly.Blocks.Hub.Input');
|
|
+
|
|
+goog.require('Blockly.Blocks');
|
|
+goog.require('Blockly.Colours');
|
|
+goog.require('Blockly.constants');
|
|
+goog.require('Blockly.ScratchBlocks.VerticalExtensions');
|
|
+
|
|
+Blockly.Blocks['hub_input_isbuttonpressed'] = {
|
|
+ /**
|
|
+ * Block to check if a button is pressed.
|
|
+ * @this Blockly.Block
|
|
+ */
|
|
+ init: function() {
|
|
+ this.jsonInit({
|
|
+ "message0": Blockly.Msg.HUB_INPUT_ISBUTTONPRESSED,
|
|
+ "args0": [
|
|
+ {
|
|
+ "type": "field_dropdown",
|
|
+ "name": "BUTTON",
|
|
+ "options": [
|
|
+ [Blockly.Msg.BUTTON_LEFT, '_button_left_'],
|
|
+ [Blockly.Msg.BUTTON_CENTER, '_button_center_'],
|
|
+ [Blockly.Msg.BUTTON_RIGHT, '_button_right_'],
|
|
+ [Blockly.Msg.BUTTON_BT, '_button_bt_']
|
|
+ ]
|
|
+ }
|
|
+ ],
|
|
+ "category": Blockly.Categories.input,
|
|
+ "extensions": ["colours_input", "output_boolean"]
|
|
+ });
|
|
+ }
|
|
+};
|
|
diff --git a/blocks_vertical/data.js b/blocks_vertical/upstream/data.js
|
|
similarity index 100%
|
|
rename from blocks_vertical/data.js
|
|
rename to blocks_vertical/upstream/data.js
|
|
diff --git a/blocks_vertical/event.js b/blocks_vertical/upstream/event.js
|
|
similarity index 100%
|
|
rename from blocks_vertical/event.js
|
|
rename to blocks_vertical/upstream/event.js
|
|
diff --git a/blocks_vertical/extensions.js b/blocks_vertical/upstream/extensions.js
|
|
similarity index 100%
|
|
rename from blocks_vertical/extensions.js
|
|
rename to blocks_vertical/upstream/extensions.js
|
|
diff --git a/blocks_vertical/looks.js b/blocks_vertical/upstream/looks.js
|
|
similarity index 100%
|
|
rename from blocks_vertical/looks.js
|
|
rename to blocks_vertical/upstream/looks.js
|
|
diff --git a/blocks_vertical/motion.js b/blocks_vertical/upstream/motion.js
|
|
similarity index 100%
|
|
rename from blocks_vertical/motion.js
|
|
rename to blocks_vertical/upstream/motion.js
|
|
diff --git a/blocks_vertical/procedures.js b/blocks_vertical/upstream/procedures.js
|
|
similarity index 100%
|
|
rename from blocks_vertical/procedures.js
|
|
rename to blocks_vertical/upstream/procedures.js
|
|
diff --git a/blocks_vertical/sensing.js b/blocks_vertical/upstream/sensing.js
|
|
similarity index 100%
|
|
rename from blocks_vertical/sensing.js
|
|
rename to blocks_vertical/upstream/sensing.js
|
|
diff --git a/blocks_vertical/sound.js b/blocks_vertical/upstream/sound.js
|
|
similarity index 100%
|
|
rename from blocks_vertical/sound.js
|
|
rename to blocks_vertical/upstream/sound.js
|
|
diff --git a/blocks_vertical/vertical_extensions.js b/blocks_vertical/vertical_extensions.js
|
|
index 76fe3aa5..7a6b117f 100644
|
|
--- a/blocks_vertical/vertical_extensions.js
|
|
+++ b/blocks_vertical/vertical_extensions.js
|
|
@@ -222,7 +222,8 @@ Blockly.ScratchBlocks.VerticalExtensions.SCRATCH_EXTENSION = function() {
|
|
Blockly.ScratchBlocks.VerticalExtensions.registerAll = function() {
|
|
var categoryNames =
|
|
['control', 'data', 'data_lists', 'sounds', 'motion', 'looks', 'event',
|
|
- 'sensing', 'pen', 'operators', 'more'];
|
|
+ 'sensing', 'pen', 'operators', 'more', 'hub', 'display', 'input', 'imu',
|
|
+ 'sound', 'battery', 'system', 'dcmotors', 'motors', 'sensors', 'misc', 'movement', 'rng']; // PyBlocks
|
|
// Register functions for all category colours.
|
|
for (var i = 0; i < categoryNames.length; i++) {
|
|
var name = categoryNames[i];
|
|
diff --git a/core/colours.js b/core/colours.js
|
|
index bb205cdd..b005af78 100644
|
|
--- a/core/colours.js
|
|
+++ b/core/colours.js
|
|
@@ -110,7 +110,75 @@ Blockly.Colours = {
|
|
"numPadActiveBackground": "#435F91",
|
|
"numPadText": "white", // Do not use hex here, it cannot be inlined with data-uri SVG
|
|
"valueReportBackground": "#FFFFFF",
|
|
- "valueReportBorder": "#AAAAAA"
|
|
+ "valueReportBorder": "#AAAAAA",
|
|
+
|
|
+ // PyBlocks start
|
|
+ "hub": {
|
|
+ "primary": "#4C97FF",
|
|
+ "secondary": "#4280D7",
|
|
+ "tertiary": "#3373CC"
|
|
+ },
|
|
+ "display": {
|
|
+ "primary": "#9966FF",
|
|
+ "secondary": "#855CD6",
|
|
+ "tertiary": "#774DCB"
|
|
+ },
|
|
+ "input": {
|
|
+ "primary": "#CF63CF",
|
|
+ "secondary": "#C94FC9",
|
|
+ "tertiary": "#BD42BD"
|
|
+ },
|
|
+ "imu": {
|
|
+ "primary": "#FFAB19",
|
|
+ "secondary": "#EC9C13",
|
|
+ "tertiary": "#CF8B17"
|
|
+ },
|
|
+ "sound": {
|
|
+ "primary": "#FFBF00",
|
|
+ "secondary": "#E6AC00",
|
|
+ "tertiary": "#CC9900"
|
|
+ },
|
|
+ "battery": {
|
|
+ "primary": "#5CB1D6",
|
|
+ "secondary": "#47A8D1",
|
|
+ "tertiary": "#2E8EB8"
|
|
+ },
|
|
+ "system": {
|
|
+ "primary": "#0fBD8C",
|
|
+ "secondary": "#0DA57A",
|
|
+ "tertiary": "#0B8E69"
|
|
+ },
|
|
+ "dcmotors": {
|
|
+ "primary": "#59C059",
|
|
+ "secondary": "#46B946",
|
|
+ "tertiary": "#389438"
|
|
+ },
|
|
+ "motors": {
|
|
+ "primary": "#FF8C1A",
|
|
+ "secondary": "#FF8000",
|
|
+ "tertiary": "#DB6E00"
|
|
+ },
|
|
+ "sensors": {
|
|
+ "primary": "#FF661A",
|
|
+ "secondary": "#FF5500",
|
|
+ "tertiary": "#E64D00"
|
|
+ },
|
|
+ "movement": {
|
|
+ "primary": "#FF6680",
|
|
+ "secondary": "#FF4D6A",
|
|
+ "tertiary": "#FF3355"
|
|
+ },
|
|
+ "misc": {
|
|
+ "primary": "#FF6680",
|
|
+ "secondary": "#FF4D6A",
|
|
+ "tertiary": "#FF3355"
|
|
+ },
|
|
+ "rng": {
|
|
+ "primary": "#FF6680",
|
|
+ "secondary": "#FF4D6A",
|
|
+ "tertiary": "#FF3355"
|
|
+ }
|
|
+ // PyBlocks end
|
|
};
|
|
|
|
/**
|
|
diff --git a/core/constants.js b/core/constants.js
|
|
index 2b6d6535..ace3d050 100644
|
|
--- a/core/constants.js
|
|
+++ b/core/constants.js
|
|
@@ -258,19 +258,29 @@ Blockly.OUTPUT_SHAPE_SQUARE = 3;
|
|
* ENUM for categories.
|
|
* @const
|
|
*/
|
|
+// PyBlocks start
|
|
Blockly.Categories = {
|
|
- "motion": "motion",
|
|
- "looks": "looks",
|
|
- "sound": "sounds",
|
|
- "pen": "pen",
|
|
"data": "data",
|
|
"dataLists": "data-lists",
|
|
- "event": "events",
|
|
"control": "control",
|
|
- "sensing": "sensing",
|
|
"operators": "operators",
|
|
- "more": "more"
|
|
+ "more": "more",
|
|
+
|
|
+ "hub": "hub",
|
|
+ "display": "display",
|
|
+ "input": "input",
|
|
+ "imu": "imu",
|
|
+ "sound": "sound",
|
|
+ "battery": "battery",
|
|
+ "system": "system",
|
|
+ "dcmotors": "dcmotors",
|
|
+ "motors": "motors",
|
|
+ "sensors": "sensors",
|
|
+ "misc": "misc",
|
|
+ "movement": "movement",
|
|
+ "rng": "rng"
|
|
};
|
|
+// PyBlocks end
|
|
|
|
/**
|
|
* ENUM representing that an event is not in any delete areas.
|
|
diff --git a/msg/js/en.js b/msg/js/en.js
|
|
index d08c4905..b7cf0b61 100644
|
|
--- a/msg/js/en.js
|
|
+++ b/msg/js/en.js
|
|
@@ -288,3 +288,15 @@ Blockly.Msg["NEW_BROADCAST_MESSAGE"] = "New message";
|
|
Blockly.Msg["NEW_BROADCAST_MESSAGE_TITLE"] = "New message name:";
|
|
Blockly.Msg["BROADCAST_MODAL_TITLE"] = "New Message";
|
|
Blockly.Msg["DEFAULT_BROADCAST_MESSAGE_NAME"] = "message1";
|
|
+Blockly.Msg["CATEGORY_HUB"] = "Hub";
|
|
+Blockly.Msg["CATEGORY_DISPLAY"] = "Display";
|
|
+Blockly.Msg["CATEGORY_INPUT"] = "Input";
|
|
+Blockly.Msg["CATEGORY_IMU"] = "IMU";
|
|
+Blockly.Msg["CATEGORY_BATTERY"] = "Battery";
|
|
+Blockly.Msg["CATEGORY_SYSTEM"] = "System";
|
|
+Blockly.Msg["CATEGORY_DCMOTORS"] = "DC Motors";
|
|
+Blockly.Msg["CATEGORY_MOTORS"] = "Motors";
|
|
+Blockly.Msg["CATEGORY_SENSORS"] = "Sensors";
|
|
+Blockly.Msg["CATEGORY_MISC"] = "Misc";
|
|
+Blockly.Msg["CATEGORY_MOVEMENT"] = "Movement";
|
|
+Blockly.Msg["CATEGORY_RNG"] = "RNG";
|
|
diff --git a/msg/json/en.json b/msg/json/en.json
|
|
index f12a6be2..6db15650 100644
|
|
--- a/msg/json/en.json
|
|
+++ b/msg/json/en.json
|
|
@@ -281,5 +281,17 @@
|
|
"NEW_BROADCAST_MESSAGE": "New message",
|
|
"NEW_BROADCAST_MESSAGE_TITLE": "New message name:",
|
|
"BROADCAST_MODAL_TITLE": "New Message",
|
|
- "DEFAULT_BROADCAST_MESSAGE_NAME": "message1"
|
|
+ "DEFAULT_BROADCAST_MESSAGE_NAME": "message1",
|
|
+ "CATEGORY_HUB": "Hub",
|
|
+ "CATEGORY_DISPLAY": "Display",
|
|
+ "CATEGORY_INPUT": "Input",
|
|
+ "CATEGORY_IMU": "IMU",
|
|
+ "CATEGORY_BATTERY": "Battery",
|
|
+ "CATEGORY_SYSTEM": "System",
|
|
+ "CATEGORY_DCMOTORS": "DC Motors",
|
|
+ "CATEGORY_MOTORS": "Motors",
|
|
+ "CATEGORY_SENSORS": "Sensors",
|
|
+ "CATEGORY_MISC": "Misc",
|
|
+ "CATEGORY_MOVEMENT": "Movement",
|
|
+ "CATEGORY_RNG": "RNG"
|
|
}
|
|
\ No newline at end of file
|
|
diff --git a/msg/messages.js b/msg/messages.js
|
|
index c7c1e613..feb70bcd 100644
|
|
--- a/msg/messages.js
|
|
+++ b/msg/messages.js
|
|
@@ -351,3 +351,70 @@ Blockly.Msg.NEW_BROADCAST_MESSAGE = 'New message';
|
|
Blockly.Msg.NEW_BROADCAST_MESSAGE_TITLE = 'New message name:';
|
|
Blockly.Msg.BROADCAST_MODAL_TITLE = 'New Message';
|
|
Blockly.Msg.DEFAULT_BROADCAST_MESSAGE_NAME = 'message1';
|
|
+
|
|
+// PyBlocks begin
|
|
+Blockly.Msg.CATEGORY_HUB = 'Hub';
|
|
+Blockly.Msg.CATEGORY_DISPLAY = 'Display';
|
|
+Blockly.Msg.CATEGORY_INPUT = 'Input';
|
|
+Blockly.Msg.CATEGORY_IMU = 'IMU';
|
|
+Blockly.Msg.CATEGORY_BATTERY = 'Battery';
|
|
+Blockly.Msg.CATEGORY_SYSTEM = 'System';
|
|
+Blockly.Msg.CATEGORY_DCMOTORS = 'DC Motors';
|
|
+Blockly.Msg.CATEGORY_MOTORS = 'Motors';
|
|
+Blockly.Msg.CATEGORY_SENSORS = 'Sensors';
|
|
+Blockly.Msg.CATEGORY_MISC = 'Misc';
|
|
+Blockly.Msg.CATEGORY_MOVEMENT = 'Movement';
|
|
+Blockly.Msg.CATEGORY_RNG = 'RNG';
|
|
+
|
|
+Blockly.Msg.HUB_STATUSLIGHT_OFF = 'turn off main button light';
|
|
+Blockly.Msg.HUB_STATUSLIGHT_SET = 'set main button light to %1';
|
|
+
|
|
+Blockly.Msg.HUB_INIT = 'initialize hub with %1 side facing up and %2 side facing front';
|
|
+
|
|
+Blockly.Msg.HUB_DISPLAY_OFF = 'turn display off';
|
|
+Blockly.Msg.HUB_DISPLAY_NUM = 'show digits %1 on display';
|
|
+Blockly.Msg.HUB_DISPLAY_CHAR = 'show char %1 on display';
|
|
+Blockly.Msg.HUB_DISPLAY_STRING = 'scroll %1 across display';
|
|
+
|
|
+Blockly.Msg.HUB_INPUT_ISBUTTONPRESSED = 'is %1 button pressed?';
|
|
+
|
|
+Blockly.Msg.CONTROL_STOP_EXIT = 'and exit program';
|
|
+Blockly.Msg.CONTROL_STOP_RESTART = 'and restart program';
|
|
+Blockly.Msg.CONTROL_STOP_SHUTDOWN = 'and turn off hub';
|
|
+
|
|
+Blockly.Msg.HUB_IMU_ISREADY = 'is imu ready?';
|
|
+Blockly.Msg.HUB_IMU_ISMOVING = 'is moving?';
|
|
+
|
|
+Blockly.Msg.HUB_IMU_PITCH = 'pitch angle';
|
|
+Blockly.Msg.HUB_IMU_ROLL = 'roll angle';
|
|
+Blockly.Msg.HUB_IMU_YAW = 'yaw angle';
|
|
+Blockly.Msg.HUB_IMU_ACCEL = '%1 acceleration';
|
|
+Blockly.Msg.HUB_IMU_AVEL = '%1 angular velocity';
|
|
+Blockly.Msg.HUB_IMU_RESET_YAW = 'reset yaw angle to 0';
|
|
+Blockly.Msg.HUB_IMU_RESET_YAW_TO = 'reset yaw angle to %1';
|
|
+Blockly.Msg.HUB_IMU_AVEL_THRESHOLD = 'angular velocity threshold';
|
|
+Blockly.Msg.HUB_IMU_ACCE_THRESHOLD = 'acceleration threshold';
|
|
+Blockly.Msg.HUB_IMU_SET_AVEL_THRESHOLD = 'set angular velocity threshold to %1';
|
|
+Blockly.Msg.HUB_IMU_SET_ACCE_THRESHOLD = 'set acceleration threshold to %1';
|
|
+
|
|
+
|
|
+// PyBlocks - Axis
|
|
+Blockly.Msg.AXIS_X = 'X axis';
|
|
+Blockly.Msg.AXIS_Y = 'Y axis';
|
|
+Blockly.Msg.AXIS_Z = 'Z axis';
|
|
+
|
|
+// PyBlocks - Buttons
|
|
+Blockly.Msg.BUTTON_LEFT = 'left';
|
|
+Blockly.Msg.BUTTON_CENTER = 'center';
|
|
+Blockly.Msg.BUTTON_RIGHT = 'right';
|
|
+Blockly.Msg.BUTTON_BT = 'bluetooth';
|
|
+
|
|
+// PyBlocks - Ports
|
|
+Blockly.Msg.PORT_A = 'A';
|
|
+Blockly.Msg.PORT_B = 'B';
|
|
+Blockly.Msg.PORT_C = 'C';
|
|
+Blockly.Msg.PORT_D = 'D';
|
|
+Blockly.Msg.PORT_E = 'E';
|
|
+Blockly.Msg.PORT_F = 'F';
|
|
+
|
|
+// PyBlocks end
|
|
diff --git a/package.json b/package.json
|
|
index 8b256a9a..98e81f3b 100644
|
|
--- a/package.json
|
|
+++ b/package.json
|
|
@@ -13,7 +13,7 @@
|
|
"browser": "./shim/vertical.js",
|
|
"scripts": {
|
|
"deploy": "rimraf gh-pages/closure-library/scripts/ci/CloseAdobeDialog.exe && gh-pages -t -d gh-pages -m \"Build for $(git log --pretty=format:%H -n1) [skip ci]\"",
|
|
- "prepublish": "python build.py && webpack",
|
|
+ "prepublish": "python2 build.py && webpack",
|
|
"test:unit": "node tests/jsunit/test_runner.js",
|
|
"test:lint": "eslint .",
|
|
"test:messages": "npm run translate && node i18n/test_scratch_msgs.js",
|
|
diff --git a/tests/custom_procedure_playground.html b/tests/custom_procedure_playground.html
|
|
index 3e89fef6..8780a8af 100644
|
|
--- a/tests/custom_procedure_playground.html
|
|
+++ b/tests/custom_procedure_playground.html
|
|
@@ -11,15 +11,15 @@
|
|
<script src="../blocks_common/text.js"></script>
|
|
<script src="../blocks_common/colour.js"></script>
|
|
<script src="../blocks_vertical/control.js"></script>
|
|
- <script src="../blocks_vertical/event.js"></script>
|
|
- <script src="../blocks_vertical/motion.js"></script>
|
|
- <script src="../blocks_vertical/looks.js"></script>
|
|
- <script src="../blocks_vertical/procedures.js"></script>
|
|
+ <script src="../blocks_vertical/upstream/event.js"></script>
|
|
+ <script src="../blocks_vertical/upstream/motion.js"></script>
|
|
+ <script src="../blocks_vertical/upstream/looks.js"></script>
|
|
+ <script src="../blocks_vertical/upstream/procedures.js"></script>
|
|
<script src="../blocks_vertical/operators.js"></script>
|
|
<script src="../blocks_vertical/pen.js"></script>
|
|
- <script src="../blocks_vertical/sound.js"></script>
|
|
- <script src="../blocks_vertical/sensing.js"></script>
|
|
- <script src="../blocks_vertical/data.js"></script>
|
|
+ <script src="../blocks_vertical/upstream/sound.js"></script>
|
|
+ <script src="../blocks_vertical/upstream/sensing.js"></script>
|
|
+ <script src="../blocks_vertical/upstream/data.js"></script>
|
|
<style>
|
|
body {
|
|
background-color: #fff;
|
|
diff --git a/tests/vertical_playground.html b/tests/vertical_playground.html
|
|
index 99427d37..7eab4fd9 100644
|
|
--- a/tests/vertical_playground.html
|
|
+++ b/tests/vertical_playground.html
|
|
@@ -6,27 +6,29 @@
|
|
|
|
<title>Vertical Playground</title>
|
|
|
|
+ <!-- PyBlocks start -->
|
|
+
|
|
<script src="../blockly_uncompressed_vertical.js"></script>
|
|
<script src="../msg/messages.js"></script>
|
|
<script src="../msg/scratch_msgs.js"></script>
|
|
- <script src="../blocks_vertical/vertical_extensions.js"></script>
|
|
+
|
|
<script src="../blocks_common/math.js"></script>
|
|
<script src="../blocks_common/matrix.js"></script>
|
|
<script src="../blocks_common/note.js"></script>
|
|
<script src="../blocks_common/text.js"></script>
|
|
<script src="../blocks_common/colour.js"></script>
|
|
- <script src="../blocks_vertical/control.js"></script>
|
|
- <script src="../blocks_vertical/event.js"></script>
|
|
- <script src="../blocks_vertical/motion.js"></script>
|
|
- <script src="../blocks_vertical/looks.js"></script>
|
|
- <script src="../blocks_vertical/procedures.js"></script>
|
|
- <script src="../blocks_vertical/operators.js"></script>
|
|
- <script src="../blocks_vertical/pen.js"></script>
|
|
- <script src="../blocks_vertical/sound.js"></script>
|
|
- <script src="../blocks_vertical/sensing.js"></script>
|
|
- <script src="../blocks_vertical/data.js"></script>
|
|
- <script src="../blocks_vertical/extensions.js"></script>
|
|
+
|
|
+ <script src="../blocks_vertical/vertical_extensions.js"></script>
|
|
+ <script src="../blocks_vertical/hub_status_light.js"></script>
|
|
<script src="../blocks_vertical/default_toolbox.js"></script>
|
|
+ <script src="../blocks_vertical/hub.js"></script>
|
|
+ <script src="../blocks_vertical/display.js"></script>
|
|
+ <script src="../blocks_vertical/input.js"></script>
|
|
+ <script src="../blocks_vertical/operators.js"></script>
|
|
+ <script src="../blocks_vertical/control.js"></script>
|
|
+ <script src="../blocks_vertical/imu.js"></script>
|
|
+
|
|
+ <!-- PyBlocks end -->
|
|
|
|
<script>
|
|
'use strict';
|
|
diff --git a/tests/workspace_svg/index.html b/tests/workspace_svg/index.html
|
|
index 8b130ab7..5b0c901a 100644
|
|
--- a/tests/workspace_svg/index.html
|
|
+++ b/tests/workspace_svg/index.html
|
|
@@ -5,7 +5,7 @@
|
|
<title>Blockly Workspace SVG testing</title>
|
|
<script src="../../blockly_uncompressed_vertical.js"></script>
|
|
<script src="../../blocks_vertical/vertical_extensions.js"></script>
|
|
-<script src="../../blocks_vertical/looks.js"></script>
|
|
+<script src="../../blocks_vertical/upstream/looks.js"></script>
|
|
<script>goog.require('goog.testing.jsunit');</script>
|
|
<script src="../../msg/messages.js"></script>
|
|
|
|
@@ -49,7 +49,7 @@ h1 {
|
|
<script src="../jsunit/test_utilities.js"></script>
|
|
<script src="workspace_svg_test.js"></script>
|
|
|
|
-
|
|
+
|
|
<xml id="toolbox-categories" style="display: none">
|
|
<category name="Looks" colour="#9966FF" secondaryColour="#774DCB">
|
|
<block type="looks_show" id="lABCD"></block>
|
|
--
|
|
2.40.1
|
|
|