Show More
@@ -30,6 +30,15 b' casper.open_new_notebook = function () {' | |||||
30 | this.waitForSelector('.CodeMirror-code'); |
|
30 | this.waitForSelector('.CodeMirror-code'); | |
31 | // and make sure the kernel has started |
|
31 | // and make sure the kernel has started | |
32 | this.waitFor( this.kernel_running ); |
|
32 | this.waitFor( this.kernel_running ); | |
|
33 | // track the IPython busy/idle state | |||
|
34 | this.thenEvaluate(function () { | |||
|
35 | $([IPython.events]).on('status_idle.Kernel',function () { | |||
|
36 | IPython._status = 'idle'; | |||
|
37 | }); | |||
|
38 | $([IPython.events]).on('status_busy.Kernel',function () { | |||
|
39 | IPython._status = 'busy'; | |||
|
40 | }); | |||
|
41 | }); | |||
33 | }; |
|
42 | }; | |
34 |
|
43 | |||
35 | // return whether or not the kernel is running |
|
44 | // return whether or not the kernel is running | |
@@ -57,8 +66,17 b' casper.delete_current_notebook = function () {' | |||||
57 | }); |
|
66 | }); | |
58 | }; |
|
67 | }; | |
59 |
|
68 | |||
|
69 | casper.wait_for_idle = function () { | |||
|
70 | this.waitFor(function () { | |||
|
71 | return this.evaluate(function () { | |||
|
72 | return IPython._status == 'idle'; | |||
|
73 | }); | |||
|
74 | }); | |||
|
75 | }; | |||
|
76 | ||||
60 | // wait for the nth output in a given cell |
|
77 | // wait for the nth output in a given cell | |
61 | casper.wait_for_output = function (cell_num, out_num) { |
|
78 | casper.wait_for_output = function (cell_num, out_num) { | |
|
79 | this.wait_for_idle(); | |||
62 | out_num = out_num || 0; |
|
80 | out_num = out_num || 0; | |
63 | this.then(function() { |
|
81 | this.then(function() { | |
64 | this.waitFor(function (c, o) { |
|
82 | this.waitFor(function (c, o) { | |
@@ -157,7 +175,7 b' casper.execute_cell = function(index){' | |||||
157 | casper.execute_cell_then = function(index, then_callback) { |
|
175 | casper.execute_cell_then = function(index, then_callback) { | |
158 | var return_val = this.execute_cell(index); |
|
176 | var return_val = this.execute_cell(index); | |
159 |
|
177 | |||
160 |
this.wait_for_ |
|
178 | this.wait_for_idle(); | |
161 |
|
179 | |||
162 | var that = this; |
|
180 | var that = this; | |
163 | this.then(function(){ |
|
181 | this.then(function(){ |
General Comments 0
You need to be logged in to leave comments.
Login now