##// END OF EJS Templates
Remove clear_output timeout callback in favor of fixed height
Jonathan Frederic -
Show More
@@ -289,7 +289,6 b' var IPython = (function (IPython) {'
289 OutputArea.prototype.append_output = function (json, dynamic) {
289 OutputArea.prototype.append_output = function (json, dynamic) {
290 // If dynamic is true, javascript output will be eval'd.
290 // If dynamic is true, javascript output will be eval'd.
291 this.expand();
291 this.expand();
292 this.flush_clear_timeout();
293 if (json.output_type === 'pyout') {
292 if (json.output_type === 'pyout') {
294 this.append_pyout(json, dynamic);
293 this.append_pyout(json, dynamic);
295 } else if (json.output_type === 'pyerr') {
294 } else if (json.output_type === 'pyerr') {
@@ -300,6 +299,7 b' var IPython = (function (IPython) {'
300 this.append_stream(json);
299 this.append_stream(json);
301 }
300 }
302 this.outputs.push(json);
301 this.outputs.push(json);
302 this.element.height('auto');
303 var that = this;
303 var that = this;
304 setTimeout(function(){that.element.trigger('resize');}, 100);
304 setTimeout(function(){that.element.trigger('resize');}, 100);
305 };
305 };
@@ -553,7 +553,6 b' var IPython = (function (IPython) {'
553 OutputArea.prototype.append_raw_input = function (content) {
553 OutputArea.prototype.append_raw_input = function (content) {
554 var that = this;
554 var that = this;
555 this.expand();
555 this.expand();
556 this.flush_clear_timeout();
557 var area = this.create_output_area();
556 var area = this.create_output_area();
558
557
559 // disable any other raw_inputs, if they are left around
558 // disable any other raw_inputs, if they are left around
@@ -611,31 +610,12 b' var IPython = (function (IPython) {'
611
610
612
611
613 OutputArea.prototype.clear_output = function (stdout, stderr, other) {
612 OutputArea.prototype.clear_output = function (stdout, stderr, other) {
614 var that = this;
615 if (this.clear_out_timeout != null){
616 // fire previous pending clear *immediately*
617 clearTimeout(this.clear_out_timeout);
618 this.clear_out_timeout = null;
619 this.clear_output_callback(this._clear_stdout, this._clear_stderr, this._clear_other);
620 }
621 // store flags for flushing the timeout
622 this._clear_stdout = stdout;
623 this._clear_stderr = stderr;
624 this._clear_other = other;
625 this.clear_out_timeout = setTimeout(function() {
626 // really clear timeout only after a short delay
627 // this reduces flicker in 'clear_output; print' cases
628 that.clear_out_timeout = null;
629 that._clear_stdout = that._clear_stderr = that._clear_other = null;
630 that.clear_output_callback(stdout, stderr, other);
631 }, 500
632 );
633 };
634
635
636 OutputArea.prototype.clear_output_callback = function (stdout, stderr, other) {
637 var output_div = this.element;
613 var output_div = this.element;
638
614
615 // Fix the output div's height
616 var height = output_div.height();
617 output_div.height(height);
618
639 if (stdout && stderr && other){
619 if (stdout && stderr && other){
640 // clear all, no need for logic
620 // clear all, no need for logic
641 output_div.html("");
621 output_div.html("");
@@ -674,16 +654,6 b' var IPython = (function (IPython) {'
674 };
654 };
675
655
676
656
677 OutputArea.prototype.flush_clear_timeout = function() {
678 var output_div = this.element;
679 if (this.clear_out_timeout){
680 clearTimeout(this.clear_out_timeout);
681 this.clear_out_timeout = null;
682 this.clear_output_callback(this._clear_stdout, this._clear_stderr, this._clear_other);
683 }
684 };
685
686
687 // JSON serialization
657 // JSON serialization
688
658
689 OutputArea.prototype.fromJSON = function (outputs) {
659 OutputArea.prototype.fromJSON = function (outputs) {
General Comments 0
You need to be logged in to leave comments. Login now