Show More
@@ -87,7 +87,6 b' class NotebookHandler(IPythonHandler):' | |||||
87 | notebook_name, notebook_path = nbm.named_notebook_path(notebook_path) |
|
87 | notebook_name, notebook_path = nbm.named_notebook_path(notebook_path) | |
88 | data = jsonapi.loads(self.request.body) |
|
88 | data = jsonapi.loads(self.request.body) | |
89 | model = nbm.change_notebook(data, notebook_name, notebook_path) |
|
89 | model = nbm.change_notebook(data, notebook_name, notebook_path) | |
90 | self.log.info(model) |
|
|||
91 | self.finish(jsonapi.dumps(model)) |
|
90 | self.finish(jsonapi.dumps(model)) | |
92 |
|
91 | |||
93 | @web.authenticated |
|
92 | @web.authenticated |
@@ -60,8 +60,8 b' var IPython = (function (IPython) {' | |||||
60 | * @param {object|undefined} [options] |
|
60 | * @param {object|undefined} [options] | |
61 | * @param [options.cm_config] {object} config to pass to CodeMirror |
|
61 | * @param [options.cm_config] {object} config to pass to CodeMirror | |
62 | */ |
|
62 | */ | |
63 |
var CodeCell = function ( |
|
63 | var CodeCell = function (session, options) { | |
64 |
this. |
|
64 | this.session = session || null; | |
65 | this.code_mirror = null; |
|
65 | this.code_mirror = null; | |
66 | this.input_prompt_number = null; |
|
66 | this.input_prompt_number = null; | |
67 | this.collapsed = false; |
|
67 | this.collapsed = false; | |
@@ -232,8 +232,8 b' var IPython = (function (IPython) {' | |||||
232 |
|
232 | |||
233 | // Kernel related calls. |
|
233 | // Kernel related calls. | |
234 |
|
234 | |||
235 |
CodeCell.prototype.set_ |
|
235 | CodeCell.prototype.set_session = function (session) { | |
236 |
this. |
|
236 | this.session = session; | |
237 | } |
|
237 | } | |
238 |
|
238 | |||
239 | /** |
|
239 | /** |
@@ -374,7 +374,7 b' var IPython = (function (IPython) {' | |||||
374 | // TODO: Make killing the kernel configurable. |
|
374 | // TODO: Make killing the kernel configurable. | |
375 | var kill_kernel = false; |
|
375 | var kill_kernel = false; | |
376 | if (kill_kernel) { |
|
376 | if (kill_kernel) { | |
377 |
that. |
|
377 | that.session.kill_kernel(); | |
378 | } |
|
378 | } | |
379 | // if we are autosaving, trigger an autosave on nav-away. |
|
379 | // if we are autosaving, trigger an autosave on nav-away. | |
380 | // still warn, because if we don't the autosave may fail. |
|
380 | // still warn, because if we don't the autosave may fail. | |
@@ -798,7 +798,7 b' var IPython = (function (IPython) {' | |||||
798 |
|
798 | |||
799 | if (ncells === 0 || this.is_valid_cell_index(index) || index === ncells) { |
|
799 | if (ncells === 0 || this.is_valid_cell_index(index) || index === ncells) { | |
800 | if (type === 'code') { |
|
800 | if (type === 'code') { | |
801 |
cell = new IPython.CodeCell(this. |
|
801 | cell = new IPython.CodeCell(this.session); | |
802 | cell.set_input_prompt(); |
|
802 | cell.set_input_prompt(); | |
803 | } else if (type === 'markdown') { |
|
803 | } else if (type === 'markdown') { | |
804 | cell = new IPython.MarkdownCell(); |
|
804 | cell = new IPython.MarkdownCell(); | |
@@ -1393,6 +1393,22 b' var IPython = (function (IPython) {' | |||||
1393 | var notebook_info = this.notebookPath() + this.notebook_name; |
|
1393 | var notebook_info = this.notebookPath() + this.notebook_name; | |
1394 | this.session = new IPython.Session(notebook_info, this); |
|
1394 | this.session = new IPython.Session(notebook_info, this); | |
1395 | this.session.start(); |
|
1395 | this.session.start(); | |
|
1396 | this.link_cells_to_session(); | |||
|
1397 | }; | |||
|
1398 | ||||
|
1399 | ||||
|
1400 | /** | |||
|
1401 | * Once a session is started, link the code cells to the session | |||
|
1402 | * | |||
|
1403 | */ | |||
|
1404 | Notebook.prototype.link_cells_to_session= function(){ | |||
|
1405 | var ncells = this.ncells(); | |||
|
1406 | for (var i=0; i<ncells; i++) { | |||
|
1407 | var cell = this.get_cell(i); | |||
|
1408 | if (cell instanceof IPython.CodeCell) { | |||
|
1409 | cell.set_session(this.session); | |||
|
1410 | }; | |||
|
1411 | }; | |||
1396 | }; |
|
1412 | }; | |
1397 |
|
1413 | |||
1398 | /** |
|
1414 | /** |
@@ -68,15 +68,7 b' var IPython = (function (IPython) {' | |||||
68 | var base_url = $('body').data('baseKernelUrl') + "api/kernels"; |
|
68 | var base_url = $('body').data('baseKernelUrl') + "api/kernels"; | |
69 | this.kernel = new IPython.Kernel(base_url, this.session_id); |
|
69 | this.kernel = new IPython.Kernel(base_url, this.session_id); | |
70 | // Now that the kernel has been created, tell the CodeCells about it. |
|
70 | // Now that the kernel has been created, tell the CodeCells about it. | |
71 | this.kernel._kernel_started(this.kernel_content) |
|
71 | this.kernel._kernel_started(this.kernel_content); | |
72 | var ncells = this.notebook.ncells(); |
|
|||
73 | for (var i=0; i<ncells; i++) { |
|
|||
74 | var cell = this.notebook.get_cell(i); |
|
|||
75 | if (cell instanceof IPython.CodeCell) { |
|
|||
76 | cell.set_kernel(this.kernel) |
|
|||
77 | }; |
|
|||
78 | }; |
|
|||
79 |
|
||||
80 | }; |
|
72 | }; | |
81 |
|
73 | |||
82 | /** |
|
74 | /** |
General Comments 0
You need to be logged in to leave comments.
Login now