Show More
@@ -0,0 +1,54 b'' | |||||
|
1 | ||||
|
2 | //============================================================================ | |||
|
3 | // Kernel Status widget | |||
|
4 | //============================================================================ | |||
|
5 | ||||
|
6 | var IPython = (function (IPython) { | |||
|
7 | ||||
|
8 | var utils = IPython.utils; | |||
|
9 | ||||
|
10 | var KernelStatusWidget = function (selector) { | |||
|
11 | this.selector = selector; | |||
|
12 | if (this.selector !== undefined) { | |||
|
13 | this.element = $(selector); | |||
|
14 | this.style(); | |||
|
15 | } | |||
|
16 | }; | |||
|
17 | ||||
|
18 | ||||
|
19 | KernelStatusWidget.prototype.style = function () { | |||
|
20 | this.element.addClass('ui-widget'); | |||
|
21 | }; | |||
|
22 | ||||
|
23 | ||||
|
24 | KernelStatusWidget.prototype.status_busy = function () { | |||
|
25 | this.element.removeClass("status_idle"); | |||
|
26 | this.element.removeClass("status_restarting"); | |||
|
27 | this.element.addClass("status_busy"); | |||
|
28 | this.element.text("Busy"); | |||
|
29 | }; | |||
|
30 | ||||
|
31 | ||||
|
32 | KernelStatusWidget.prototype.status_idle = function () { | |||
|
33 | this.element.removeClass("status_busy"); | |||
|
34 | this.element.removeClass("status_restarting"); | |||
|
35 | this.element.addClass("status_idle"); | |||
|
36 | this.element.text("Idle"); | |||
|
37 | }; | |||
|
38 | ||||
|
39 | KernelStatusWidget.prototype.status_restarting = function () { | |||
|
40 | this.element.removeClass("status_busy"); | |||
|
41 | this.element.removeClass("status_idle"); | |||
|
42 | this.element.addClass("status_restarting"); | |||
|
43 | this.element.text("Restarting"); | |||
|
44 | }; | |||
|
45 | ||||
|
46 | ||||
|
47 | ||||
|
48 | ||||
|
49 | IPython.KernelStatusWidget = KernelStatusWidget; | |||
|
50 | ||||
|
51 | return IPython; | |||
|
52 | ||||
|
53 | }(IPython)); | |||
|
54 |
@@ -74,23 +74,39 b' body {' | |||||
74 |
|
74 | |||
75 |
|
75 | |||
76 | div#header { |
|
76 | div#header { | |
77 | height: 35px; |
|
77 | position: relative; | |
|
78 | height: 45px; | |||
78 | padding: 5px; |
|
79 | padding: 5px; | |
79 | margin: 0px; |
|
80 | margin: 0px; | |
80 | width: 100% |
|
81 | width: 100% | |
81 | } |
|
82 | } | |
82 |
|
83 | |||
83 | span#ipython_notebook { |
|
84 | span#ipython_notebook { | |
|
85 | position: absolute; | |||
84 | } |
|
86 | } | |
85 |
|
87 | |||
86 | span#ipython_notebook h1 { |
|
88 | span#ipython_notebook h1 { | |
87 | font-family: Verdana, "Helvetica Neue", Arial, Helvetica, Geneva, sans-serif; |
|
89 | font-family: Verdana, "Helvetica Neue", Arial, Helvetica, Geneva, sans-serif; | |
88 | font-size: 22pt; |
|
90 | font-size: 22pt; | |
|
91 | display: inline; | |||
|
92 | } | |||
|
93 | ||||
|
94 | span#save_widget { | |||
|
95 | position: absolute; | |||
|
96 | left: 0px; | |||
|
97 | padding: 5px 0px; | |||
|
98 | margin: 0px 0px 0px 0px; | |||
|
99 | } | |||
|
100 | ||||
|
101 | input#notebook_name { | |||
|
102 | height: 1em; | |||
|
103 | line-height: 1em; | |||
|
104 | padding: 5px; | |||
89 | } |
|
105 | } | |
90 |
|
106 | |||
91 | span#kernel_status { |
|
107 | span#kernel_status { | |
92 | position: absolute; |
|
108 | position: absolute; | |
93 | top: 12%; |
|
109 | padding: 8px 5px 5px 5px; | |
94 | right: 10px; |
|
110 | right: 10px; | |
95 | font-weight: bold; |
|
111 | font-weight: bold; | |
96 | } |
|
112 | } | |
@@ -129,22 +145,27 b' div.section_content {' | |||||
129 | padding: 5px; |
|
145 | padding: 5px; | |
130 | } |
|
146 | } | |
131 |
|
147 | |||
132 | #expand_cell, #collapse_cell, #insert_cell_above, #insert_cell_below, |
|
148 | /*#expand_cell, #collapse_cell, #insert_cell_above, #insert_cell_below,*/ | |
133 | #move_cell_up, #move_cell_down, #to_code, #to_text, #run_selected_cell, |
|
149 | /*#move_cell_up, #move_cell_down, #to_code, #to_text, #run_selected_cell,*/ | |
134 | #run_all_cells, #int_kernel, #restart_kernel, #python_help, #ipython_help, |
|
150 | /*#run_all_cells, #int_kernel, #restart_kernel, #python_help, #ipython_help,*/ | |
135 |
#numpy_help, #matplotlib_help, #scipy_help, #sympy_help |
|
151 | /*#numpy_help, #matplotlib_help, #scipy_help, #sympy_help, #new_notebook,*/ | |
136 | width: 65px; |
|
152 | /*#open_notebook {*/ | |
|
153 | /* width: 60px;*/ | |||
|
154 | /*}*/ | |||
|
155 | ||||
|
156 | span.section_row_buttons > button { | |||
|
157 | width: 60px; | |||
137 | } |
|
158 | } | |
138 |
|
159 | |||
139 |
. |
|
160 | .section_row { | |
140 | margin: 5px 0px; |
|
161 | margin: 5px 0px; | |
141 | } |
|
162 | } | |
142 |
|
163 | |||
143 |
. |
|
164 | .section_row_buttons { | |
144 | float: right; |
|
165 | float: right; | |
145 | } |
|
166 | } | |
146 |
|
167 | |||
147 |
. |
|
168 | .section_row_header { | |
148 | float: left; |
|
169 | float: left; | |
149 | font-size: 0.8em; |
|
170 | font-size: 0.8em; | |
150 | padding: 0.2em 0em; |
|
171 | padding: 0.2em 0em; | |
@@ -158,7 +179,7 b' span.button_label {' | |||||
158 | } |
|
179 | } | |
159 |
|
180 | |||
160 | /* This is needed because FF was adding a 2px margin top and bottom. */ |
|
181 | /* This is needed because FF was adding a 2px margin top and bottom. */ | |
161 |
. |
|
182 | .section_row .ui-button { | |
162 | margin-top: 0px; |
|
183 | margin-top: 0px; | |
163 | margin-bottom: 0px; |
|
184 | margin-bottom: 0px; | |
164 | } |
|
185 | } |
@@ -73,40 +73,18 b' var IPython = (function (IPython) {' | |||||
73 |
|
73 | |||
74 |
|
74 | |||
75 | Kernel.prototype.restart = function () { |
|
75 | Kernel.prototype.restart = function () { | |
76 |
|
|
76 | IPython.kernel_status_widget.status_restarting(); | |
77 | url = this.kernel_url + "/restart" |
|
77 | url = this.kernel_url + "/restart" | |
78 | var that = this; |
|
78 | var that = this; | |
79 | $.post(url, function (kernel_id) { |
|
79 | $.post(url, function (kernel_id) { | |
80 | console.log("Kernel restarted: " + kernel_id); |
|
80 | console.log("Kernel restarted: " + kernel_id); | |
81 | that.kernel_id = kernel_id; |
|
81 | that.kernel_id = kernel_id; | |
82 | that.kernel_url = that.base_url + "/" + that.kernel_id; |
|
82 | that.kernel_url = that.base_url + "/" + that.kernel_id; | |
83 | that.status_idle(); |
|
83 | IPython.kernel_status_widget.status_idle(); | |
84 | }, 'json'); |
|
84 | }, 'json'); | |
85 | }; |
|
85 | }; | |
86 |
|
86 | |||
87 |
|
87 | |||
88 | Kernel.prototype.status_busy = function () { |
|
|||
89 | $("#kernel_status").removeClass("status_idle"); |
|
|||
90 | $("#kernel_status").removeClass("status_restarting"); |
|
|||
91 | $("#kernel_status").addClass("status_busy"); |
|
|||
92 | $("#kernel_status").text("Busy"); |
|
|||
93 | }; |
|
|||
94 |
|
||||
95 |
|
||||
96 | Kernel.prototype.status_idle = function () { |
|
|||
97 | $("#kernel_status").removeClass("status_busy"); |
|
|||
98 | $("#kernel_status").removeClass("status_restarting"); |
|
|||
99 | $("#kernel_status").addClass("status_idle"); |
|
|||
100 | $("#kernel_status").text("Idle"); |
|
|||
101 | }; |
|
|||
102 |
|
||||
103 | Kernel.prototype.status_restarting = function () { |
|
|||
104 | $("#kernel_status").removeClass("status_busy"); |
|
|||
105 | $("#kernel_status").removeClass("status_idle"); |
|
|||
106 | $("#kernel_status").addClass("status_restarting"); |
|
|||
107 | $("#kernel_status").text("Restarting"); |
|
|||
108 | }; |
|
|||
109 |
|
||||
110 | IPython.Kernel = Kernel; |
|
88 | IPython.Kernel = Kernel; | |
111 |
|
89 | |||
112 | return IPython; |
|
90 | return IPython; |
@@ -28,9 +28,9 b' var IPython = (function (IPython) {' | |||||
28 |
|
28 | |||
29 | $('div#left_panel_splitter').height(app_height); |
|
29 | $('div#left_panel_splitter').height(app_height); | |
30 |
|
30 | |||
|
31 | $('div#notebook_panel').height(app_height); | |||
31 | var left_panel_width = $('div#left_panel').outerWidth(); |
|
32 | var left_panel_width = $('div#left_panel').outerWidth(); | |
32 | var left_panel_splitter_width = $('div#left_panel_splitter').outerWidth(); |
|
33 | var left_panel_splitter_width = $('div#left_panel_splitter').outerWidth(); | |
33 | $('div#notebook_panel').height(app_height); |
|
|||
34 | if (IPython.left_panel.expanded) { |
|
34 | if (IPython.left_panel.expanded) { | |
35 | $('div#notebook_panel').css({marginLeft : left_panel_width+left_panel_splitter_width}); |
|
35 | $('div#notebook_panel').css({marginLeft : left_panel_width+left_panel_splitter_width}); | |
36 | } else { |
|
36 | } else { |
@@ -57,15 +57,10 b' var IPython = (function (IPython) {' | |||||
57 |
|
57 | |||
58 |
|
58 | |||
59 | LeftPanel.prototype.create_children = function () { |
|
59 | LeftPanel.prototype.create_children = function () { | |
60 | this.notebook_section = new IPython.NotebookSection(); |
|
60 | this.notebook_section = new IPython.NotebookSection('div#notebook_section'); | |
61 | this.left_panel_element.append(this.notebook_section.element); |
|
61 | this.cell_section = new IPython.CellSection('div#cell_section'); | |
62 |
this. |
|
62 | this.kernel_section = new IPython.KernelSection('div#kernel_section'); | |
63 | this.left_panel_element.append(this.cell_section.element); |
|
63 | this.help_section = new IPython.HelpSection('div#help_section'); | |
64 | this.kernel_section = new IPython.KernelSection(); |
|
|||
65 | this.left_panel_element.append(this.kernel_section.element); |
|
|||
66 | this.help_section = new IPython.HelpSection(); |
|
|||
67 | this.left_panel_element.append(this.help_section.element); |
|
|||
68 | this.help_section.collapse(); |
|
|||
69 | } |
|
64 | } | |
70 |
|
65 | |||
71 | LeftPanel.prototype.collapse = function () { |
|
66 | LeftPanel.prototype.collapse = function () { |
@@ -474,9 +474,9 b' var IPython = (function (IPython) {' | |||||
474 | cell.append_pyerr(content.ename, content.evalue, content.traceback); |
|
474 | cell.append_pyerr(content.ename, content.evalue, content.traceback); | |
475 | } else if (msg_type === "status") { |
|
475 | } else if (msg_type === "status") { | |
476 | if (content.execution_state === "busy") { |
|
476 | if (content.execution_state === "busy") { | |
477 |
|
|
477 | IPython.kernel_status_widget.status_busy(); | |
478 | } else if (content.execution_state === "idle") { |
|
478 | } else if (content.execution_state === "idle") { | |
479 |
|
|
479 | IPython.kernel_status_widget.status_idle(); | |
480 | }; |
|
480 | }; | |
481 | } |
|
481 | } | |
482 | }; |
|
482 | }; |
@@ -17,14 +17,17 b' $(document).ready(function () {' | |||||
17 | } |
|
17 | } | |
18 | }); |
|
18 | }); | |
19 |
|
19 | |||
|
20 | $('div#header').addClass('border-box-sizing'); | |||
20 | $('div#notebook_app').addClass('border-box-sizing ui-widget ui-widget-content'); |
|
21 | $('div#notebook_app').addClass('border-box-sizing ui-widget ui-widget-content'); | |
21 | $('div#notebook_panel').addClass('border-box-sizing ui-widget'); |
|
22 | $('div#notebook_panel').addClass('border-box-sizing ui-widget'); | |
22 |
|
23 | |||
23 | IPython.layout_manager = new IPython.LayoutManager(); |
|
24 | IPython.layout_manager = new IPython.LayoutManager(); | |
24 | // IPython.save_widget = new IPython.SaveWidget('span#save_widget'); |
|
|||
25 | IPython.pager = new IPython.Pager('div#pager', 'div#pager_splitter'); |
|
25 | IPython.pager = new IPython.Pager('div#pager', 'div#pager_splitter'); | |
26 | IPython.left_panel = new IPython.LeftPanel('div#left_panel', 'div#left_panel_splitter'); |
|
26 | IPython.left_panel = new IPython.LeftPanel('div#left_panel', 'div#left_panel_splitter'); | |
|
27 | IPython.save_widget = new IPython.SaveWidget('span#save_widget'); | |||
27 | IPython.notebook = new IPython.Notebook('div#notebook'); |
|
28 | IPython.notebook = new IPython.Notebook('div#notebook'); | |
|
29 | IPython.kernel_status_widget = new IPython.KernelStatusWidget('#kernel_status'); | |||
|
30 | IPython.kernel_status_widget.status_idle(); | |||
28 |
|
31 | |||
29 | IPython.notebook.insert_code_cell_after(); |
|
32 | IPython.notebook.insert_code_cell_after(); | |
30 | IPython.layout_manager.do_resize(); |
|
33 | IPython.layout_manager.do_resize(); |
@@ -11,7 +11,7 b' var IPython = (function (IPython) {' | |||||
11 | this.pager_element = $(pager_selector); |
|
11 | this.pager_element = $(pager_selector); | |
12 | this.pager_splitter_element = $(pager_splitter_selector); |
|
12 | this.pager_splitter_element = $(pager_splitter_selector); | |
13 | this.expanded = true; |
|
13 | this.expanded = true; | |
14 |
this.percentage_height = 0. |
|
14 | this.percentage_height = 0.40; | |
15 | this.style(); |
|
15 | this.style(); | |
16 | this.bind_events(); |
|
16 | this.bind_events(); | |
17 | }; |
|
17 | }; |
@@ -9,18 +9,25 b' var IPython = (function (IPython) {' | |||||
9 |
|
9 | |||
10 | // Base PanelSection class |
|
10 | // Base PanelSection class | |
11 |
|
11 | |||
12 | var PanelSection = function () { |
|
12 | var PanelSection = function (selector) { | |
13 | if (this.section_name === undefined) { |
|
13 | this.selector = selector; | |
14 | this.section_name = 'section'; |
|
14 | if (this.selector !== undefined) { | |
15 | }; |
|
15 | this.element = $(selector); | |
16 | this.create_element(); |
|
16 | this.header = this.element.find('h3.section_header'); | |
17 | if (this.element !== undefined) { |
|
17 | this.content = this.element.find('div.section_content'); | |
|
18 | this.style(); | |||
18 | this.bind_events(); |
|
19 | this.bind_events(); | |
19 | } |
|
20 | } | |
20 | this.expanded = true; |
|
21 | this.expanded = true; | |
21 | }; |
|
22 | }; | |
22 |
|
23 | |||
23 |
|
24 | |||
|
25 | PanelSection.prototype.style = function () { | |||
|
26 | this.header.addClass('ui-widget ui-state-default'); | |||
|
27 | this.content.addClass('ui-widget section_content'); | |||
|
28 | }; | |||
|
29 | ||||
|
30 | ||||
24 | PanelSection.prototype.bind_events = function () { |
|
31 | PanelSection.prototype.bind_events = function () { | |
25 | var that = this; |
|
32 | var that = this; | |
26 | this.header.click(function () { |
|
33 | this.header.click(function () { | |
@@ -32,27 +39,9 b' var IPython = (function (IPython) {' | |||||
32 | }; |
|
39 | }; | |
33 |
|
40 | |||
34 |
|
41 | |||
35 | PanelSection.prototype.create_element = function () { |
|
|||
36 | this.element = $('<div/>').attr('id',this.id()); |
|
|||
37 | this.header = $('<h3>'+this.section_name+'</h3>'). |
|
|||
38 | addClass('ui-widget ui-state-default section_header'); |
|
|||
39 | this.content = $('<div/>'). |
|
|||
40 | addClass('ui-widget section_content'); |
|
|||
41 | this.element.append(this.header).append(this.content); |
|
|||
42 | this.create_children(); |
|
|||
43 | }; |
|
|||
44 |
|
||||
45 |
|
||||
46 | PanelSection.prototype.id = function () { |
|
|||
47 | return this.section_name.toLowerCase() + "_section"; |
|
|||
48 | }; |
|
|||
49 |
|
||||
50 |
|
||||
51 | PanelSection.prototype.expand = function () { |
|
42 | PanelSection.prototype.expand = function () { | |
52 | if (!this.expanded) { |
|
43 | if (!this.expanded) { | |
53 | this.content.slideDown('fast'); |
|
44 | this.content.slideDown('fast'); | |
54 | // this.header.addClass('ui-state-active'); |
|
|||
55 | // this.header.removeClass('ui-state-default'); |
|
|||
56 | this.expanded = true; |
|
45 | this.expanded = true; | |
57 | }; |
|
46 | }; | |
58 | }; |
|
47 | }; | |
@@ -61,8 +50,6 b' var IPython = (function (IPython) {' | |||||
61 | PanelSection.prototype.collapse = function () { |
|
50 | PanelSection.prototype.collapse = function () { | |
62 | if (this.expanded) { |
|
51 | if (this.expanded) { | |
63 | this.content.slideUp('fast'); |
|
52 | this.content.slideUp('fast'); | |
64 | // this.header.removeClass('ui-state-active'); |
|
|||
65 | // this.header.addClass('ui-state-default'); |
|
|||
66 | this.expanded = false; |
|
53 | this.expanded = false; | |
67 | }; |
|
54 | }; | |
68 | }; |
|
55 | }; | |
@@ -83,7 +70,6 b' var IPython = (function (IPython) {' | |||||
83 | // NotebookSection |
|
70 | // NotebookSection | |
84 |
|
71 | |||
85 | var NotebookSection = function () { |
|
72 | var NotebookSection = function () { | |
86 | this.section_name = "Notebook"; |
|
|||
87 | PanelSection.apply(this, arguments); |
|
73 | PanelSection.apply(this, arguments); | |
88 | }; |
|
74 | }; | |
89 |
|
75 | |||
@@ -91,10 +77,28 b' var IPython = (function (IPython) {' | |||||
91 | NotebookSection.prototype = new PanelSection(); |
|
77 | NotebookSection.prototype = new PanelSection(); | |
92 |
|
78 | |||
93 |
|
79 | |||
|
80 | NotebookSection.prototype.style = function () { | |||
|
81 | PanelSection.prototype.style.apply(this); | |||
|
82 | this.content.addClass('ui-helper-clearfix'); | |||
|
83 | this.content.find('div.section_row').addClass('ui-helper-clearfix'); | |||
|
84 | this.content.find('#new_open').buttonset(); | |||
|
85 | }; | |||
|
86 | ||||
|
87 | ||||
|
88 | NotebookSection.prototype.bind_events = function () { | |||
|
89 | PanelSection.prototype.bind_events.apply(this); | |||
|
90 | this.content.find('#new_notebook').click(function () { | |||
|
91 | alert('Not Implemented'); | |||
|
92 | }); | |||
|
93 | this.content.find('#open_notebook').click(function () { | |||
|
94 | alert('Not Implemented'); | |||
|
95 | }); | |||
|
96 | }; | |||
|
97 | ||||
|
98 | ||||
94 | // CellSection |
|
99 | // CellSection | |
95 |
|
100 | |||
96 | var CellSection = function () { |
|
101 | var CellSection = function () { | |
97 | this.section_name = "Cell"; |
|
|||
98 | PanelSection.apply(this, arguments); |
|
102 | PanelSection.apply(this, arguments); | |
99 | }; |
|
103 | }; | |
100 |
|
104 | |||
@@ -102,6 +106,19 b' var IPython = (function (IPython) {' | |||||
102 | CellSection.prototype = new PanelSection(); |
|
106 | CellSection.prototype = new PanelSection(); | |
103 |
|
107 | |||
104 |
|
108 | |||
|
109 | CellSection.prototype.style = function () { | |||
|
110 | PanelSection.prototype.style.apply(this); | |||
|
111 | this.content.addClass('ui-helper-clearfix'); | |||
|
112 | this.content.find('div.section_row').addClass('ui-helper-clearfix'); | |||
|
113 | this.content.find('#delete_cell').button(); | |||
|
114 | this.content.find('#insert').buttonset(); | |||
|
115 | this.content.find('#move').buttonset(); | |||
|
116 | this.content.find('#cell_type').buttonset(); | |||
|
117 | this.content.find('#toggle_output').buttonset(); | |||
|
118 | this.content.find('#run_cells').buttonset(); | |||
|
119 | }; | |||
|
120 | ||||
|
121 | ||||
105 | CellSection.prototype.bind_events = function () { |
|
122 | CellSection.prototype.bind_events = function () { | |
106 | PanelSection.prototype.bind_events.apply(this); |
|
123 | PanelSection.prototype.bind_events.apply(this); | |
107 | this.content.find('#collapse_cell').click(function () { |
|
124 | this.content.find('#collapse_cell').click(function () { | |
@@ -140,63 +157,9 b' var IPython = (function (IPython) {' | |||||
140 | }; |
|
157 | }; | |
141 |
|
158 | |||
142 |
|
159 | |||
143 | CellSection.prototype.create_children = function () { |
|
|||
144 |
|
||||
145 | this.content.addClass('ui-helper-clearfix'); |
|
|||
146 |
|
||||
147 | var row0 = $('<div>').addClass('cell_section_row ui-helper-clearfix'). |
|
|||
148 | append($('<span/>').addClass('cell_section_row_buttons'). |
|
|||
149 | append($('<button>X</button>').attr('id','delete_cell'))). |
|
|||
150 | append($('<span/>').html('Actions').addClass('cell_section_row_header')); |
|
|||
151 | row0.find('#delete_cell').button(); |
|
|||
152 | this.content.append(row0); |
|
|||
153 |
|
||||
154 | var row1 = $('<div>').addClass('cell_section_row ui-helper-clearfix'). |
|
|||
155 | append($('<span/>').attr('id','insert').addClass('cell_section_row_buttons'). |
|
|||
156 | append( $('<button>Above</button>').attr('id','insert_cell_above') ). |
|
|||
157 | append( $('<button>Below</button>').attr('id','insert_cell_below') )). |
|
|||
158 | append($('<span/>').html('Insert').addClass('button_label')); |
|
|||
159 | row1.find('#insert').buttonset(); |
|
|||
160 | this.content.append(row1); |
|
|||
161 |
|
||||
162 | var row2 = $('<div>').addClass('cell_section_row ui-helper-clearfix'). |
|
|||
163 | append($('<span/>').attr('id','move').addClass('cell_section_row_buttons'). |
|
|||
164 | append( $('<button>Up</button>').attr('id','move_cell_up') ). |
|
|||
165 | append( $('<button>Down</button>').attr('id','move_cell_down') ) ). |
|
|||
166 | append($('<span/>').html('Move').addClass('button_label')); |
|
|||
167 | row2.find('#move').buttonset(); |
|
|||
168 | this.content.append(row2); |
|
|||
169 |
|
||||
170 | var row3 = $('<div>').addClass('cell_section_row ui-helper-clearfix'). |
|
|||
171 | append($('<span/>').attr('id','cell_type').addClass('cell_section_row_buttons'). |
|
|||
172 | append( $('<button>Code</button>').attr('id','to_code') ). |
|
|||
173 | append( $('<button>Text</button>').attr('id','to_text') ) ). |
|
|||
174 | append($('<span/>').html('Cell Type').addClass('button_label')); |
|
|||
175 | row3.find('#cell_type').buttonset(); |
|
|||
176 | this.content.append(row3); |
|
|||
177 |
|
||||
178 | var row1 = $('<div>').addClass('cell_section_row ui-helper-clearfix'). |
|
|||
179 | append($('<span/>').attr('id','toggle_output').addClass('cell_section_row_buttons'). |
|
|||
180 | append( $('<button>Collapse</button>').attr('id','collapse_cell') ). |
|
|||
181 | append( $('<button>Expand</button>').attr('id','expand_cell') ) ). |
|
|||
182 | append($('<span/>').html('Output').addClass('button_label')); |
|
|||
183 | row1.find('#toggle_output').buttonset(); |
|
|||
184 | this.content.append(row1); |
|
|||
185 |
|
||||
186 | var row0 = $('<div>').addClass('cell_section_row'). |
|
|||
187 | append($('<span/>').attr('id','run_cells').addClass('cell_section_row_buttons'). |
|
|||
188 | append( $('<button>Selected</button>').attr('id','run_selected_cell') ). |
|
|||
189 | append( $('<button>All</button>').attr('id','run_all_cells') ) ). |
|
|||
190 | append($('<span/>').html('Run').addClass('button_label')); |
|
|||
191 | row0.find('#run_cells').buttonset(); |
|
|||
192 | this.content.append(row0); |
|
|||
193 | }; |
|
|||
194 |
|
||||
195 |
|
||||
196 | // KernelSection |
|
160 | // KernelSection | |
197 |
|
161 | |||
198 | var KernelSection = function () { |
|
162 | var KernelSection = function () { | |
199 | this.section_name = "Kernel"; |
|
|||
200 | PanelSection.apply(this, arguments); |
|
163 | PanelSection.apply(this, arguments); | |
201 | }; |
|
164 | }; | |
202 |
|
165 | |||
@@ -204,6 +167,14 b' var IPython = (function (IPython) {' | |||||
204 | KernelSection.prototype = new PanelSection(); |
|
167 | KernelSection.prototype = new PanelSection(); | |
205 |
|
168 | |||
206 |
|
169 | |||
|
170 | KernelSection.prototype.style = function () { | |||
|
171 | PanelSection.prototype.style.apply(this); | |||
|
172 | this.content.addClass('ui-helper-clearfix'); | |||
|
173 | this.content.find('div.section_row').addClass('ui-helper-clearfix'); | |||
|
174 | this.content.find('#int_restart').buttonset(); | |||
|
175 | }; | |||
|
176 | ||||
|
177 | ||||
207 | KernelSection.prototype.bind_events = function () { |
|
178 | KernelSection.prototype.bind_events = function () { | |
208 | PanelSection.prototype.bind_events.apply(this); |
|
179 | PanelSection.prototype.bind_events.apply(this); | |
209 | this.content.find('#restart_kernel').click(function () { |
|
180 | this.content.find('#restart_kernel').click(function () { | |
@@ -215,24 +186,9 b' var IPython = (function (IPython) {' | |||||
215 | }; |
|
186 | }; | |
216 |
|
187 | |||
217 |
|
188 | |||
218 | KernelSection.prototype.create_children = function () { |
|
|||
219 |
|
||||
220 | this.content.addClass('ui-helper-clearfix'); |
|
|||
221 |
|
||||
222 | var row0 = $('<div>').addClass('cell_section_row ui-helper-clearfix'). |
|
|||
223 | append($('<span/>').attr('id','int_restart').addClass('cell_section_row_buttons'). |
|
|||
224 | append( $('<button>Interrupt</button>').attr('id','int_kernel') ). |
|
|||
225 | append( $('<button>Restart</button>').attr('id','restart_kernel') )). |
|
|||
226 | append($('<span/>').html('Actions').addClass('cell_section_row_header')); |
|
|||
227 | row0.find('#int_restart').buttonset(); |
|
|||
228 | this.content.append(row0); |
|
|||
229 | }; |
|
|||
230 |
|
||||
231 |
|
||||
232 | // HelpSection |
|
189 | // HelpSection | |
233 |
|
190 | |||
234 | var HelpSection = function () { |
|
191 | var HelpSection = function () { | |
235 | this.section_name = "Help"; |
|
|||
236 | PanelSection.apply(this, arguments); |
|
192 | PanelSection.apply(this, arguments); | |
237 | }; |
|
193 | }; | |
238 |
|
194 | |||
@@ -240,38 +196,22 b' var IPython = (function (IPython) {' | |||||
240 | HelpSection.prototype = new PanelSection(); |
|
196 | HelpSection.prototype = new PanelSection(); | |
241 |
|
197 | |||
242 |
|
198 | |||
243 |
HelpSection.prototype. |
|
199 | HelpSection.prototype.style = function () { | |
244 |
PanelSection.prototype. |
|
200 | PanelSection.prototype.style.apply(this); | |
|
201 | PanelSection.prototype.style.apply(this); | |||
|
202 | this.content.addClass('ui-helper-clearfix'); | |||
|
203 | this.content.find('div.section_row').addClass('ui-helper-clearfix'); | |||
|
204 | this.content.find('#help_buttons0').buttonset(); | |||
|
205 | this.content.find('#help_buttons1').buttonset(); | |||
245 | }; |
|
206 | }; | |
246 |
|
207 | |||
247 |
|
208 | |||
248 |
HelpSection.prototype. |
|
209 | HelpSection.prototype.bind_events = function () { | |
|
210 | PanelSection.prototype.bind_events.apply(this); | |||
|
211 | }; | |||
249 |
|
212 | |||
250 | this.content.addClass('ui-helper-clearfix'); |
|
|||
251 |
|
213 | |||
252 | var row0 = $('<div>').addClass('cell_section_row ui-helper-clearfix'). |
|
214 | // Set module variables | |
253 | append($('<span/>').attr('id','help_buttons0').addClass('cell_section_row_buttons'). |
|
|||
254 | append( $('<button/>').attr('id','python_help'). |
|
|||
255 | append( $('<a>Python</a>').attr('href','http://docs.python.org').attr('target','_blank') )). |
|
|||
256 | append( $('<button/>').attr('id','ipython_help'). |
|
|||
257 | append( $('<a>IPython</a>').attr('href','http://ipython.org/documentation.html').attr('target','_blank') )). |
|
|||
258 | append( $('<button/>').attr('id','numpy_help'). |
|
|||
259 | append( $('<a>NumPy</a>').attr('href','http://docs.scipy.org/doc/numpy/reference/').attr('target','_blank') ))). |
|
|||
260 | append($('<span/>').html('Links').addClass('cell_section_row_header')); |
|
|||
261 | row0.find('#help_buttons0').buttonset(); |
|
|||
262 | this.content.append(row0); |
|
|||
263 |
|
||||
264 | var row1 = $('<div>').addClass('cell_section_row ui-helper-clearfix'). |
|
|||
265 | append($('<span/>').attr('id','help_buttons1').addClass('cell_section_row_buttons'). |
|
|||
266 | append( $('<button/>').attr('id','matplotlib_help'). |
|
|||
267 | append( $('<a>MPL</a>').attr('href','http://matplotlib.sourceforge.net/').attr('target','_blank') )). |
|
|||
268 | append( $('<button/>').attr('id','scipy_help'). |
|
|||
269 | append( $('<a>SciPy</a>').attr('href','http://docs.scipy.org/doc/scipy/reference/').attr('target','_blank') )). |
|
|||
270 | append( $('<button/>').attr('id','sympy_help'). |
|
|||
271 | append( $('<a>SymPy</a>').attr('href','http://docs.sympy.org/dev/index.html').attr('target','_blank') ))); |
|
|||
272 | row1.find('#help_buttons1').buttonset(); |
|
|||
273 | this.content.append(row1); |
|
|||
274 | }; |
|
|||
275 |
|
215 | |||
276 | IPython.PanelSection = PanelSection; |
|
216 | IPython.PanelSection = PanelSection; | |
277 | IPython.NotebookSection = NotebookSection; |
|
217 | IPython.NotebookSection = NotebookSection; |
@@ -8,26 +8,41 b' var IPython = (function (IPython) {' | |||||
8 | var utils = IPython.utils; |
|
8 | var utils = IPython.utils; | |
9 |
|
9 | |||
10 | var SaveWidget = function (selector) { |
|
10 | var SaveWidget = function (selector) { | |
11 |
this. |
|
11 | this.selector = selector; | |
12 | this.create_element(); |
|
12 | if (this.selector !== undefined) { | |
13 |
|
|
13 | this.element = $(selector); | |
14 |
this. |
|
14 | this.style(); | |
15 | this.bind_events(); |
|
15 | this.bind_events(); | |
16 | } |
|
16 | } | |
17 | }; |
|
17 | }; | |
18 |
|
18 | |||
19 |
|
19 | |||
|
20 | SaveWidget.prototype.style = function () { | |||
|
21 | this.element.find('input#notebook_name').addClass('ui-widget ui-widget-content'); | |||
|
22 | this.element.find('button#save_notebook').button(); | |||
|
23 | var left_panel_width = $('div#left_panel').outerWidth(); | |||
|
24 | var left_panel_splitter_width = $('div#left_panel_splitter').outerWidth(); | |||
|
25 | $('span#save_widget').css({marginLeft:left_panel_width+left_panel_splitter_width}); | |||
|
26 | }; | |||
|
27 | ||||
|
28 | ||||
20 | SaveWidget.prototype.bind_events = function () { |
|
29 | SaveWidget.prototype.bind_events = function () { | |
21 | var that = this; |
|
30 | var that = this; | |
|
31 | this.element.find('button#save_notebook').click(function () { | |||
|
32 | IPython.notebook.save_notebook(that.get_notebook_name()); | |||
|
33 | }); | |||
22 | }; |
|
34 | }; | |
23 |
|
35 | |||
24 |
|
36 | |||
25 | // Subclasses must implement create_element. |
|
37 | SaveWidget.prototype.get_notebook_name = function () { | |
26 | SaveWidget.prototype.create_element = function () { |
|
38 | return this.element.find('input#notebook_name').attr('value'); | |
27 | this.element. |
|
39 | } | |
28 | append($('textarea')). |
|
40 | ||
29 | append($('<button>Save</button>').button()); |
|
41 | ||
30 | }; |
|
42 | SaveWidget.prototype.set_notebook_name = function (name) { | |
|
43 | this.element.find('input#notebook_name').attr('value',name); | |||
|
44 | } | |||
|
45 | ||||
31 |
|
46 | |||
32 | IPython.SaveWidget = SaveWidget; |
|
47 | IPython.SaveWidget = SaveWidget; | |
33 |
|
48 |
@@ -31,12 +31,112 b'' | |||||
31 |
|
31 | |||
32 | <div id="header"> |
|
32 | <div id="header"> | |
33 | <span id="ipython_notebook"><h1>IPython Notebook</h1></span> |
|
33 | <span id="ipython_notebook"><h1>IPython Notebook</h1></span> | |
34 |
<span id="save_widget"> |
|
34 | <span id="save_widget"> | |
|
35 | <input type="text" id="notebook_name" size="20"></textarea> | |||
|
36 | <button id="save_notebook">Save</button> | |||
|
37 | </span> | |||
|
38 | <span id="kernel_status">Idle</span> | |||
35 | </div> |
|
39 | </div> | |
36 |
|
40 | |||
37 | <div id="notebook_app"> |
|
41 | <div id="notebook_app"> | |
38 |
|
42 | |||
39 |
<div id="left_panel"> |
|
43 | <div id="left_panel"> | |
|
44 | ||||
|
45 | <div id="notebook_section"> | |||
|
46 | <h3 class="section_header">Notebook</h3> | |||
|
47 | <div class="section_content"> | |||
|
48 | <div class="section_row"> | |||
|
49 | <span id="new_open" class="section_row_buttons"> | |||
|
50 | <button id="new_notebook">New</button> | |||
|
51 | <button id="open_notebook">Open</button> | |||
|
52 | </span> | |||
|
53 | <span class="section_row_header">Actions</span> | |||
|
54 | </div> | |||
|
55 | </div> | |||
|
56 | </div> | |||
|
57 | ||||
|
58 | <div id="cell_section"> | |||
|
59 | <h3 class="section_header">Cell</h3> | |||
|
60 | <div class="section_content"> | |||
|
61 | <div class="section_row"> | |||
|
62 | <span class="section_row_buttons"> | |||
|
63 | <button id="delete_cell">Delete</button> | |||
|
64 | </span> | |||
|
65 | <span class="section_row_header">Actions</span> | |||
|
66 | </div> | |||
|
67 | <div class="section_row"> | |||
|
68 | <span id="insert" class="section_row_buttons"> | |||
|
69 | <button id="insert_cell_above">Above</button> | |||
|
70 | <button id="insert_cell_below">Below</button> | |||
|
71 | </span> | |||
|
72 | <span class="button_label">Insert</span> | |||
|
73 | </div> | |||
|
74 | <div class="section_row"> | |||
|
75 | <span id="move" class="section_row_buttons"> | |||
|
76 | <button id="move_cell_up">Up</button> | |||
|
77 | <button id="move_cell_down">Down</button> | |||
|
78 | </span> | |||
|
79 | <span class="button_label">Move</span> | |||
|
80 | </div> | |||
|
81 | <div class="section_row"> | |||
|
82 | <span id="cell_type" class="section_row_buttons"> | |||
|
83 | <button id="to_code">Code</button> | |||
|
84 | <button id="to_text">Text</button> | |||
|
85 | </span> | |||
|
86 | <span class="button_label">Cell Type</span> | |||
|
87 | </div> | |||
|
88 | <div class="section_row"> | |||
|
89 | <span id="toggle_output" class="section_row_buttons"> | |||
|
90 | <button id="collapse_cell">Collapse</button> | |||
|
91 | <button id="expand_cell">Expand</button> | |||
|
92 | </span> | |||
|
93 | <span class="button_label">Output</span> | |||
|
94 | </div> | |||
|
95 | <div class="section_row"> | |||
|
96 | <span id="run_cells" class="section_row_buttons"> | |||
|
97 | <button id="run_selected_cell">Selected</button> | |||
|
98 | <button id="run_all_cells">All</button> | |||
|
99 | </span> | |||
|
100 | <span class="button_label">Run</span> | |||
|
101 | </div> | |||
|
102 | </div> | |||
|
103 | </div> | |||
|
104 | ||||
|
105 | <div id="kernel_section"> | |||
|
106 | <h3 class="section_header">Kernel</h3> | |||
|
107 | <div class="section_content"> | |||
|
108 | <div class="section_row"> | |||
|
109 | <span id="int_restart" class="section_row_buttons"> | |||
|
110 | <button id="int_kernel">Interrupt</button> | |||
|
111 | <button id="restart_kernel">Restart</button> | |||
|
112 | </span> | |||
|
113 | <span class="section_row_header">Actions</span> | |||
|
114 | </div> | |||
|
115 | </div> | |||
|
116 | </div> | |||
|
117 | ||||
|
118 | <div id="help_section"> | |||
|
119 | <h3 class="section_header">Help</h3> | |||
|
120 | <div class="section_content"> | |||
|
121 | <div class="section_row"> | |||
|
122 | <span id="help_buttons0" class="section_row_buttons"> | |||
|
123 | <button id="python_help"><a href="http://docs.python.org" target="_blank">Python</a></button> | |||
|
124 | <button id="ipython_help"><a href="http://ipython.org/documentation.html" target="_blank">IPython</a></button> | |||
|
125 | <button id="numpy_help"><a href="http://docs.scipy.org/doc/numpy/reference/" target="_blank">NumPy</a></button> | |||
|
126 | </span> | |||
|
127 | <span class="section_row_header">Links</span> | |||
|
128 | </div> | |||
|
129 | <div class="section_row"> | |||
|
130 | <span id="help_buttons1" class="section_row_buttons"> | |||
|
131 | <button id="matplotlib_help"><a href="http://matplotlib.sourceforge.net/" target="_blank">MPL</a></button> | |||
|
132 | <button id="scipy_help"><a href="http://docs.scipy.org/doc/scipy/reference/" target="_blank">SciPy</a></button> | |||
|
133 | <button id="sympy_help"><a href="http://docs.sympy.org/dev/index.html" target="_blank">SymPy</a></button> | |||
|
134 | </span> | |||
|
135 | </div> | |||
|
136 | </div> | |||
|
137 | </div> | |||
|
138 | ||||
|
139 | </div> | |||
40 | <div id="left_panel_splitter"></div> |
|
140 | <div id="left_panel_splitter"></div> | |
41 | <div id="notebook_panel"> |
|
141 | <div id="notebook_panel"> | |
42 | <div id="notebook"></div> |
|
142 | <div id="notebook"></div> | |
@@ -55,6 +155,7 b'' | |||||
55 | <script src="static/js/codecell.js" type="text/javascript" charset="utf-8"></script> |
|
155 | <script src="static/js/codecell.js" type="text/javascript" charset="utf-8"></script> | |
56 | <script src="static/js/textcell.js" type="text/javascript" charset="utf-8"></script> |
|
156 | <script src="static/js/textcell.js" type="text/javascript" charset="utf-8"></script> | |
57 | <script src="static/js/kernel.js" type="text/javascript" charset="utf-8"></script> |
|
157 | <script src="static/js/kernel.js" type="text/javascript" charset="utf-8"></script> | |
|
158 | <script src="static/js/kernelstatus.js" type="text/javascript" charset="utf-8"></script> | |||
58 | <script src="static/js/layout.js" type="text/javascript" charset="utf-8"></script> |
|
159 | <script src="static/js/layout.js" type="text/javascript" charset="utf-8"></script> | |
59 | <script src="static/js/savewidget.js" type="text/javascript" charset="utf-8"></script> |
|
160 | <script src="static/js/savewidget.js" type="text/javascript" charset="utf-8"></script> | |
60 | <script src="static/js/pager.js" type="text/javascript" charset="utf-8"></script> |
|
161 | <script src="static/js/pager.js" type="text/javascript" charset="utf-8"></script> |
General Comments 0
You need to be logged in to leave comments.
Login now