Skip to content

Commit 34503fc

Browse files
authored
Update documentation.md
1 parent 2549e02 commit 34503fc

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

documentation.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ The UI is KnockoutJS, so you have a bunch of HTML templates littered around the
1010

1111
The interface is done via KnockoutJS. That was a mistake but here we are. The UI is broken off into separate components, one of which is the list of possible `Editor` instances. The most critical one is the Python Editor (`editor/python.js`). You bind the `click` event handler to `ui.execute.run`:
1212

13-
https://github.com/blockpy-edu/blockpy/blob/1e3c26ff6ce37e8c1865b1b3898b861a11db1201/src/editor/python.js#L35-L41
13+
https://github.com/blockpy-edu/blockpy/blob/2549e022dffb5164d9e5566e43a07c899448fb80/src/editor/python.js#L35-L41
1414

1515
That function is stuffed into the big main `blockpy.js` file, because apparently Past Me chose to forget everything he knew about modular design:
1616

17-
https://github.com/blockpy-edu/blockpy/blob/1e3c26ff6ce37e8c1865b1b3898b861a11db1201/src/blockpy.js#L1019-L1027
17+
https://github.com/blockpy-edu/blockpy/blob/2549e022dffb5164d9e5566e43a07c899448fb80/src/blockpy.js#L1019-L1027
1818

1919
That is really just dispatching to `delayedRun` (there are performance reasons for this, believe it or not), which in turn is responsible for calling `run` (there are not performance reasons for that, it's just leftover structure from an older hack):
2020

21-
https://github.com/blockpy-edu/blockpy/blob/master/src/engine.js#L98-L124
21+
https://github.com/blockpy-edu/blockpy/blob/2549e022dffb5164d9e5566e43a07c899448fb80/src/engine.js#L98-L124
2222

2323
Okay the actual `run` function finally gets a little interesting. This is in `engine.js` and requires you to understand the `Configuration` hierarchy that we use.
2424

@@ -28,23 +28,23 @@ We need to be able to run the user's code in various ways. The different `Config
2828

2929
Anyway, the critical thing is that if you are calling the `run` function in the `BlockPyEngine` component, then it going to set the current `configuration` for the engine, and then delegate out to the general `execute` function:
3030

31-
https://github.com/blockpy-edu/blockpy/blob/1e3c26ff6ce37e8c1865b1b3898b861a11db1201/src/engine.js#L172-L179
31+
https://github.com/blockpy-edu/blockpy/blob/2549e022dffb5164d9e5566e43a07c899448fb80/src/engine.js#L172-L179
3232

3333
That is where the actual `Skulpt` magic happens, calling `Sk.importMainWithBody` with the appropriate data and returning a promise for when it is finished. After all is done, we call the relevant `Configuration.success` and `Configuration.failure` callbacks and eventually the `Configuration.finally` handlers. Assuming we we have not disabled feedback, *then* we repeat this process for the `onRun`.
3434

35-
https://github.com/blockpy-edu/blockpy/blob/master/src/engine.js#L126-L134
35+
https://github.com/blockpy-edu/blockpy/blob/2549e022dffb5164d9e5566e43a07c899448fb80/src/engine.js#L126-L134
3636

3737
Basically the same process as before, just a little simpler. We are now running the instructor control script: the contents of the assignment's `on_run.py` file wrapped with our template that does all the boilerplate stuff for executing Pedal:
3838

39-
https://github.com/blockpy-edu/blockpy/blob/master/src/engine/on_run.js#L17-L98
39+
https://github.com/blockpy-edu/blockpy/blob/2549e022dffb5164d9e5566e43a07c899448fb80/src/engine/on_run.js#L17-L98
4040

4141
Once that's all done, we post-process the results in various ways, including calling `this.main.components.feedback.presentFeedback(results)`, updating the submission's data locally and on the backend, and so on:
4242

43-
https://github.com/blockpy-edu/blockpy/blob/1e3c26ff6ce37e8c1865b1b3898b861a11db1201/src/engine/on_run.js#L141-L176
43+
https://github.com/blockpy-edu/blockpy/blob/2549e022dffb5164d9e5566e43a07c899448fb80/src/engine/on_run.js#L141-L176
4444

4545
Actually intepretting the feedback is a fairly tedious process, but the `Feedback` component is fairly self-contained. If you poke around the `src/feedback.js` file, you'll find its HTML template and the various logic for controlling it.
4646

47-
https://github.com/blockpy-edu/blockpy/blob/f9efb382b103410cdea3e9eb806ef27cd9e6039b/src/feedback.js#L240-L255
47+
https://github.com/blockpy-edu/blockpy/blob/2549e022dffb5164d9e5566e43a07c899448fb80/src/feedback.js#L240-L255
4848

4949
There's so much I know more now about interfacing more directly with the Skulpt data, but the code mostly works.
5050

0 commit comments

Comments
 (0)