From fa867c3a34056374bfb2acb1b625cf1276df3dfb Mon Sep 17 00:00:00 2001 From: Richard Knoll Date: Tue, 12 Dec 2017 15:24:36 -0800 Subject: [PATCH 1/3] Cleanup --- package.json | 1 + sim/instructions.ts | 91 --------------- sim/public/siminstructions.html | 201 -------------------------------- 3 files changed, 1 insertion(+), 292 deletions(-) delete mode 100644 sim/instructions.ts delete mode 100644 sim/public/siminstructions.html diff --git a/package.json b/package.json index 3fec37d6..0087de27 100644 --- a/package.json +++ b/package.json @@ -39,6 +39,7 @@ "semantic-ui-less": "^2.2.4", "@types/bluebird": "2.0.33", "@types/jquery": "3.2.16", + "@types/marked": "0.3.0", "@types/node": "8.0.53" }, "dependencies": { diff --git a/sim/instructions.ts b/sim/instructions.ts deleted file mode 100644 index b0f872a0..00000000 --- a/sim/instructions.ts +++ /dev/null @@ -1,91 +0,0 @@ -/// -/// - -//HACK: allows instructions.html to access pxtblocks without requiring simulator.html to import blocks as well -if (!(window).pxt) (window).pxt = {}; -import pxtrunner = pxt.runner; -import pxtdocs = pxt.docs; - -namespace pxsim.instructions { - export function drawInstructions() { - pxsim.visuals.mkBoardView = (opts: pxsim.visuals.BoardViewOptions): pxsim.visuals.BoardView => { - return new visuals.EV3BoardSvg({ - runtime: runtime, - theme: visuals.randomTheme(), - disableTilt: false, - wireframe: opts.wireframe, - }); - } - - let getQsVal = parseQueryString(); - - //project name - let name = getQsVal("name") || "Untitled"; - - // board def - const boardDef = JSON.parse(getQsVal("board")) as pxsim.BoardDefinition; - - //parts list - let parts = (getQsVal("parts") || "").split(" "); - parts.sort(); - - // parts definitions - let partDefinitions = JSON.parse(getQsVal("partdefs") || "{}") as pxsim.Map - - //fn args - let fnArgs = JSON.parse((getQsVal("fnArgs") || "{}")); - - //project code - let tsCode = getQsVal("code"); - let tsPackage = getQsVal("package") || ""; - let codeSpinnerDiv = document.getElementById("proj-code-spinner"); - let codeContainerDiv = document.getElementById("proj-code-container"); - if (tsCode) { - //we use the docs renderer to decompile the code to blocks and render it - //TODO: render the blocks code directly - let md = - `\`\`\`blocks -${tsCode} -\`\`\` -\`\`\`package -${tsPackage} -\`\`\` -` - - pxtdocs.requireMarked = function () { return (window).marked; } - pxtrunner.renderMarkdownAsync(codeContainerDiv, md) - .done(function () { - let codeSvg = $("#proj-code-container svg"); - if (codeSvg.length > 0) { - //code rendered successfully as blocks - codeSvg.css("width", "inherit"); - codeSvg.css("height", "inherit"); - //takes the svg out of the wrapper markdown - codeContainerDiv.innerHTML = ""; - codeContainerDiv.appendChild(codeSvg[0]); - } else { - //code failed to convert to blocks, display as typescript instead - codeContainerDiv.innerText = tsCode; - } - $(codeContainerDiv).show(); - $(codeSpinnerDiv).hide(); - }); - } - - - if (name) - $("#proj-title").text(name); - - //init runtime - if (!pxsim.initCurrentRuntime) - pxsim.initCurrentRuntime = initRuntimeWithDalBoard; - - renderParts({ - name, - boardDef, - parts, - partDefinitions, - fnArgs - }) - } -} \ No newline at end of file diff --git a/sim/public/siminstructions.html b/sim/public/siminstructions.html deleted file mode 100644 index e5fbdd60..00000000 --- a/sim/public/siminstructions.html +++ /dev/null @@ -1,201 +0,0 @@ - - - - - - Assembly Instructions - - - - - -
-
-
- - - - - - - - - - - - - - - - - - -
-

- - -
- -
-
-
-
- - \ No newline at end of file From 5678cf5df91b7ff15317294d544b11ccf4189c4d Mon Sep 17 00:00:00 2001 From: Richard Knoll Date: Wed, 13 Dec 2017 10:29:12 -0800 Subject: [PATCH 2/3] Fixing test file --- libs/core/test.ts | 45 +++++++++++++++------------------------------ 1 file changed, 15 insertions(+), 30 deletions(-) diff --git a/libs/core/test.ts b/libs/core/test.ts index 056e7c43..2147a5ba 100644 --- a/libs/core/test.ts +++ b/libs/core/test.ts @@ -1,51 +1,36 @@ screen.clear() -screen.print("PXT!", 10, 30, Draw.Quad) +brick.print("PXT!", 10, 30, Draw.Quad) -screen.drawRect(40, 40, 20, 10, Draw.Fill) -motors.setStatusLight(LightsPattern.Orange) +brick.drawRect(40, 40, 20, 10, Draw.Fill) +brick.setStatusLight(LightsPattern.Orange) -screen.heart.doubled().draw(100, 50, Draw.Double | Draw.Transparent) +brick.heart.doubled().draw(100, 50, Draw.Double | Draw.Transparent) -sensors.buttonEnter.onEvent(ButtonEvent.Click, () => { +brick.buttonEnter.onEvent(ButtonEvent.Click, () => { screen.clear() }) -sensors.buttonLeft.onEvent(ButtonEvent.Click, () => { - screen.drawRect(10, 70, 20, 10, Draw.Fill) - motors.setStatusLight(LightsPattern.Red) - screen.setFont(screen.microbitFont()) +brick.buttonLeft.onEvent(ButtonEvent.Click, () => { + brick.drawRect(10, 70, 20, 10, Draw.Fill) + brick.setStatusLight(LightsPattern.Red) + brick.setFont(brick.microbitFont()) }) -sensors.buttonRight.onEvent(ButtonEvent.Click, () => { - screen.print("Right!", 10, 60) +brick.buttonRight.onEvent(ButtonEvent.Click, () => { + brick.print("Right!", 10, 60) }) -sensors.buttonDown.onEvent(ButtonEvent.Click, () => { - screen.print("Down! ", 10, 60) +brick.buttonDown.onEvent(ButtonEvent.Click, () => { + brick.print("Down! ", 10, 60) }) -sensors.buttonUp.onEvent(ButtonEvent.Click, () => { - screen.print("Up! ", 10, 60) +brick.buttonUp.onEvent(ButtonEvent.Click, () => { + brick.print("Up! ", 10, 60) }) let num = 0 -sensors.touchSensor1.onEvent(TouchSensorEvent.Bumped, () => { - screen.print("Click! " + num, 10, 60) - num++ -}) - -sensors.remoteButtonTopLeft.onEvent(ButtonEvent.Click, () => { - screen.print("TOPLEFT " + num, 10, 60) - num++ -}) - -sensors.remoteButtonTopRight.onEvent(ButtonEvent.Down, () => { - screen.print("TOPRIGH " + num, 10, 60) - num++ -}) - loops.forever(() => { serial.writeDmesg() loops.pause(100) From b73b924ec490986260d13755ca3544e16be98ba0 Mon Sep 17 00:00:00 2001 From: Peli de Halleux Date: Wed, 13 Dec 2017 15:35:53 -0800 Subject: [PATCH 3/3] ignoreing docs errors --- pxtarget.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pxtarget.json b/pxtarget.json index b9f7d928..1b2c1bf9 100644 --- a/pxtarget.json +++ b/pxtarget.json @@ -137,5 +137,6 @@ "monacoColors": { "editor.background": "#ecf6ff" } - } + }, + "ignoreDocsErrors": true }