mirror of
https://github.com/damp11113-software/ccIDE.git
synced 2025-04-28 06:58:13 +00:00
update 1.0.3
this version can upload code and run code from IDE and add save/load project
This commit is contained in:
parent
445af184b2
commit
5598295977
17
blocks/IDE/block_design.json
Normal file
17
blocks/IDE/block_design.json
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
"ide_addcode": {
|
||||||
|
"message0": "Add Code %1",
|
||||||
|
"args0": [
|
||||||
|
{
|
||||||
|
"type": "input_value",
|
||||||
|
"name": "CODE",
|
||||||
|
"text": "print('hello world!')"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"previousStatement": null,
|
||||||
|
"nextStatement": null,
|
||||||
|
"colour": 150,
|
||||||
|
"tooltip": "Add Code for some code is not in IDE",
|
||||||
|
"helpUrl": ""
|
||||||
|
}
|
||||||
|
}
|
15
blocks/IDE/generator.js
Normal file
15
blocks/IDE/generator.js
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
const { luaGenerator } = require('blockly/lua');
|
||||||
|
|
||||||
|
// Check if luaGenerator.forBlock is defined and initialize if necessary-
|
||||||
|
if (!luaGenerator.forBlock) {
|
||||||
|
luaGenerator.forBlock = {};
|
||||||
|
}
|
||||||
|
|
||||||
|
// Define your custom block handler
|
||||||
|
luaGenerator.forBlock['ide_addcode'] = function(block, generator) {
|
||||||
|
var codefromuser = generator.valueToCode(block, 'CODE', generator.ORDER_ATOMIC);
|
||||||
|
|
||||||
|
// Remove all occurrences of the matched characters
|
||||||
|
const cleanedStr = codefromuser.replace(/[']/g, '');
|
||||||
|
return cleanedStr;
|
||||||
|
};
|
14
blocks/IDE/index.json
Normal file
14
blocks/IDE/index.json
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
"name": "IDE",
|
||||||
|
"author": "DPSoftware Foundation",
|
||||||
|
"description": "Block for IDE",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"category": "Blockly Extensions",
|
||||||
|
"keyword": "test",
|
||||||
|
"license": "GPL-3.0-or-later",
|
||||||
|
"peripherals": false,
|
||||||
|
"library": false,
|
||||||
|
"turtle": false,
|
||||||
|
"require_network": false,
|
||||||
|
"dependencies": {}
|
||||||
|
}
|
6
blocks/IDE/toolbox.xml
Normal file
6
blocks/IDE/toolbox.xml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<xml id="toolbox" style="display: none;">
|
||||||
|
<category name="IDE" colour="150">
|
||||||
|
<!-- Define your custom blocks here -->
|
||||||
|
<block type="ide_addcode"></block>
|
||||||
|
</category>
|
||||||
|
</xml>
|
@ -9,6 +9,6 @@
|
|||||||
"peripherals": false,
|
"peripherals": false,
|
||||||
"library": false,
|
"library": false,
|
||||||
"turtle": false,
|
"turtle": false,
|
||||||
"system": true,
|
"require_network": false,
|
||||||
"require_network": false
|
"dependencies": {}
|
||||||
}
|
}
|
167
package-lock.json
generated
167
package-lock.json
generated
@ -1,23 +1,49 @@
|
|||||||
{
|
{
|
||||||
"name": "ccide",
|
"name": "ccide",
|
||||||
"version": "1.0.0",
|
"version": "1.0.2",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "ccide",
|
"name": "ccide",
|
||||||
"version": "1.0.0",
|
"version": "1.0.2",
|
||||||
"license": "GPL-3.0-or-later",
|
"license": "GPL-3.0-or-later",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@blockly/field-multilineinput": "^5.0.5",
|
||||||
|
"@blockly/theme-dark": "^7.0.3",
|
||||||
"@electron/remote": "^2.1.2",
|
"@electron/remote": "^2.1.2",
|
||||||
"blockly": "^11.1.1",
|
"blockly": "^11.1.1",
|
||||||
"bootstrap": "^5.3.3",
|
"bootstrap": "^5.3.3",
|
||||||
"electron-prompt": "^1.7.0"
|
"electron-prompt": "^1.7.0",
|
||||||
|
"mergexml": "^1.2.4",
|
||||||
|
"xmldom": "^0.6.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"electron": "^31.1.0"
|
"electron": "^31.1.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@blockly/field-multilineinput": {
|
||||||
|
"version": "5.0.5",
|
||||||
|
"resolved": "https://registry.npmjs.org/@blockly/field-multilineinput/-/field-multilineinput-5.0.5.tgz",
|
||||||
|
"integrity": "sha512-fCh+fkEeNCUwPyO6O45rH68e27RjMFWAvfUu/fYybGSIvt92uZfhZqq0veLMqAhwfYR7qQ7HIhUqvHQzAe4t6g==",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8.0.0"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"blockly": "^11.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@blockly/theme-dark": {
|
||||||
|
"version": "7.0.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/@blockly/theme-dark/-/theme-dark-7.0.3.tgz",
|
||||||
|
"integrity": "sha512-lRV9V5vjijbJAlUdZqtEhUt81OjHjZK8vagxir1cUqTrZ/+MNS2m7wkhIVPba4RWInJ1LY/nHEoQn6demZqRRQ==",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8.17.0"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"blockly": "^11.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@electron/get": {
|
"node_modules/@electron/get": {
|
||||||
"version": "2.0.3",
|
"version": "2.0.3",
|
||||||
"resolved": "https://registry.npmjs.org/@electron/get/-/get-2.0.3.tgz",
|
"resolved": "https://registry.npmjs.org/@electron/get/-/get-2.0.3.tgz",
|
||||||
@ -127,6 +153,14 @@
|
|||||||
"@types/node": "*"
|
"@types/node": "*"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@xmldom/xmldom": {
|
||||||
|
"version": "0.7.13",
|
||||||
|
"resolved": "https://registry.npmjs.org/@xmldom/xmldom/-/xmldom-0.7.13.tgz",
|
||||||
|
"integrity": "sha512-lm2GW5PkosIzccsaZIz7tp8cPADSIlIHWDFTR1N0SzfinhhYgeIQjFMz4rYzanCScr3DqQLeomUDArp6MWKm+g==",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=10.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/agent-base": {
|
"node_modules/agent-base": {
|
||||||
"version": "7.1.1",
|
"version": "7.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.1.tgz",
|
||||||
@ -138,6 +172,11 @@
|
|||||||
"node": ">= 14"
|
"node": ">= 14"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/asap": {
|
||||||
|
"version": "2.0.6",
|
||||||
|
"resolved": "https://registry.npmjs.org/asap/-/asap-2.0.6.tgz",
|
||||||
|
"integrity": "sha512-BSHWgDSAiKs50o2Re8ppvp3seVHXSRM44cdSsT9FfNEUUZLOGWVCsiWaRPWM1Znn+mqZ1OfVZ3z3DWEzSp7hRA=="
|
||||||
|
},
|
||||||
"node_modules/asynckit": {
|
"node_modules/asynckit": {
|
||||||
"version": "0.4.0",
|
"version": "0.4.0",
|
||||||
"resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
|
"resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
|
||||||
@ -358,6 +397,15 @@
|
|||||||
"integrity": "sha512-T0NIuQpnTvFDATNuHN5roPwSBG83rFsuO+MXXH9/3N1eFbn4wcPjttvjMLEPWJ0RGUYgQE7cGgS3tNxbqCGM7g==",
|
"integrity": "sha512-T0NIuQpnTvFDATNuHN5roPwSBG83rFsuO+MXXH9/3N1eFbn4wcPjttvjMLEPWJ0RGUYgQE7cGgS3tNxbqCGM7g==",
|
||||||
"optional": true
|
"optional": true
|
||||||
},
|
},
|
||||||
|
"node_modules/dezalgo": {
|
||||||
|
"version": "1.0.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/dezalgo/-/dezalgo-1.0.4.tgz",
|
||||||
|
"integrity": "sha512-rXSP0bf+5n0Qonsb+SVVfNfIsimO4HEtmnIpPHY8Q1UCzKlQrDMfdobr8nJOOsRgWCyMRqeSBQzmWUMq7zvVig==",
|
||||||
|
"dependencies": {
|
||||||
|
"asap": "^2.0.0",
|
||||||
|
"wrappy": "1"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/electron": {
|
"node_modules/electron": {
|
||||||
"version": "31.1.0",
|
"version": "31.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/electron/-/electron-31.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/electron/-/electron-31.1.0.tgz",
|
||||||
@ -486,6 +534,19 @@
|
|||||||
"node": ">= 6"
|
"node": ">= 6"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/formidable": {
|
||||||
|
"version": "3.5.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/formidable/-/formidable-3.5.1.tgz",
|
||||||
|
"integrity": "sha512-WJWKelbRHN41m5dumb0/k8TeAx7Id/y3a+Z7QfhxP/htI9Js5zYaEDtG8uMgG0vM0lOlqnmjE99/kfpOYi/0Og==",
|
||||||
|
"dependencies": {
|
||||||
|
"dezalgo": "^1.0.4",
|
||||||
|
"hexoid": "^1.0.0",
|
||||||
|
"once": "^1.4.0"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://ko-fi.com/tunnckoCore/commissions"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/fs-extra": {
|
"node_modules/fs-extra": {
|
||||||
"version": "8.1.0",
|
"version": "8.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz",
|
||||||
@ -675,6 +736,14 @@
|
|||||||
"node": ">= 0.4"
|
"node": ">= 0.4"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/hexoid": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/hexoid/-/hexoid-1.0.0.tgz",
|
||||||
|
"integrity": "sha512-QFLV0taWQOZtvIRIAdBChesmogZrtuXvVWsFHZTk2SU+anspqZ2vMnoLg7IE1+Uk16N19APic1BuF8bC8c2m5g==",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/html-encoding-sniffer": {
|
"node_modules/html-encoding-sniffer": {
|
||||||
"version": "4.0.0",
|
"version": "4.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-4.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-4.0.0.tgz",
|
||||||
@ -829,6 +898,16 @@
|
|||||||
"node": ">=10"
|
"node": ">=10"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/mergexml": {
|
||||||
|
"version": "1.2.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/mergexml/-/mergexml-1.2.4.tgz",
|
||||||
|
"integrity": "sha512-yiOlDqcVCz7AG1eSboonc18FTlfqDEKYfGoAV3Lul98u6YRV/s0kjtf4bjk47t0hLTFJR0BSYMd6BpmX3xDjNQ==",
|
||||||
|
"dependencies": {
|
||||||
|
"@xmldom/xmldom": "^0.7.0",
|
||||||
|
"formidable": "^3.5.1",
|
||||||
|
"xpath": "0.0.27"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/mime-db": {
|
"node_modules/mime-db": {
|
||||||
"version": "1.52.0",
|
"version": "1.52.0",
|
||||||
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
|
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
|
||||||
@ -1229,6 +1308,22 @@
|
|||||||
"resolved": "https://registry.npmjs.org/xmlchars/-/xmlchars-2.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/xmlchars/-/xmlchars-2.2.0.tgz",
|
||||||
"integrity": "sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw=="
|
"integrity": "sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw=="
|
||||||
},
|
},
|
||||||
|
"node_modules/xmldom": {
|
||||||
|
"version": "0.6.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/xmldom/-/xmldom-0.6.0.tgz",
|
||||||
|
"integrity": "sha512-iAcin401y58LckRZ0TkI4k0VSM1Qg0KGSc3i8rU+xrxe19A/BN1zHyVSJY7uoutVlaTSzYyk/v5AmkewAP7jtg==",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=10.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/xpath": {
|
||||||
|
"version": "0.0.27",
|
||||||
|
"resolved": "https://registry.npmjs.org/xpath/-/xpath-0.0.27.tgz",
|
||||||
|
"integrity": "sha512-fg03WRxtkCV6ohClePNAECYsmpKKTv5L8y/X3Dn1hQrec3POx2jHZ/0P2qQ6HvsrU1BmeqXcof3NGGueG6LxwQ==",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=0.6.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/yauzl": {
|
"node_modules/yauzl": {
|
||||||
"version": "2.10.0",
|
"version": "2.10.0",
|
||||||
"resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.10.0.tgz",
|
"resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.10.0.tgz",
|
||||||
@ -1240,6 +1335,18 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@blockly/field-multilineinput": {
|
||||||
|
"version": "5.0.5",
|
||||||
|
"resolved": "https://registry.npmjs.org/@blockly/field-multilineinput/-/field-multilineinput-5.0.5.tgz",
|
||||||
|
"integrity": "sha512-fCh+fkEeNCUwPyO6O45rH68e27RjMFWAvfUu/fYybGSIvt92uZfhZqq0veLMqAhwfYR7qQ7HIhUqvHQzAe4t6g==",
|
||||||
|
"requires": {}
|
||||||
|
},
|
||||||
|
"@blockly/theme-dark": {
|
||||||
|
"version": "7.0.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/@blockly/theme-dark/-/theme-dark-7.0.3.tgz",
|
||||||
|
"integrity": "sha512-lRV9V5vjijbJAlUdZqtEhUt81OjHjZK8vagxir1cUqTrZ/+MNS2m7wkhIVPba4RWInJ1LY/nHEoQn6demZqRRQ==",
|
||||||
|
"requires": {}
|
||||||
|
},
|
||||||
"@electron/get": {
|
"@electron/get": {
|
||||||
"version": "2.0.3",
|
"version": "2.0.3",
|
||||||
"resolved": "https://registry.npmjs.org/@electron/get/-/get-2.0.3.tgz",
|
"resolved": "https://registry.npmjs.org/@electron/get/-/get-2.0.3.tgz",
|
||||||
@ -1329,6 +1436,11 @@
|
|||||||
"@types/node": "*"
|
"@types/node": "*"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"@xmldom/xmldom": {
|
||||||
|
"version": "0.7.13",
|
||||||
|
"resolved": "https://registry.npmjs.org/@xmldom/xmldom/-/xmldom-0.7.13.tgz",
|
||||||
|
"integrity": "sha512-lm2GW5PkosIzccsaZIz7tp8cPADSIlIHWDFTR1N0SzfinhhYgeIQjFMz4rYzanCScr3DqQLeomUDArp6MWKm+g=="
|
||||||
|
},
|
||||||
"agent-base": {
|
"agent-base": {
|
||||||
"version": "7.1.1",
|
"version": "7.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.1.tgz",
|
||||||
@ -1337,6 +1449,11 @@
|
|||||||
"debug": "^4.3.4"
|
"debug": "^4.3.4"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"asap": {
|
||||||
|
"version": "2.0.6",
|
||||||
|
"resolved": "https://registry.npmjs.org/asap/-/asap-2.0.6.tgz",
|
||||||
|
"integrity": "sha512-BSHWgDSAiKs50o2Re8ppvp3seVHXSRM44cdSsT9FfNEUUZLOGWVCsiWaRPWM1Znn+mqZ1OfVZ3z3DWEzSp7hRA=="
|
||||||
|
},
|
||||||
"asynckit": {
|
"asynckit": {
|
||||||
"version": "0.4.0",
|
"version": "0.4.0",
|
||||||
"resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
|
"resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
|
||||||
@ -1485,6 +1602,15 @@
|
|||||||
"integrity": "sha512-T0NIuQpnTvFDATNuHN5roPwSBG83rFsuO+MXXH9/3N1eFbn4wcPjttvjMLEPWJ0RGUYgQE7cGgS3tNxbqCGM7g==",
|
"integrity": "sha512-T0NIuQpnTvFDATNuHN5roPwSBG83rFsuO+MXXH9/3N1eFbn4wcPjttvjMLEPWJ0RGUYgQE7cGgS3tNxbqCGM7g==",
|
||||||
"optional": true
|
"optional": true
|
||||||
},
|
},
|
||||||
|
"dezalgo": {
|
||||||
|
"version": "1.0.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/dezalgo/-/dezalgo-1.0.4.tgz",
|
||||||
|
"integrity": "sha512-rXSP0bf+5n0Qonsb+SVVfNfIsimO4HEtmnIpPHY8Q1UCzKlQrDMfdobr8nJOOsRgWCyMRqeSBQzmWUMq7zvVig==",
|
||||||
|
"requires": {
|
||||||
|
"asap": "^2.0.0",
|
||||||
|
"wrappy": "1"
|
||||||
|
}
|
||||||
|
},
|
||||||
"electron": {
|
"electron": {
|
||||||
"version": "31.1.0",
|
"version": "31.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/electron/-/electron-31.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/electron/-/electron-31.1.0.tgz",
|
||||||
@ -1574,6 +1700,16 @@
|
|||||||
"mime-types": "^2.1.12"
|
"mime-types": "^2.1.12"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"formidable": {
|
||||||
|
"version": "3.5.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/formidable/-/formidable-3.5.1.tgz",
|
||||||
|
"integrity": "sha512-WJWKelbRHN41m5dumb0/k8TeAx7Id/y3a+Z7QfhxP/htI9Js5zYaEDtG8uMgG0vM0lOlqnmjE99/kfpOYi/0Og==",
|
||||||
|
"requires": {
|
||||||
|
"dezalgo": "^1.0.4",
|
||||||
|
"hexoid": "^1.0.0",
|
||||||
|
"once": "^1.4.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"fs-extra": {
|
"fs-extra": {
|
||||||
"version": "8.1.0",
|
"version": "8.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz",
|
||||||
@ -1705,6 +1841,11 @@
|
|||||||
"function-bind": "^1.1.2"
|
"function-bind": "^1.1.2"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"hexoid": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/hexoid/-/hexoid-1.0.0.tgz",
|
||||||
|
"integrity": "sha512-QFLV0taWQOZtvIRIAdBChesmogZrtuXvVWsFHZTk2SU+anspqZ2vMnoLg7IE1+Uk16N19APic1BuF8bC8c2m5g=="
|
||||||
|
},
|
||||||
"html-encoding-sniffer": {
|
"html-encoding-sniffer": {
|
||||||
"version": "4.0.0",
|
"version": "4.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-4.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-4.0.0.tgz",
|
||||||
@ -1827,6 +1968,16 @@
|
|||||||
"escape-string-regexp": "^4.0.0"
|
"escape-string-regexp": "^4.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"mergexml": {
|
||||||
|
"version": "1.2.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/mergexml/-/mergexml-1.2.4.tgz",
|
||||||
|
"integrity": "sha512-yiOlDqcVCz7AG1eSboonc18FTlfqDEKYfGoAV3Lul98u6YRV/s0kjtf4bjk47t0hLTFJR0BSYMd6BpmX3xDjNQ==",
|
||||||
|
"requires": {
|
||||||
|
"@xmldom/xmldom": "^0.7.0",
|
||||||
|
"formidable": "^3.5.1",
|
||||||
|
"xpath": "0.0.27"
|
||||||
|
}
|
||||||
|
},
|
||||||
"mime-db": {
|
"mime-db": {
|
||||||
"version": "1.52.0",
|
"version": "1.52.0",
|
||||||
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
|
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
|
||||||
@ -2122,6 +2273,16 @@
|
|||||||
"resolved": "https://registry.npmjs.org/xmlchars/-/xmlchars-2.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/xmlchars/-/xmlchars-2.2.0.tgz",
|
||||||
"integrity": "sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw=="
|
"integrity": "sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw=="
|
||||||
},
|
},
|
||||||
|
"xmldom": {
|
||||||
|
"version": "0.6.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/xmldom/-/xmldom-0.6.0.tgz",
|
||||||
|
"integrity": "sha512-iAcin401y58LckRZ0TkI4k0VSM1Qg0KGSc3i8rU+xrxe19A/BN1zHyVSJY7uoutVlaTSzYyk/v5AmkewAP7jtg=="
|
||||||
|
},
|
||||||
|
"xpath": {
|
||||||
|
"version": "0.0.27",
|
||||||
|
"resolved": "https://registry.npmjs.org/xpath/-/xpath-0.0.27.tgz",
|
||||||
|
"integrity": "sha512-fg03WRxtkCV6ohClePNAECYsmpKKTv5L8y/X3Dn1hQrec3POx2jHZ/0P2qQ6HvsrU1BmeqXcof3NGGueG6LxwQ=="
|
||||||
|
},
|
||||||
"yauzl": {
|
"yauzl": {
|
||||||
"version": "2.10.0",
|
"version": "2.10.0",
|
||||||
"resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.10.0.tgz",
|
"resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.10.0.tgz",
|
||||||
|
@ -13,9 +13,13 @@
|
|||||||
"electron": "^31.1.0"
|
"electron": "^31.1.0"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@blockly/field-multilineinput": "^5.0.5",
|
||||||
|
"@blockly/theme-dark": "^7.0.3",
|
||||||
"@electron/remote": "^2.1.2",
|
"@electron/remote": "^2.1.2",
|
||||||
"blockly": "^11.1.1",
|
"blockly": "^11.1.1",
|
||||||
"bootstrap": "^5.3.3",
|
"bootstrap": "^5.3.3",
|
||||||
"electron-prompt": "^1.7.0"
|
"electron-prompt": "^1.7.0",
|
||||||
|
"mergexml": "^1.2.4",
|
||||||
|
"xmldom": "^0.6.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,25 +1,27 @@
|
|||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
const { DOMParser, XMLSerializer } = require('xmldom');
|
||||||
|
|
||||||
const peripheralsfolder = path.join(__dirname, "../blocks");
|
const peripheralsfolder = path.join(__dirname, "../blocks");
|
||||||
|
|
||||||
function mergeXml(originalXml, appendXml) {
|
function mergeXml(xml1, xml2) {
|
||||||
// Remove <xml id="toolbox" style="display: none;"> and </xml> from appendXml
|
const parser = new DOMParser();
|
||||||
const cleanedAppendXml = appendXml.replace(/^<xml[^>]*>|<\/xml>$/g, '').trim();
|
const serializer = new XMLSerializer();
|
||||||
|
|
||||||
// Find the closing </xml> tag in originalXml
|
const doc1 = parser.parseFromString(xml1, 'text/xml');
|
||||||
const closingTag = '</xml>';
|
const doc2 = parser.parseFromString(xml2, 'text/xml');
|
||||||
const index = originalXml.lastIndexOf(closingTag);
|
|
||||||
|
|
||||||
if (index === -1) {
|
const root1 = doc1.documentElement;
|
||||||
console.error('Closing </xml> tag not found in original XML.');
|
const children2 = doc2.documentElement.childNodes;
|
||||||
return originalXml; // return original XML as is
|
|
||||||
|
// Iterate through children2 and append each node to root1
|
||||||
|
for (let i = 0; i < children2.length; i++) {
|
||||||
|
root1.appendChild(children2[i].cloneNode(true));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Prepare the modified XML with the insertion of cleanedAppendXml
|
const mergedXml = serializer.serializeToString(doc1);
|
||||||
const modifiedXml = originalXml.slice(0, index) + cleanedAppendXml + originalXml.slice(index + closingTag.length);
|
console.log(mergedXml)
|
||||||
|
return mergedXml;
|
||||||
return modifiedXml;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadperipheral(workspace, currenttoolbar, peripherals) {
|
function loadperipheral(workspace, currenttoolbar, peripherals) {
|
||||||
|
67
src/ccRemote.js
Normal file
67
src/ccRemote.js
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
const WebSocket = require('ws');
|
||||||
|
|
||||||
|
class CCRemote {
|
||||||
|
constructor(ip = "127.0.0.1", port = 5133) {
|
||||||
|
this.socket = new WebSocket.Server({
|
||||||
|
port: port,
|
||||||
|
host: ip
|
||||||
|
});
|
||||||
|
|
||||||
|
console.log("Server is started");
|
||||||
|
|
||||||
|
this.socket.on('connection', (ws) => {
|
||||||
|
console.log('WebSocket connection established.');
|
||||||
|
|
||||||
|
ws.on('message', (message) => {
|
||||||
|
console.log(`Received message => ${message}`);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
this.socket.on('close', () => {
|
||||||
|
console.log('WebSocket connection closed.');
|
||||||
|
});
|
||||||
|
|
||||||
|
this.socket.on('error', (error) => {
|
||||||
|
console.error('WebSocket error:', error);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
sendCommand(command) {
|
||||||
|
// Iterate over each connected client and send the command
|
||||||
|
this.socket.clients.forEach((client) => {
|
||||||
|
if (client.readyState === WebSocket.OPEN) {
|
||||||
|
client.send(command);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
sendCode(Code) {
|
||||||
|
// Iterate over each connected client and send the command
|
||||||
|
this.socket.clients.forEach((client) => {
|
||||||
|
if (client.readyState === WebSocket.OPEN) {
|
||||||
|
client.send("sendcode");
|
||||||
|
setTimeout(() => {
|
||||||
|
console.log(Code)
|
||||||
|
client.send(Code);
|
||||||
|
return true
|
||||||
|
}, 500);
|
||||||
|
} else {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
runCode() {
|
||||||
|
// Iterate over each connected client and send the command
|
||||||
|
this.socket.clients.forEach((client) => {
|
||||||
|
if (client.readyState === WebSocket.OPEN) {
|
||||||
|
client.send("runcode");
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = { CCRemote };
|
@ -3,6 +3,9 @@ function delay(time) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const { luaGenerator } = require('blockly/lua'); // Use require syntax for Blockly module
|
const { luaGenerator } = require('blockly/lua'); // Use require syntax for Blockly module
|
||||||
|
const { CCRemote } = require("./ccRemote")
|
||||||
|
|
||||||
|
const ccInstance = new CCRemote('127.0.0.1', 5133);
|
||||||
|
|
||||||
const progress = document.getElementById("progress");
|
const progress = document.getElementById("progress");
|
||||||
const circles = document.querySelectorAll(".circle");
|
const circles = document.querySelectorAll(".circle");
|
||||||
@ -33,6 +36,9 @@ const uploadUpdateProgress = () => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function clientexit() {
|
||||||
|
ccInstance.sendCommand("exit")
|
||||||
|
}
|
||||||
async function gencode() {
|
async function gencode() {
|
||||||
document.getElementById('upload-popup').style.display = 'block';
|
document.getElementById('upload-popup').style.display = 'block';
|
||||||
upcurrentActive = 1;
|
upcurrentActive = 1;
|
||||||
@ -43,8 +49,9 @@ async function gencode() {
|
|||||||
upcurrentActive++;
|
upcurrentActive++;
|
||||||
uploadUpdateProgress();
|
uploadUpdateProgress();
|
||||||
document.getElementById('upload-status').textContent = "Generating code";
|
document.getElementById('upload-status').textContent = "Generating code";
|
||||||
|
let code = null;
|
||||||
try {
|
try {
|
||||||
let code = luaGenerator.workspaceToCode(workspace);
|
code = luaGenerator.workspaceToCode(workspace);
|
||||||
console.log(code);
|
console.log(code);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
uploadError = true;
|
uploadError = true;
|
||||||
@ -57,16 +64,18 @@ async function gencode() {
|
|||||||
document.getElementById('upload-status').textContent = "Uploading code to machine";
|
document.getElementById('upload-status').textContent = "Uploading code to machine";
|
||||||
upcurrentActive++;
|
upcurrentActive++;
|
||||||
uploadUpdateProgress();
|
uploadUpdateProgress();
|
||||||
await delay(1000)
|
ccInstance.sendCode(code);
|
||||||
|
await delay(500)
|
||||||
|
|
||||||
// execute with remote
|
// execute with remote
|
||||||
document.getElementById('upload-status').textContent = "Executing code";
|
document.getElementById('upload-status').textContent = "Executing code";
|
||||||
upcurrentActive++;
|
upcurrentActive++;
|
||||||
uploadUpdateProgress();
|
uploadUpdateProgress();
|
||||||
await delay(1000)
|
ccInstance.runCode();
|
||||||
|
|
||||||
// done!
|
// done!
|
||||||
document.getElementById('upload-status').textContent = "Done!";
|
document.getElementById('upload-status').textContent = "Done!";
|
||||||
|
await delay(1000)
|
||||||
document.getElementById('upload-popup').style.animation = 'fadeOut 0.3s ease'; // Apply fade-out animation
|
document.getElementById('upload-popup').style.animation = 'fadeOut 0.3s ease'; // Apply fade-out animation
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
document.getElementById('upload-popup').style.display = 'none'; // Hide popup after animation completes
|
document.getElementById('upload-popup').style.display = 'none'; // Hide popup after animation completes
|
||||||
|
@ -22,7 +22,10 @@
|
|||||||
<button class="navbar-button" title="Library and Packages" style="background-color: #0087bd;">
|
<button class="navbar-button" title="Library and Packages" style="background-color: #0087bd;">
|
||||||
<svg viewBox="0 0 24 24"><path d="M21 16.5c0 .38-.21.71-.53.88l-7.9 4.44c-.16.12-.36.18-.57.18-.21 0-.41-.06-.57-.18l-7.9-4.44A.991.991 0 0 1 3 16.5v-9c0-.38.21-.71.53-.88l7.9-4.44c.16-.12.36-.18.57-.18.21 0 .41.06.57.18l7.9 4.44c.32.17.53.5.53.88v9M12 4.15l-1.89 1.07L16 8.61l1.96-1.11L12 4.15M6.04 7.5 12 10.85l1.96-1.1-5.88-3.4L6.04 7.5M5 15.91l6 3.38v-6.71L5 9.21v6.7m14 0v-6.7l-6 3.37v6.71l6-3.38z" /></svg>
|
<svg viewBox="0 0 24 24"><path d="M21 16.5c0 .38-.21.71-.53.88l-7.9 4.44c-.16.12-.36.18-.57.18-.21 0-.41-.06-.57-.18l-7.9-4.44A.991.991 0 0 1 3 16.5v-9c0-.38.21-.71.53-.88l7.9-4.44c.16-.12.36-.18.57-.18.21 0 .41.06.57.18l7.9 4.44c.32.17.53.5.53.88v9M12 4.15l-1.89 1.07L16 8.61l1.96-1.11L12 4.15M6.04 7.5 12 10.85l1.96-1.1-5.88-3.4L6.04 7.5M5 15.91l6 3.38v-6.71L5 9.21v6.7m14 0v-6.7l-6 3.37v6.71l6-3.38z" /></svg>
|
||||||
</button>
|
</button>
|
||||||
<button class="navbar-button" title="Run" style="background-color: #0087bd; margin-left: auto;" onclick="gencode()">
|
<button class="navbar-button" title="Disconnect Client" style="background-color: #bd0000; margin-left: auto; position: absolute; right: 65px;" onclick="clientexit()">
|
||||||
|
<svg viewBox="0 0 24 24"><path d="M19 3H5c-1.11 0-2 .89-2 2v4h2V5h14v14H5v-4H3v4a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V5a2 2 0 0 0-2-2m-8.92 12.58L11.5 17l5-5-5-5-1.42 1.41L12.67 11H3v2h9.67l-2.59 2.58z" /></svg>
|
||||||
|
</button>
|
||||||
|
<button class="navbar-button" title="Run" style="background-color: #10bd00; margin-left: auto;" onclick="gencode()">
|
||||||
<svg viewBox="0 0 24 24"><path d="M8 5.14v14l11-7-11-7z" /></svg>
|
<svg viewBox="0 0 24 24"><path d="M8 5.14v14l11-7-11-7z" /></svg>
|
||||||
</button>
|
</button>
|
||||||
</nav>
|
</nav>
|
||||||
|
61
src/index.js
61
src/index.js
@ -28,6 +28,7 @@ app.whenReady().then(() => {
|
|||||||
|
|
||||||
win.loadFile('index.html')
|
win.loadFile('index.html')
|
||||||
//win.openDevTools();
|
//win.openDevTools();
|
||||||
|
win.maximize()
|
||||||
|
|
||||||
//app.on('activate', () => {
|
//app.on('activate', () => {
|
||||||
// if (BrowserWindow.getAllWindows().length === 0) {
|
// if (BrowserWindow.getAllWindows().length === 0) {
|
||||||
@ -111,8 +112,8 @@ app.whenReady().then(() => {
|
|||||||
{
|
{
|
||||||
label: 'Edit',
|
label: 'Edit',
|
||||||
submenu: [
|
submenu: [
|
||||||
{ role: 'undo', accelerator: 'CmdOrCtrl+Z' },
|
{ role: 'undo', accelerator: 'CmdOrCtrl+Z', click: () => {win.webContents.send('request-undo-redo', false)} },
|
||||||
{ role: 'redo', accelerator: 'CmdOrCtrl+Y' },
|
{ role: 'redo', accelerator: 'CmdOrCtrl+Y', click: () => {win.webContents.send('request-undo-redo', true)} },
|
||||||
{ type: 'separator' },
|
{ type: 'separator' },
|
||||||
{ role: 'cut', accelerator: 'CmdOrCtrl+X' },
|
{ role: 'cut', accelerator: 'CmdOrCtrl+X' },
|
||||||
{ role: 'copy', accelerator: 'CmdOrCtrl+C' },
|
{ role: 'copy', accelerator: 'CmdOrCtrl+C' },
|
||||||
@ -226,33 +227,33 @@ app.whenReady().then(() => {
|
|||||||
ipc.on('workspace-notsave', (event) => {
|
ipc.on('workspace-notsave', (event) => {
|
||||||
win.setTitle(`${currentprojectname}* | ccIDE`)
|
win.setTitle(`${currentprojectname}* | ccIDE`)
|
||||||
})
|
})
|
||||||
|
|
||||||
/*
|
|
||||||
win.on('close', function(e){
|
|
||||||
win.show()
|
|
||||||
});
|
|
||||||
|
|
||||||
app.on("before-quit", function() {
|
|
||||||
if (currentprojectopen) {
|
|
||||||
const result = dialog.showMessageBoxSync({
|
|
||||||
type: 'question',
|
|
||||||
buttons: ['Save', 'Don\'t Save', 'Cancel'],
|
|
||||||
defaultId: 2,
|
|
||||||
title: 'Save Changes',
|
|
||||||
message: "Your project is not saved",
|
|
||||||
});
|
|
||||||
if (result === 1) {
|
|
||||||
win = null
|
|
||||||
} else if (result === 0) {
|
|
||||||
appexiting = true;
|
|
||||||
win.webContents.send('save-workspace-request');
|
|
||||||
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
win = null
|
|
||||||
}
|
|
||||||
|
|
||||||
})
|
|
||||||
*/
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
app.on("close", function(e) {
|
||||||
|
console.log("Close event triggered");
|
||||||
|
if (currentprojectopen) {
|
||||||
|
const result = dialog.showMessageBoxSync({
|
||||||
|
type: 'question',
|
||||||
|
buttons: ['Save', 'Don\'t Save', 'Cancel'],
|
||||||
|
defaultId: 2,
|
||||||
|
title: 'Save Changes',
|
||||||
|
message: "Your project is not saved",
|
||||||
|
});
|
||||||
|
if (result === 1) {
|
||||||
|
// Don't save, continue closing
|
||||||
|
win = null;
|
||||||
|
} else if (result === 0) {
|
||||||
|
// Save and then quit
|
||||||
|
appexiting = true;
|
||||||
|
win.webContents.send('save-workspace-request');
|
||||||
|
} else {
|
||||||
|
// Cancel the close operation
|
||||||
|
e.preventDefault();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// No unsaved changes, continue closing
|
||||||
|
win = null;
|
||||||
|
}
|
||||||
|
});
|
@ -1,50 +1,17 @@
|
|||||||
{
|
{
|
||||||
"sys_commmands_exec": {
|
"sys_sleep": {
|
||||||
"message0": "Execute %1",
|
"message0": "Sleep For %1 Second",
|
||||||
"args0": [
|
"args0": [
|
||||||
{
|
{
|
||||||
"type": "input_value",
|
"type": "input_value",
|
||||||
"name": "EXECOMMANDS",
|
"name": "SLEEPSEC",
|
||||||
"text": "say Hello World"
|
"text": 1
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"previousStatement": null,
|
"previousStatement": null,
|
||||||
"nextStatement": null,
|
"nextStatement": null,
|
||||||
"colour": 120,
|
"colour": 120,
|
||||||
"tooltip": "Execute a specific command.",
|
"tooltip": "Sleep command",
|
||||||
"helpUrl": "https://tweaked.cc/module/commands.html#v:exec"
|
"helpUrl": ""
|
||||||
},
|
|
||||||
"sys_commmands_getblockposition": {
|
|
||||||
"message0": "GetBlockInfo at minX %1 minY %2 minZ %3 maxX %4 maxY %5 maxZ %6",
|
|
||||||
"args0": [
|
|
||||||
{
|
|
||||||
"type": "input_value",
|
|
||||||
"name": "MINX"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "input_value",
|
|
||||||
"name": "MINY"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "input_value",
|
|
||||||
"name": "MINZ"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "input_value",
|
|
||||||
"name": "MAXX"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "input_value",
|
|
||||||
"name": "MAXY"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "input_value",
|
|
||||||
"name": "MAXZ"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"colour": 120,
|
|
||||||
"output": "Array",
|
|
||||||
"tooltip": "Get information about a range of blocks.",
|
|
||||||
"helpUrl": "https://tweaked.cc/module/commands.html#v:getBlockInfos"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -0,0 +1,14 @@
|
|||||||
|
const { luaGenerator } = require('blockly/lua');
|
||||||
|
|
||||||
|
// Check if luaGenerator.forBlock is defined and initialize if necessary-
|
||||||
|
if (!luaGenerator.forBlock) {
|
||||||
|
luaGenerator.forBlock = {};
|
||||||
|
}
|
||||||
|
|
||||||
|
// Define your custom block handler
|
||||||
|
luaGenerator.forBlock['sys_sleep'] = function(block, generator) {
|
||||||
|
var sleepfor = generator.valueToCode(block, 'SLEEPSEC', generator.ORDER_OVERRIDES);
|
||||||
|
|
||||||
|
var code = `sleep(${sleepfor})`;
|
||||||
|
return code;
|
||||||
|
};
|
@ -1,9 +1,16 @@
|
|||||||
<xml id="toolbox" style="display: none;">
|
<xml id="toolbox" style="display: none;">
|
||||||
<category name="Control">
|
<category name="Control">
|
||||||
|
<block type="sys_sleep">
|
||||||
|
<value name="SLEEPSEC">
|
||||||
|
<shadow type="math_number">
|
||||||
|
<field name="NUM">1</field>
|
||||||
|
</shadow>
|
||||||
|
</value>
|
||||||
|
</block>
|
||||||
<block type="controls_repeat_ext" >
|
<block type="controls_repeat_ext" >
|
||||||
<value name="TIMES">
|
<value name="TIMES">
|
||||||
<shadow type="math_number">
|
<shadow type="math_number">
|
||||||
<field name="NUM">10</field>
|
<field name="NUM">10</field>
|
||||||
</shadow>
|
</shadow>
|
||||||
</value>
|
</value>
|
||||||
</block>
|
</block>
|
||||||
@ -41,7 +48,7 @@
|
|||||||
</category>
|
</category>
|
||||||
<category name="Math">
|
<category name="Math">
|
||||||
<block type="math_number" gap="32">
|
<block type="math_number" gap="32">
|
||||||
<field name="NUM">123</field>
|
<field name="NUM">123</field>
|
||||||
</block>
|
</block>
|
||||||
<block type="math_arithmetic">
|
<block type="math_arithmetic">
|
||||||
<value name="A">
|
<value name="A">
|
||||||
@ -299,11 +306,4 @@
|
|||||||
</category>
|
</category>
|
||||||
<category name="Functions" custom="PROCEDURE"></category>
|
<category name="Functions" custom="PROCEDURE"></category>
|
||||||
<sep></sep>
|
<sep></sep>
|
||||||
<!-- commands -->
|
|
||||||
<category name="Commands" colour="120">
|
|
||||||
<block type="sys_commmands_exec"></block>
|
|
||||||
<block type="sys_commmands_getblockposition"></block>
|
|
||||||
</category>
|
|
||||||
|
|
||||||
<sep></sep>
|
|
||||||
</xml>
|
</xml>
|
@ -9,18 +9,33 @@ const path = require('path');
|
|||||||
const { ipcRenderer } = require("electron");
|
const { ipcRenderer } = require("electron");
|
||||||
const { loadperipheral } = require("./blocksmanager");
|
const { loadperipheral } = require("./blocksmanager");
|
||||||
const Blockly = require('blockly');
|
const Blockly = require('blockly');
|
||||||
|
const { DarkTheme } = require('@blockly/theme-dark')
|
||||||
const ipc = ipcRenderer;
|
const ipc = ipcRenderer;
|
||||||
|
|
||||||
|
|
||||||
let isprojectsaved = false;
|
let isprojectsaved = false;
|
||||||
let usedlibinproject = []
|
let usedlibinproject = []
|
||||||
|
|
||||||
Blockly.utils.colour.setHsvSaturation(0.9)
|
Blockly.utils.colour.setHsvSaturation(0.9)
|
||||||
|
|
||||||
let originaltoolbar = fs.readFileSync(path.join(__dirname, "toolbox.xml"), 'utf8');
|
let originaltoolbar = fs.readFileSync(path.join(__dirname, "toolbox.xml"), 'utf8');
|
||||||
|
const sysmodulejson = fs.readFileSync(path.join(__dirname, "module_block_design.json"), 'utf8');
|
||||||
|
|
||||||
|
const blocksJson = JSON.parse(sysmodulejson);
|
||||||
|
for (const blockId in blocksJson) {
|
||||||
|
if (blocksJson.hasOwnProperty(blockId)) {
|
||||||
|
Blockly.Blocks[blockId] = {
|
||||||
|
init: function() {
|
||||||
|
this.jsonInit(blocksJson[blockId]);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
require("./module_generator")
|
||||||
|
|
||||||
|
|
||||||
var workspace = Blockly.inject('blocklyDiv', {
|
var workspace = Blockly.inject('blocklyDiv', {
|
||||||
toolbox: originaltoolbar,
|
toolbox: originaltoolbar,
|
||||||
|
theme: DarkTheme,
|
||||||
trashcan: true,
|
trashcan: true,
|
||||||
grid: {
|
grid: {
|
||||||
spacing: 20,
|
spacing: 20,
|
||||||
@ -31,6 +46,7 @@ var workspace = Blockly.inject('blocklyDiv', {
|
|||||||
});
|
});
|
||||||
|
|
||||||
originaltoolbar = loadperipheral(workspace, originaltoolbar, "test");
|
originaltoolbar = loadperipheral(workspace, originaltoolbar, "test");
|
||||||
|
originaltoolbar = loadperipheral(workspace, originaltoolbar, "IDE");
|
||||||
|
|
||||||
workspace.getToolbox().getFlyout().autoClose = false;
|
workspace.getToolbox().getFlyout().autoClose = false;
|
||||||
|
|
||||||
@ -72,7 +88,13 @@ ipc.on('workspace-saved', (event, success) => {
|
|||||||
isprojectsaved = success
|
isprojectsaved = success
|
||||||
});
|
});
|
||||||
|
|
||||||
|
ipc.on('request-undo-redo', (event, redo) => {
|
||||||
|
console.log(redo)
|
||||||
|
workspace.undo(redo)
|
||||||
|
});
|
||||||
|
|
||||||
// Ensure Blockly container is shown after the workspace is injected
|
// Ensure Blockly container is shown after the workspace is injected
|
||||||
document.getElementById('loadingScreen').style.visibility = 'hidden';
|
document.getElementById('loadingScreen').style.visibility = 'hidden';
|
||||||
document.getElementById('blocklyContainer').style.visibility = 'visible';
|
document.getElementById('blocklyContainer').style.visibility = 'visible';
|
||||||
document.getElementById('statusMessage').textContent = "ready";
|
document.getElementById('statusMessage').textContent = "ready";
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user