Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ RunestoneComponents
:target: https://pypi.python.org/pypi/Runestone
:alt: PyPI Monthly downloads

.. image:: http://bnmnetp.me:8088/buildStatus/icon?job=RunestoneComponents&build=9

Packaging of the Runestone components for publishing educational materials using Sphinx and restructuredText. Check out the `Overview <http://interactivepython.org/runestone/static/overview/overview.html>`_ To see all of the extensions in action.
**NOTE** -- If you have used an older version of this repo, please know this is a total restart. I think much better, and it WILL stay up to date as this is now the master copy of the components not just a copy.
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ Sphinx>=1.4.2
sphinx-rtd-theme==0.1.8
sphinxcontrib-paverutils==1.7
SQLAlchemy>=1.0.13
selenium>=2.53.6
10 changes: 10 additions & 0 deletions runTests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env bash

set -e
testhome=`pwd`
cd runestone/activecode/test
runestone build --all
runestone serve --port 8081 &
python test_activecode.py
cd $testhome
kill %1
82 changes: 42 additions & 40 deletions runestone/activecode/js/activecode.js
Original file line number Diff line number Diff line change
Expand Up @@ -222,45 +222,45 @@ ActiveCode.prototype.addHistoryScrubber = function (pos_last) {
this.timestamps.push( (new Date(data.timestamps[t])).toLocaleString() )
}
}
}.bind(this))
.always(function() {
var scrubberDiv = document.createElement("div");
$(scrubberDiv).css("display","inline-block");
$(scrubberDiv).css("margin-left","10px");
$(scrubberDiv).css("margin-right","10px");
$(scrubberDiv).width("180px");
scrubber = document.createElement("div");
this.slideit = function() {
this.editor.setValue(this.history[$(scrubber).slider("value")]);
var curVal = this.timestamps[$(scrubber).slider("value")];
//this.scrubberTime.innerHTML = curVal;
var tooltip = '<div class="sltooltip"><div class="sltooltip-inner">' +
curVal + '</div><div class="sltooltip-arrow"></div></div>';
$(scrubber).find(".ui-slider-handle").html(tooltip);
setTimeout(function () {
$(scrubber).find(".sltooltip").fadeOut()
}, 4000);
};
$(scrubber).slider({
max: this.history.length-1,
value: this.history.length-1,
slide: this.slideit.bind(this),
change: this.slideit.bind(this)
});
scrubberDiv.appendChild(scrubber);

if (pos_last) {
scrubber.value = this.history.length-1
this.editor.setValue(this.history[scrubber.value]);
} else {
scrubber.value = 0;
}

var scrubberDiv = document.createElement("div");
$(scrubberDiv).css("display","inline-block");
$(scrubberDiv).css("margin-left","10px");
$(scrubberDiv).css("margin-right","10px");
$(scrubberDiv).width("180px");
scrubber = document.createElement("div");
this.slideit = function() {
this.editor.setValue(this.history[$(scrubber).slider("value")]);
var curVal = this.timestamps[$(scrubber).slider("value")];
//this.scrubberTime.innerHTML = curVal;
var tooltip = '<div class="sltooltip"><div class="sltooltip-inner">' +
curVal + '</div><div class="sltooltip-arrow"></div></div>';
$(scrubber).find(".ui-slider-handle").html(tooltip);
setTimeout(function () {
$(scrubber).find(".sltooltip").fadeOut()
}, 4000);
};
$(scrubber).slider({
max: this.history.length-1,
value: this.history.length-1,
slide: this.slideit.bind(this),
change: this.slideit.bind(this)
});
scrubberDiv.appendChild(scrubber);

if (pos_last) {
scrubber.value = this.history.length-1
this.editor.setValue(this.history[scrubber.value]);
} else {
scrubber.value = 0;
}

$(this.histButton).remove();
this.histButton = null;
this.historyScrubber = scrubber;
$(scrubberDiv).insertAfter(this.runButton)

}.bind(this));
$(this.histButton).remove();
this.histButton = null;
this.historyScrubber = scrubber;
$(scrubberDiv).insertAfter(this.runButton)
}.bind(this));
}


Expand Down Expand Up @@ -686,12 +686,14 @@ ActiveCode.prototype.buildProg = function() {
// assemble code from prefix, suffix, and editor for running.
var pretext;
var prog = this.editor.getValue();
this.pretext = "";
if (this.includes !== undefined) {
// iterate over the includes, in-order prepending to prog
pretext = "";
for (var x=0; x < this.includes.length; x++) {
pretext = pretext + edList[this.includes[x]].editor.getValue();
}
this.pretext = pretext;
prog = pretext + prog
}

Expand Down Expand Up @@ -738,11 +740,11 @@ ActiveCode.prototype.runProg = function() {

myPromise.then((function(mod) { // success
$(this.runButton).removeAttr('disabled');
this.logRunEvent({'div_id': this.divid, 'code': prog, 'errinfo': 'success', 'to_save':saveCode}); // Log the run event
this.logRunEvent({'div_id': this.divid, 'code': this.editor.getValue(), 'errinfo': 'success', 'to_save':saveCode, 'prefix': this.pretext, 'suffix':this.suffix}); // Log the run event
}).bind(this),
(function(err) { // fail
$(this.runButton).removeAttr('disabled');
this.logRunEvent({'div_id': this.divid, 'code': prog, 'errinfo': err.toString(), 'to_save':saveCode}); // Log the run event
this.logRunEvent({'div_id': this.divid, 'code': this.editor.getValue(), 'errinfo': err.toString(), 'to_save':saveCode, 'prefix': this.pretext, 'suffix':this.suffix}); // Log the run event
this.addErrorMessage(err)
}).bind(this));

Expand Down
2 changes: 1 addition & 1 deletion runestone/activecode/js/skulpt-stdlib.js

Large diffs are not rendered by default.

Loading