summaryrefslogtreecommitdiff
path: root/js/codeq/python.js
diff options
context:
space:
mode:
authorRobert Zorko <robertz@gurucue.com>2015-09-22 18:14:00 +0200
committerRobert Zorko <robertz@gurucue.com>2015-09-22 18:14:00 +0200
commita8b7f21848c01159a802399f7c45c8e84116ed9a (patch)
treeadafdd69c613b7ff5b23a8060b312f575ae7c642 /js/codeq/python.js
parent5c87d98c0b3383c7ad63f0b69e36110b915e36c2 (diff)
parentac1ea2004cdb34c83115d11b0c3a0c9c2f93a726 (diff)
Merge branch 'master' of ssh://212.235.189.51:22122/codeq-web
Diffstat (limited to 'js/codeq/python.js')
-rw-r--r--js/codeq/python.js31
1 files changed, 27 insertions, 4 deletions
diff --git a/js/codeq/python.js b/js/codeq/python.js
index 66f0371..37fdccd 100644
--- a/js/codeq/python.js
+++ b/js/codeq/python.js
@@ -20,7 +20,10 @@
jqBtnPlan = jqScreen.find('.btn-plan'),
jqBtnHint = jqScreen.find('.btn-hint'),
jqBtnTest = jqScreen.find('.btn-test'),
- jqAllButtons = jqBtnPlan.add(jqBtnHint).add(jqBtnTest), // all the buttons
+ jqBtnRun = jqScreen.find('.btn-run'),
+ jqBtnStop = jqScreen.find('.btn-stop'),
+ jqInfoButtons = jqBtnPlan.add(jqBtnHint).add(jqBtnTest), // all info-focusing buttons
+ jqAllButtons = jqInfoButtons.add(jqBtnRun).add(jqBtnStop), // all buttons
// misc
currentSubState = null,
transitionEventName = 'mousedown',//event name of the event which will trigger the transition between these substates - the most common transition at least (there are some corner cases on the hint and test buttons -> see the code below)
@@ -82,10 +85,15 @@
/* Q.delay(100).then(function(){
jqAllQuadrants.addClass('transition');//for smooth animations - need to be delayed, because otherwise we get some weird "animations" while the page is loading
}).done();*/
- jqAllButtons.on(transitionEventName, function (event) {
+ jqInfoButtons.on(transitionEventName, function (event) {
subScreens.transition('info'); // set focus on the hints quadrant
event.stopPropagation(); // don't allow the event to go on and trigger further transition
});
+ jqBtnRun.on(transitionEventName, function (event) {
+ subScreens.transition('console'); // set focus on the hints quadrant
+ event.stopPropagation(); // don't allow the event to go on and trigger further transition
+ });
+
jqAllQuadrants.on(transitionEventName, function () {
subScreens.transition($(this).data(stateNameTag));
});
@@ -132,7 +140,8 @@
};
terminal.onInput = function (text) {
- return codeq.comms.sendPush({
+ terminal.leftmostCol = 0;
+ return codeq.comms.sendPythonPush({
'text': text + '\n'
}).then(tcs, tcf);
};
@@ -272,9 +281,23 @@
}
).done();
});
+ jqBtnRun.on('click', function () {
+ var program = editor.getDoc().getValue();
+ // TODO error handling
+ codeq.comms.sendPythonStop({});
+ codeq.comms.sendPythonExec({
+ 'program': program
+ });
+ // focus the terminal
+ jqTerminal.click();
+ });
+ jqBtnStop.on('click', function () {
+ // TODO error handling
+ codeq.comms.sendPythonStop({});
+ });
// TODO first line of interpreter output is buffered without this, why?
- codeq.comms.sendPush({
+ codeq.comms.sendPythonPush({
'text': ''
});