new BlockPy(settings, assignment, submission, programs)
Creates an instance of BlockPy
This:
- {BlockPy}
Parameters:
Name | Type | Description |
---|---|---|
settings |
Object | User level settings (e.g., what view mode, whether to mute semantic errors, etc.) |
assignment |
Object | Assignment level settings (data about the loaded assignment, user, submission, etc.) |
submission |
Object | Unused parameter. |
programs |
Object | Includes the source code of any programs to be loaded |
Members
(static) DEFAULT_MODULES :Array.<String>
The default modules to make available to the user.
Type:
- Array.<String>
Methods
initComponents()
Initializes each of the relevant components of BlockPy. For more information,
consult each of the component's relevant JS file in turn.
initDevelopment()
Initiailizes certain development data, useful for testing out new modules in
Skulpt.
initInterface()
Initializes the User Inteface for the instance, by loading in the
HTML file (which has been manually encoded into a JS string using
the build.py script). We do this because its a giant hassle to keep
HTML correct when it's stored in JS strings. We should look into
more sophisticated templating features, probably.
initMain()
Initializes the BlockPy object by initializing its interface,
model, and components.
initModel()
Applys the KnockoutJS bindings to the model, instantiating the values into the
HTML.
reportError()
Redundant method for reporting an error. If this is used anywhere, it should be
converted to direct calls to components.feedback.
setCode(code, namenullable) → {Boolean}
Helper function for setting the current code, optionally in the given filename.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
code |
String | The new Python source code to set. | |
name |
String |
<nullable> |
An optional filename (e.g,. '__main__') to update. Defaults to the currently selected filename. |
Returns:
- whether the code was updated (i.e. there was a diff between new and old).
- Type
- Boolean
turnOnHacks()
Function for running any code that fixes bugs and stuff upstream.
Not pleasant that this exists, but better to have it isolated than
just lying about randomly...