From 72ff13358db89542ec813918c4659fc6a70215e2 2012-05-31 20:08:22 From: Brian Granger Date: 2012-05-31 20:08:22 Subject: [PATCH] Adding options to Kernel.execute with a default of silent=true. --- diff --git a/IPython/frontend/html/notebook/static/js/codecell.js b/IPython/frontend/html/notebook/static/js/codecell.js index 762b5ce..a94f29d 100644 --- a/IPython/frontend/html/notebook/static/js/codecell.js +++ b/IPython/frontend/html/notebook/static/js/codecell.js @@ -156,7 +156,7 @@ var IPython = (function (IPython) { 'clear_output': $.proxy(this._handle_clear_output, this), 'cell': this }; - var msg_id = this.kernel.execute(this.get_text(), callbacks); + var msg_id = this.kernel.execute(this.get_text(), callbacks, {silent: false}); }; @@ -302,7 +302,7 @@ var IPython = (function (IPython) { if (data['application/javascript'] !== undefined) { json.javascript = data['application/javascript']; } - return json; + return json; }; diff --git a/IPython/frontend/html/notebook/static/js/kernel.js b/IPython/frontend/html/notebook/static/js/kernel.js index bff2cfb..0d05fc0 100644 --- a/IPython/frontend/html/notebook/static/js/kernel.js +++ b/IPython/frontend/html/notebook/static/js/kernel.js @@ -199,7 +199,17 @@ var IPython = (function (IPython) { return; } - Kernel.prototype.execute = function (code, callbacks) { + Kernel.prototype.execute = function (code, callbacks, options) { + // The options object should contain the options for the execute call. Its default + // values are: + // + // options = { + // silent : true, + // user_variables : [], + // user_expressions : {}, + // allow_stdin : false + // } + // // When calling this method pass a callbacks structure of the form: // // callbacks = { @@ -225,13 +235,15 @@ var IPython = (function (IPython) { // // The cell value will contain the a cell object that the notebook can use for the // set_next_input payload. + var content = { code : code, - silent : false, + silent : true, user_variables : [], user_expressions : {}, allow_stdin : false }; + $.extend(true, content, options) var msg = this._get_msg("execute_request", content); this.shell_channel.send(JSON.stringify(msg)); this.set_callbacks_for_msg(msg.header.msg_id, callbacks);