diff --git a/IPython/html/static/widgets/js/manager.js b/IPython/html/static/widgets/js/manager.js index e98a350ad..9ab72adb1 100644 --- a/IPython/html/static/widgets/js/manager.js +++ b/IPython/html/static/widgets/js/manager.js @@ -97,7 +97,12 @@ define([ // Make sure the view creation is not out of order with // any state updates. model.state_change = model.state_change.then(function() { - console.log('create_view ' + model.id); + try { + console.log('create_view ' + model.id); + console.log(' _view_name ' + model.get('_view_name')); + console.log(' _view_module ' + model.get('_view_module')); + } catch (e) { } + return utils.load_class(model.get('_view_name'), model.get('_view_module'), WidgetManager._view_types).then(function(ViewType) { diff --git a/IPython/html/static/widgets/js/widget.js b/IPython/html/static/widgets/js/widget.js index 42ea44fe4..630345ae8 100644 --- a/IPython/html/static/widgets/js/widget.js +++ b/IPython/html/static/widgets/js/widget.js @@ -70,6 +70,7 @@ define(["widgets/js/manager", _handle_comm_msg: function (msg) { // Handle incoming comm msg. var method = msg.content.data.method; + console.log(method); var that = this; switch (method) { case 'update': @@ -81,8 +82,9 @@ define(["widgets/js/manager", this.trigger('msg:custom', msg.content.data.content); break; case 'display': - that.widget_manager.display_view(msg, that) - .catch(utils.reject("Couldn't process display msg for model id '" + String(that.id) + "'", true)); + this.state_change = this.state_change.then(function() { + return that.widget_manager.display_view(msg, that); + }).catch(utils.reject("Couldn't process display msg for model id '" + String(that.id) + "'", true)); break; } }, @@ -99,6 +101,7 @@ define(["widgets/js/manager", } finally { that.state_lock = null; } + return rsvp.Promise.resolve(); }, utils.reject("Couldn't set model state", true)); }, diff --git a/IPython/html/static/widgets/js/widget_int.js b/IPython/html/static/widgets/js/widget_int.js index 3fd0ae0de..c6278cbe0 100644 --- a/IPython/html/static/widgets/js/widget_int.js +++ b/IPython/html/static/widgets/js/widget_int.js @@ -150,7 +150,7 @@ define([ this.$label.hide(); } else { this.$label.text(description); - MathJax.Hub.Queue(["Typeset",MathJax.Hub,this.$label.get(0)]); + // MathJax.Hub.Queue(["Typeset",MathJax.Hub,this.$label.get(0)]); this.$label.show(); } @@ -308,7 +308,7 @@ define([ this.$label.hide(); } else { this.$label.text(description); - MathJax.Hub.Queue(["Typeset",MathJax.Hub,this.$label.get(0)]); + // MathJax.Hub.Queue(["Typeset",MathJax.Hub,this.$label.get(0)]); this.$label.show(); } } @@ -416,7 +416,7 @@ define([ this.$label.hide(); } else { this.$label.text(description); - MathJax.Hub.Queue(["Typeset",MathJax.Hub,this.$label.get(0)]); + // MathJax.Hub.Queue(["Typeset",MathJax.Hub,this.$label.get(0)]); this.$label.show(); } return ProgressView.__super__.update.apply(this); diff --git a/IPython/html/static/widgets/js/widget_selection.js b/IPython/html/static/widgets/js/widget_selection.js index a40433cef..f441bd474 100644 --- a/IPython/html/static/widgets/js/widget_selection.js +++ b/IPython/html/static/widgets/js/widget_selection.js @@ -94,7 +94,7 @@ define([ this.$label.hide(); } else { this.$label.text(description); - MathJax.Hub.Queue(["Typeset",MathJax.Hub,this.$label.get(0)]); + // MathJax.Hub.Queue(["Typeset",MathJax.Hub,this.$label.get(0)]); this.$label.show(); } } @@ -219,7 +219,7 @@ define([ this.$label.hide(); } else { this.$label.text(description); - MathJax.Hub.Queue(["Typeset",MathJax.Hub,this.$label.get(0)]); + // MathJax.Hub.Queue(["Typeset",MathJax.Hub,this.$label.get(0)]); this.$label.show(); } } @@ -326,7 +326,7 @@ define([ this.$label.hide(); } else { this.$label.text(description); - MathJax.Hub.Queue(["Typeset",MathJax.Hub,this.$label.get(0)]); + // MathJax.Hub.Queue(["Typeset",MathJax.Hub,this.$label.get(0)]); this.$label.show(); } } @@ -441,7 +441,7 @@ define([ this.$label.hide(); } else { this.$label.text(description); - MathJax.Hub.Queue(["Typeset",MathJax.Hub,this.$label.get(0)]); + // MathJax.Hub.Queue(["Typeset",MathJax.Hub,this.$label.get(0)]); this.$label.show(); } } diff --git a/IPython/html/static/widgets/js/widget_string.js b/IPython/html/static/widgets/js/widget_string.js index 535a80c8f..3464c9cd3 100644 --- a/IPython/html/static/widgets/js/widget_string.js +++ b/IPython/html/static/widgets/js/widget_string.js @@ -101,7 +101,7 @@ define([ this.$label.hide(); } else { this.$label.text(description); - MathJax.Hub.Queue(["Typeset",MathJax.Hub,this.$label.get(0)]); + // MathJax.Hub.Queue(["Typeset",MathJax.Hub,this.$label.get(0)]); this.$label.show(); } } @@ -177,7 +177,7 @@ define([ this.$label.hide(); } else { this.$label.text(description); - MathJax.Hub.Queue(["Typeset",MathJax.Hub,this.$label.get(0)]); + // MathJax.Hub.Queue(["Typeset",MathJax.Hub,this.$label.get(0)]); this.$label.show(); } } diff --git a/IPython/html/tests/util.js b/IPython/html/tests/util.js index 1dc3f1b10..14f910bc7 100644 --- a/IPython/html/tests/util.js +++ b/IPython/html/tests/util.js @@ -744,4 +744,26 @@ casper.capture_log = function () { }); }; +casper.interact = function() { + // Start an interactive Javascript console. + var system = require('system'); + system.stdout.writeLine('JS interactive console.'); + system.stdout.writeLine('Type `exit` to quit.'); + + function read_line() { + system.stdout.writeLine('JS: '); + var line = system.stdin.readLine(); + return line; + } + + var input = read_line(); + while (input.trim() != 'exit') { + var output = this.evaluate(function(code) { + return String(eval(code)); + }, {code: input}); + system.stdout.writeLine('\nOut: ' + output); + input = read_line(); + } +}; + casper.capture_log(); diff --git a/IPython/html/tests/widgets/widget_bool.js b/IPython/html/tests/widgets/widget_bool.js index 35e755be2..8b8cb0510 100644 --- a/IPython/html/tests/widgets/widget_bool.js +++ b/IPython/html/tests/widgets/widget_bool.js @@ -13,7 +13,6 @@ casper.notebook_test(function () { 'display(bool_widgets[1])\n' + 'print("Success")'); this.execute_cell_then(bool_index, function(index){ - this.test.assertEquals(this.get_output_cell(index).text, 'Success\n', 'Create bool widget cell executed with correct output.'); @@ -48,7 +47,6 @@ casper.notebook_test(function () { this.test.assert(this.cell_element_function(index, '.widget-area .widget-subarea button', 'hasClass', ['active']), 'Toggle button is toggled.'); - }); index = this.append_cell( @@ -57,6 +55,8 @@ casper.notebook_test(function () { 'print("Success")'); this.execute_cell_then(index, function(index){ + this.interact(); + this.test.assertEquals(this.get_output_cell(index).text, 'Success\n', 'Change bool widget value cell executed with correct output.');