Show More
@@ -85,6 +85,25 b' div#toolbar {' | |||
|
85 | 85 | padding: 5px; |
|
86 | 86 | } |
|
87 | 87 | |
|
88 | span#kernel_status { | |
|
89 | position: absolute; | |
|
90 | top: 12%; | |
|
91 | right: 10px; | |
|
92 | font-weight: bold; | |
|
93 | } | |
|
94 | ||
|
95 | .status_idle { | |
|
96 | color: gray; | |
|
97 | } | |
|
98 | ||
|
99 | .status_busy { | |
|
100 | color: red; | |
|
101 | } | |
|
102 | ||
|
103 | .status_restarting { | |
|
104 | color: black; | |
|
105 | } | |
|
106 | ||
|
88 | 107 | div.notebook { |
|
89 | 108 | width: 790px; |
|
90 | 109 | height: 650px; /*We might have to detect window height for this*/ |
@@ -102,7 +102,7 b' var Notebook = function (selector) {' | |||
|
102 | 102 | Notebook.prototype.bind_events = function () { |
|
103 | 103 | var that = this; |
|
104 | 104 | $(document).keydown(function (event) { |
|
105 | console.log(event); | |
|
105 | // console.log(event); | |
|
106 | 106 | if (event.which == 38 && event.shiftKey) { |
|
107 | 107 | event.preventDefault(); |
|
108 | 108 | that.select_prev(); |
@@ -458,6 +458,12 b' Notebook.prototype._kernel_started = function () {' | |||
|
458 | 458 | } else if (msg_type === "pyout" || msg_type === "display_data") { |
|
459 | 459 | cell.expand(); |
|
460 | 460 | cell.append_display_data(reply.content.data); |
|
461 | } else if (msg_type === "status") { | |
|
462 | if (reply.content.execution_state === "busy") { | |
|
463 | that.kernel.status_busy(); | |
|
464 | } else if (reply.content.execution_state === "idle") { | |
|
465 | that.kernel.status_idle(); | |
|
466 | }; | |
|
461 | 467 | }; |
|
462 | 468 | }; |
|
463 | 469 | }; |
@@ -769,16 +775,40 b' Kernel.prototype.interrupt = function () {' | |||
|
769 | 775 | |
|
770 | 776 | |
|
771 | 777 | Kernel.prototype.restart = function () { |
|
778 | this.status_restarting(); | |
|
772 | 779 | url = this.kernel_url + "/restart" |
|
773 | 780 | var that = this; |
|
774 | 781 | $.post(url, function (kernel_id) { |
|
775 | 782 | console.log("Kernel restarted: " + kernel_id); |
|
776 | 783 | that.kernel_id = kernel_id; |
|
777 | 784 | that.kernel_url = that.base_url + "/" + that.kernel_id; |
|
785 | that.status_idle(); | |
|
778 | 786 | }, 'json'); |
|
779 | 787 | }; |
|
780 | 788 | |
|
781 | 789 | |
|
790 | Kernel.prototype.status_busy = function () { | |
|
791 | $("#kernel_status").removeClass("status_idle"); | |
|
792 | $("#kernel_status").removeClass("status_restarting"); | |
|
793 | $("#kernel_status").addClass("status_busy"); | |
|
794 | $("#kernel_status").text("Busy"); | |
|
795 | }; | |
|
796 | ||
|
797 | ||
|
798 | Kernel.prototype.status_idle = function () { | |
|
799 | $("#kernel_status").removeClass("status_busy"); | |
|
800 | $("#kernel_status").removeClass("status_restarting"); | |
|
801 | $("#kernel_status").addClass("status_idle"); | |
|
802 | $("#kernel_status").text("Idle"); | |
|
803 | }; | |
|
804 | ||
|
805 | Kernel.prototype.status_restarting = function () { | |
|
806 | $("#kernel_status").removeClass("status_busy"); | |
|
807 | $("#kernel_status").removeClass("status_idle"); | |
|
808 | $("#kernel_status").addClass("status_restarting"); | |
|
809 | $("#kernel_status").text("Restarting"); | |
|
810 | }; | |
|
811 | ||
|
782 | 812 | //============================================================================ |
|
783 | 813 | // On document ready |
|
784 | 814 | //============================================================================ |
@@ -803,6 +833,7 b' $(document).ready(function () {' | |||
|
803 | 833 | $("#kernel_toolbar").buttonset(); |
|
804 | 834 | $("#interrupt_kernel").click(function () {IPYTHON.notebook.kernel.interrupt();}); |
|
805 | 835 | $("#restart_kernel").click(function () {IPYTHON.notebook.kernel.restart();}); |
|
836 | $("#kernel_status").addClass("status_idle"); | |
|
806 | 837 | |
|
807 | 838 | $("#move_cell").buttonset(); |
|
808 | 839 | $("#move_up").button("option", "icons", {primary:"ui-icon-arrowthick-1-n"}); |
General Comments 0
You need to be logged in to leave comments.
Login now