Skip to content

Commit 6a1b3f4

Browse files
committed
Updated dependencies and fixed integration issues.
Thanks to @PierreQuentel for fixing some Brython issues to allow a smooth integration of the latest version. Added simple legancy support (conversion) for former block definition to avoid not loading files. Updated feature detection for better compability when running as web app. Fixed gapi integration to avoid errors messages with the latest integrations like classroom. Fixed material design lite design issues with checkboxes. Added additional automated tests.
1 parent a534c27 commit 6a1b3f4

File tree

43 files changed

+569
-293
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+569
-293
lines changed

app/chrome_app/background.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ chrome.app.runtime.onLaunched.addListener(
3030

3131
let screenWidth = screen.availWidth;
3232
let screenHeight = screen.availHeight;
33-
console.log('Screensize', screenWidth, 'x', screenHeight);
33+
console.log('Screen-size', screenWidth, 'x', screenHeight);
3434
let editorWidth = 1280;
3535
let editorHeight = 720;
3636
let editorConfig = {

app/chrome_app/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"short_name": "Coding with Chrome",
1010
"description": "Learn, improve, or teach coding skills within a Chrome browser.",
1111
"key": "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAgSWdCJSwkgFTY9d993Quot277oCS2PCM2H/F6U28NE8D3Z21GXS/7qW8XCGShB054Wboq62pP679f9tB9F+GRHzOh/an4zIu+Uhb3ZKVzZLJbHsP8N+E5wk3wgwOBgE+UXCy9I8i1RpfzutJ4aha+YEzvCsVpo6UwsuWiXORB9yRU5NuooYX+fhVpWZmrZJo4vqzQhuoJ/uWiQujABXXo4qdrclwSw8+JlpWLMqHHQ6HE8Sf7VWDdGvRdYP6LRZobWqovb659qEumJ0bxhwXtHkWgPHQWtW35T/r/oH8uuke35pH+YtBtaOqN5U3bYGPinP0bYrI33OSLUJx/DrC1wIDAQAB",
12-
"version": "5.8.16",
12+
"version": "5.10.1",
1313
"oauth2": {
1414
"client_id": "418162477970-2qmsb2sp3m522hf292154favsjgpsj9n.apps.googleusercontent.com",
1515
"scopes": [

app/nw_app/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "binary",
3-
"version": "5.8.16",
3+
"version": "5.10.1",
44
"main": "js/background.js",
55
"window": {
66
"title": "Coding with Chrome",

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "coding-with-chrome",
33
"description": "Coding with Chrome",
4-
"version": "5.8.16",
4+
"version": "5.10.1",
55
"author": "Markus Bordihn ([email protected])",
66
"license": "Apache-2.0",
77
"private": true,

src/blocks/sphero/sphero2/blocks.js

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -198,17 +198,3 @@ Blockly.Blocks['sphero_sphero2_collision'] = {
198198
this.setTooltip(i18t('Detect collision.'));
199199
},
200200
};
201-
202-
203-
/**
204-
* Deprecated: Alias for former blocks for compatibility reasons.
205-
*/
206-
Blockly.Blocks['sphero_start'] = Blockly.Blocks['sphero_sphero2_start'];
207-
Blockly.Blocks['sphero_roll'] = Blockly.Blocks['sphero_sphero2_roll'];
208-
Blockly.Blocks['sphero_roll_step'] = Blockly.Blocks['sphero_sphero2_roll_step'];
209-
Blockly.Blocks['sphero_roll_time'] = Blockly.Blocks['sphero_sphero2_roll_time'];
210-
Blockly.Blocks['sphero_heading'] = Blockly.Blocks['sphero_sphero2_heading'];
211-
Blockly.Blocks['sphero_rgb'] = Blockly.Blocks['sphero_sphero2_rgb'];
212-
Blockly.Blocks['sphero_backlight'] = Blockly.Blocks['sphero_sphero2_backlight'];
213-
Blockly.Blocks['sphero_stop'] = Blockly.Blocks['sphero_sphero2_stop'];
214-
Blockly.Blocks['sphero_collision'] = Blockly.Blocks['sphero_sphero2_collision'];

src/file_handler/file_loader.js

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,32 @@ cwc.fileHandler.FileLoader.prototype.loadFile = function() {
7474

7575
/**
7676
* Creates a request to load file.
77-
* @param {Function=} optCallback
77+
* @param {Function=} callback
7878
*/
79-
cwc.fileHandler.FileLoader.prototype.requestLoadFile = function(optCallback) {
79+
cwc.fileHandler.FileLoader.prototype.requestLoadFile = function(callback) {
8080
let loadFile = function() {
8181
this.loadFile();
82-
if (optCallback) {
83-
optCallback();
82+
if (callback) {
83+
callback();
84+
}
85+
}.bind(this);
86+
this.helper.handleUnsavedChanges(loadFile);
87+
};
88+
89+
90+
/**
91+
* Creates a request to load file.
92+
* @param {Function=} callback
93+
*/
94+
cwc.fileHandler.FileLoader.prototype.requestLoadGoogleDriveFile = function(
95+
callback) {
96+
let loadFile = function() {
97+
let gapiInstance = this.helper.getInstance('gapi');
98+
if (gapiInstance && gapiInstance.getDrive()) {
99+
gapiInstance.getDrive().openDialog();
100+
}
101+
if (callback) {
102+
callback();
84103
}
85104
}.bind(this);
86105
this.helper.handleUnsavedChanges(loadFile);

src/file_handler/file_saver.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ cwc.fileHandler.FileSaver.prototype.saveFileAs = function() {
9191
*/
9292
cwc.fileHandler.FileSaver.prototype.saveGDriveFile = function(save_file) {
9393
this.log_.info('Save file in Google Drive', this.gDriveId);
94-
let gDriveInstance = this.helper.getInstance('gdrive', true);
94+
let gDriveInstance = this.helper.getInstance('gapi').getDrive();
9595
this.prepareContent();
9696
if (save_file) {
9797
gDriveInstance.saveFile(this.filename, this.fileData, this.gDriveId);
@@ -106,7 +106,7 @@ cwc.fileHandler.FileSaver.prototype.saveGDriveFile = function(save_file) {
106106
*/
107107
cwc.fileHandler.FileSaver.prototype.saveGCloudFile = function() {
108108
this.log_.info('Save file in Google Cloud');
109-
let gCloudInstance = this.helper.getInstance('gcloud', true);
109+
let gCloudInstance = this.helper.getInstance('gapi').getCloud();
110110
this.prepareContent();
111111
gCloudInstance.publishDialog(this.filename, this.fileData, this.mimeType);
112112
};

src/frameworks/python/python3.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,5 @@ cwc.framework.Python3 = function() {
4242
cwc.framework.Python3.prototype.run = function() {
4343
brython({
4444
'indexedDB': this.indexedDBSupport,
45-
'debug': false,
4645
});
4746
};

src/renderer/external/python/python.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,8 @@ cwc.renderer.external.Python.prototype.renderPython2 = function(
107107
header += rendererHelper.getStyleSheetURL(
108108
/** @type {string} */ (cwc.config.framework.StyleSheet.DIALOG));
109109
let body = '<div id="content"></div>' +
110-
'<script id="code" type="text/python">\n' +
111-
content +
112-
'\n</script>\n<script>new cwc.framework.Python2().run();</script>';
110+
'<script id="code" type="text/python">\n' + content +'\n</script>\n' +
111+
'<script>new cwc.framework.Python2().run();</script>';
113112

114113
return rendererHelper.getHTML(body, header);
115114
};

src/ui/blockly/blockly.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ goog.provide('cwc.ui.Blockly');
2121

2222
goog.require('cwc.soy.ui.Blockly');
2323
goog.require('cwc.ui.BlocklyConfig');
24+
goog.require('cwc.ui.BlocklyLegacy');
2425
goog.require('cwc.ui.BlocklyToolbar');
2526
goog.require('cwc.ui.BlocklyToolbox');
2627
goog.require('cwc.ui.Helper');
@@ -258,7 +259,8 @@ cwc.ui.Blockly.prototype.addView = function(name, xml) {
258259
let workspace = this.getWorkspace();
259260
if (workspace) {
260261
this.log_.info('Add view', name, '(', xml.length, ')');
261-
let xmlDom = Blockly.Xml.textToDom(xml);
262+
let xmlString = cwc.ui.BlocklyLegacy.parse(xml);
263+
let xmlDom = Blockly.Xml.textToDom(xmlString);
262264
try {
263265
Blockly.Xml.domToWorkspace(xmlDom, workspace);
264266
this.resetZoom();

0 commit comments

Comments
 (0)