Porównaj commity

...

7 Commity

Autor SHA1 Wiadomość Data
Michael Aschauer bae5cfe357
Merge pull request #123 from Simon-Mong/patch-40
Update VectorAndFill.xml
2022-10-05 17:30:31 +02:00
Michael Aschauer 17963caf8c
Merge pull request #122 from Simon-Mong/patch-39
Update geometryBlocks.xml
2022-10-05 17:30:21 +02:00
Michael 5e032b15c5 load project_list without thumbnails, thumbnails only on select (and necessary projectdialog updates) 2022-10-05 17:22:30 +02:00
Michael 13a4348840 fix reportURL 2022-10-05 17:12:41 +02:00
Simon-Mong ae54341037
Update VectorAndFill.xml
updated an essential block to make this library still available in TurtleStitch 2.7.8.
2022-10-05 22:24:52 +08:00
Simon-Mong c39cc089f3
Update geometryBlocks.xml
updated an essential block to make this library still available in TurtleStitch 2.7.8.
2022-10-05 22:22:01 +08:00
Michael 6b85025c94 new project 2022-10-05 11:47:52 +02:00
7 zmienionych plików z 252 dodań i 65 usunięć

Wyświetl plik

@ -45,10 +45,10 @@
<script type="text/javascript" src="stitchcode/morphic.js?version=2021-12-14"></script>
<script type="text/javascript" src="stitchcode/symbols.js?version=2021-12-14"></script>
<script type="text/javascript" src="stitchcode/blocks.js?version=2021-12-14"></script>
<script type="text/javascript" src="stitchcode/threads.js?version=2021-12-14"></script>
<script type="text/javascript" src="stitchcode/objects.js?version=2022-08-25-"></script>
<script type="text/javascript" src="stitchcode/turtlecloud.js?version=2022-06-14"></script>
<script type="text/javascript" src="stitchcode/gui.js?version=2022-08-25"></script>
<script type="text/javascript" src="stitchcode/threads.js?version=2022-10-05"></script>
<script type="text/javascript" src="stitchcode/objects.js?version=2022-10-05"></script>
<script type="text/javascript" src="stitchcode/turtlecloud.js?version=2022-10-05"></script>
<script type="text/javascript" src="stitchcode/gui.js?version=2022-10-05"></script>
<script type="text/javascript" src="stitchcode/store.js?version=2022-06-14"></script>
<script type="text/javascript">

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Wyświetl plik

@ -1,4 +1,4 @@
VERSION="2.7.8.2"
VERSION="2.7.9"
// get debug mode
url = new URL(window.location.href);
@ -2901,6 +2901,102 @@ DialogBoxMorph.prototype.informWithLink = function (
this.popUp(world);
};
ProjectDialogMorph.prototype.installCloudProjectList = function (pl) {
this.projectList = pl[0] ? pl : [];
this.projectList.sort((x, y) =>
x.projectname.toLowerCase() < y.projectname.toLowerCase() ? -1 : 1
);
this.listField.destroy();
this.listField = new ListMorph(
this.projectList,
this.projectList.length > 0 ?
(element) => {return element.projectname || element; }
: null,
[ // format: display shared project names bold
[
'bold',
proj => proj.ispublic
],
[
'italic',
proj => proj.ispublished
]
],
() => this.ok()
);
this.fixListFieldItemColors();
this.listField.fixLayout = nop;
this.listField.edge = InputFieldMorph.prototype.edge;
this.listField.fontSize = InputFieldMorph.prototype.fontSize;
this.listField.typeInPadding = InputFieldMorph.prototype.typeInPadding;
this.listField.contrast = InputFieldMorph.prototype.contrast;
this.listField.render = InputFieldMorph.prototype.render;
this.listField.drawRectBorder = InputFieldMorph.prototype.drawRectBorder;
this.listField.action = (item) => {
if (item === undefined) {return; }
if (this.nameField) {
this.nameField.setContents(item.projectname || '');
}
if (this.task === 'open' || this.task === 'add') {
this.notesText.text = item.notes || '';
this.notesText.rerender();
this.notesField.contents.adjustBounds();
this.preview.texture = '';
this.preview.rerender();
// we ask for the thumbnail when selecting a project
this.ide.cloud.getThumbnail(
null, // username is implicit
item.projectname,
thumbnail => {
this.preview.texture = thumbnail;
this.preview.cachedTexture = null;
this.preview.rerender();
});
new SpeechBubbleMorph(new TextMorph(
localize('last changed') + '\n' + item.updated + item.ispublic + item.Public,
null,
null,
null,
null,
'center'
)).popUp(
this.world(),
this.preview.rightCenter().add(new Point(2, 0))
);
}
if (item.ispublic) {
this.shareButton.hide();
this.unshareButton.show();
} else {
this.unshareButton.hide();
this.shareButton.show();
}
this.buttons.fixLayout();
this.fixLayout();
this.publishButton.hide();
this.edit();
};
this.body.add(this.listField);
if (this.task === 'open' || this.task === 'add') {
this.recoverButton.hide();
this.tagsField.hide();
this.tagsLabelField.hide();
this.unshareButton.hide();
this.shareButton.hide();
this.unpublishButton.hide();
}
this.deleteButton.show();
this.buttons.fixLayout();
this.fixLayout();
if (this.task === 'open' || this.task === 'add') {
this.clearDetails();
}
};
/*
ProjectDialogMorph.prototype.installCloudProjectList = function (pl) {
@ -2983,26 +3079,11 @@ ProjectDialogMorph.prototype.installCloudProjectList = function (pl) {
}
};
*/
ProjectDialogMorph.prototype.fixLayoutOrig = ProjectDialogMorph.prototype.fixLayout;
ProjectDialogMorph.prototype.buildContentsOrig = ProjectDialogMorph.prototype.buildContents;
ProjectDialogMorph.prototype.initOrig = ProjectDialogMorph.prototype.init;
ProjectDialogMorph.prototype.saveProjectOrig = ProjectDialogMorph.prototype.saveProject;
ProjectDialogMorph.prototype.buildContents = function () {
this.buildContentsOrig();
this.tagsLabelField = new TextMorph("Tags (New cloud projects only):");
this.body.add(this.tagsLabelField);
this.notesLabelField = new TextMorph("Notes");
this.notesLabelField.edge = InputFieldMorph.prototype.edge;
this.body.add(this.notesLabelField);
this.tagsField = new InputFieldMorph("");
this.tagsField.edge = InputFieldMorph.prototype.edge;
this.tagsField.contrast = InputFieldMorph.prototype.contrast;
// this.tagsField.fixLayout = InputFieldMorph.prototype.fixLayout;
this.body.add(this.tagsField);
this.fixLayout();
};
ProjectDialogMorph.prototype.fixLayout = function () {
this.fixLayoutOrig();
@ -3010,22 +3091,20 @@ ProjectDialogMorph.prototype.fixLayout = function () {
thin = this.padding / 2,
oldFlag = Morph.prototype.trackChanges;
if (this.preview) {
this.preview.setHeight(310);
}
if (this.body && this.tagsField) {
this.notesLabelField.setTop(this.preview.bottom() + thin);
this.notesLabelField.setLeft(this.preview.left() + 1);
this.notesField.setTop(this.notesLabelField.bottom());
this.notesField.setLeft(this.preview.left());
this.notesField.setHeight(this.body.bottom() - this.notesLabelField.bottom() - this.notesLabelField.height() - thin);
this.tagsLabelField.setTop(this.notesField.bottom() + thin);
this.tagsLabelField.setLeft(this.notesField.left() + 1);
this.tagsField.setTop(this.notesField.bottom() + 2);
this.tagsField.setLeft(this.tagsLabelField.right());
this.tagsField.setWidth(this.notesField.width() - this.tagsLabelField.width() - 1);
}
this.changed();
}
@ -3042,6 +3121,7 @@ ProjectDialogMorph.prototype.saveProject = function () {
this.saveProjectOrig();
};
StageMorph.prototype.backgroundColor = new Color(255,255,255);
StageMorph.prototype.defaultPenColor = new Color(0,0,0,1);

Wyświetl plik

@ -441,4 +441,3 @@ SnapSerializer.prototype.loadScene = function (xmlNode, remixID) {
this.objects = {};
return scene.initialize();
};

Wyświetl plik

@ -53,6 +53,41 @@ Process.prototype.reportPi = function (min, max) {
return Math.PI;
};
// Process URI retrieval (interpolated)
Process.prototype.reportURL = function (url) {
var response;
if (!this.httpRequest) {
// use the location protocol unless the user specifies otherwise
if (url.indexOf('//') < 0 || url.indexOf('//') > 8) {
if (location.protocol === 'file:') {
// allow requests from locally loaded sources
url = 'https://' + url;
} else {
url = location.protocol + '//' + url;
}
}
this.httpRequest = new XMLHttpRequest();
this.httpRequest.open("GET", url, true);
// cache-control, commented out for now
// added for Snap4Arduino but has issues with local robot servers
// this.httpRequest.setRequestHeader('Cache-Control', 'max-age=0');
this.httpRequest.send(null);
if (this.context.isCustomCommand) {
// special case when ignoring the result, e.g. when
// communicating with a robot to control its motors
this.httpRequest = null;
return null;
}
} else if (this.httpRequest.readyState === 4) {
response = this.httpRequest.responseText;
this.httpRequest = null;
return response;
}
this.pushContext('doYield');
this.pushContext();
};
Process.prototype.reportProxiedURL = function (url) {
return this.reportURL(this.proxy + '/' + url);
};

Wyświetl plik

@ -76,6 +76,56 @@ BeetleCloud.prototype.get = function (path, callBack, errorCall, errorMsg) {
};
BeetleCloud.prototype.getImage = function (path, callBack, errorCall, errorMsg) {
var request = new XMLHttpRequest(),
myself = this;
try {
request.open(
'GET',
this.url + path,
true
);
request.setRequestHeader(
'Content-Type',
'application/json; charset=utf-8'
);
request.withCredentials = true;
request.onreadystatechange = function () {
if (request.readyState === 4) {
if (request.responseText) {
if(request.status === 404) {
if (errorCall)
errorCall.call(
null,
myself.url,
errorMsg
);
else
console.log("error in checking credentials")
return false;
}
callBack.call(null, request.responseText);
} else {
if (typeof errorCall != 'undefined') {
errorCall.call(
null,
myself.url,
errorMsg
);
}
}
}
};
request.send();
} catch (err) {
errorCall.call(this, err.toString(), 'TurtleCloud');
}
};
BeetleCloud.prototype.post = function (path, body, callBack, errorCall, errorMsg) {
var request = new XMLHttpRequest(),
myself = this;
@ -327,6 +377,16 @@ BeetleCloud.prototype.getProjectList = function (callBack, errorCall) {
);
};
BeetleCloud.prototype.getThumbnail = function (username, projectName, callBack, errorCall) {
this.getImage('/users/' + this.username
+ '/projects/' + encodeURIComponent(projectName)
+ '/image', // path
callBack, // ok callback
() => {}, // error callback
'Could not fetch thumbnail'); // error message
};
Cloud = BeetleCloud;
var SnapCloud = new BeetleCloud(
@ -562,6 +622,17 @@ ProjectDialogMorph.prototype.buildContents = function () {
});
this.originalBuildContents();
this.tagsLabelField = new TextMorph("Tags (New cloud projects only):");
this.body.add(this.tagsLabelField);
this.notesLabelField = new TextMorph("Notes");
this.notesLabelField.edge = InputFieldMorph.prototype.edge;
this.body.add(this.notesLabelField);
this.tagsField = new InputFieldMorph("");
this.tagsField.edge = InputFieldMorph.prototype.edge;
this.tagsField.contrast = InputFieldMorph.prototype.contrast;
// this.tagsField.fixLayout = InputFieldMorph.prototype.fixLayout;
this.body.add(this.tagsField);
this.fixLayout();
/*
this.preview.setExtent(
new Point(320,240).add(this.preview.edge * 2)
@ -659,6 +730,7 @@ ProjectDialogMorph.prototype.shareProject = function () {
proj.ProjectName,
function () {
proj.Public = 'true';
proj.ispublic = 'true';
myself.unshareButton.show();
myself.shareButton.hide();
entry.label.isBold = true;
@ -703,6 +775,7 @@ ProjectDialogMorph.prototype.unshareProject = function () {
proj.ProjectName,
function () {
proj.Public = 'false';
proj.ispublic = 'true';
myself.shareButton.show();
myself.unshareButton.hide();
entry.label.isBold = false;