Show More
@@ -60,6 +60,10 span#kernel_status { | |||||
60 | padding: 0px; |
|
60 | padding: 0px; | |
61 | } |
|
61 | } | |
62 |
|
62 | |||
|
63 | .wijmo-wijmenu .wijmo-wijmenu-parent .wijmo-wijmenu-child { | |||
|
64 | width: 225px; | |||
|
65 | } | |||
|
66 | ||||
63 | #kernel_persist { |
|
67 | #kernel_persist { | |
64 | float: right; |
|
68 | float: right; | |
65 | } |
|
69 | } | |
@@ -347,7 +351,7 p.dialog { | |||||
347 |
|
351 | |||
348 | .shortcut_key { |
|
352 | .shortcut_key { | |
349 | display: inline-block; |
|
353 | display: inline-block; | |
350 |
width: 1 |
|
354 | width: 15ex; | |
351 | text-align: right; |
|
355 | text-align: right; | |
352 | font-family: monospace; |
|
356 | font-family: monospace; | |
353 | } |
|
357 | } |
@@ -26,6 +26,21 var IPython = (function (IPython) { | |||||
26 | $('ul#menus').wijmenu("option", "showDelay", 200); |
|
26 | $('ul#menus').wijmenu("option", "showDelay", 200); | |
27 | $('ul#menus').wijmenu("option", "hideDelay", 200); |
|
27 | $('ul#menus').wijmenu("option", "hideDelay", 200); | |
28 | $(".selector").wijmenu("option", "animation", {animated:"fade", duration: 200, easing: null}) |
|
28 | $(".selector").wijmenu("option", "animation", {animated:"fade", duration: 200, easing: null}) | |
|
29 | // Close all menus when a menu item is clicked. This is needed when | |||
|
30 | // menu shortcuts are used as they have a slightly different structure | |||
|
31 | // in the DOM. | |||
|
32 | $(".wijmo-wijmenu-text").parent().bind("click", function () { | |||
|
33 | $('ul#menus').wijmenu("hideAllMenus"); | |||
|
34 | console.log('I am closing you!'); | |||
|
35 | }); | |||
|
36 | // Make sure we hover over menu items correctly. This is needed when | |||
|
37 | // menu shortcuts are used as they have a slightly different structure | |||
|
38 | // in the DOM. | |||
|
39 | $(".wijmo-wijmenu-link").hover(function () { | |||
|
40 | $(this).addClass("ui-state-hover"); | |||
|
41 | }, function () { | |||
|
42 | $(this).removeClass("ui-state-hover"); | |||
|
43 | }); | |||
29 | }; |
|
44 | }; | |
30 |
|
45 | |||
31 |
|
46 | |||
@@ -65,6 +80,12 var IPython = (function (IPython) { | |||||
65 | this.element.find('#move_cell_down').click(function () { |
|
80 | this.element.find('#move_cell_down').click(function () { | |
66 | IPython.notebook.move_cell_down(); |
|
81 | IPython.notebook.move_cell_down(); | |
67 | }); |
|
82 | }); | |
|
83 | this.element.find('#select_previous').click(function () { | |||
|
84 | IPython.notebook.select_prev(); | |||
|
85 | }); | |||
|
86 | this.element.find('#select_next').click(function () { | |||
|
87 | IPython.notebook.select_next(); | |||
|
88 | }); | |||
68 | // Insert |
|
89 | // Insert | |
69 | this.element.find('#insert_cell_above').click(function () { |
|
90 | this.element.find('#insert_cell_above').click(function () { | |
70 | IPython.notebook.insert_code_cell_above(); |
|
91 | IPython.notebook.insert_code_cell_above(); | |
@@ -101,6 +122,10 var IPython = (function (IPython) { | |||||
101 | this.element.find('#restart_kernel').click(function () { |
|
122 | this.element.find('#restart_kernel').click(function () { | |
102 | IPython.notebook.restart_kernel(); |
|
123 | IPython.notebook.restart_kernel(); | |
103 | }); |
|
124 | }); | |
|
125 | // Help | |||
|
126 | this.element.find('#keyboard_shortcuts').click(function () { | |||
|
127 | IPython.quick_help.show_keyboard_shortcuts(); | |||
|
128 | }); | |||
104 | }; |
|
129 | }; | |
105 |
|
130 | |||
106 |
|
131 |
@@ -213,50 +213,6 var IPython = (function (IPython) { | |||||
213 | }; |
|
213 | }; | |
214 |
|
214 | |||
215 |
|
215 | |||
216 | Notebook.prototype.toggle_keyboard_shortcuts = function () { |
|
|||
217 | // toggles display of keyboard shortcut dialog |
|
|||
218 | var that = this; |
|
|||
219 | if ( this.shortcut_dialog ){ |
|
|||
220 | // if dialog is already shown, close it |
|
|||
221 | this.shortcut_dialog.dialog("close"); |
|
|||
222 | this.shortcut_dialog = null; |
|
|||
223 | return; |
|
|||
224 | } |
|
|||
225 | var dialog = $('<div/>'); |
|
|||
226 | this.shortcut_dialog = dialog; |
|
|||
227 | var shortcuts = [ |
|
|||
228 | {key: 'Shift-Enter', help: 'run cell'}, |
|
|||
229 | {key: 'Ctrl-Enter', help: 'run cell in-place'}, |
|
|||
230 | {key: 'Ctrl-m d', help: 'delete cell'}, |
|
|||
231 | {key: 'Ctrl-m a', help: 'insert cell above'}, |
|
|||
232 | {key: 'Ctrl-m b', help: 'insert cell below'}, |
|
|||
233 | {key: 'Ctrl-m t', help: 'toggle output'}, |
|
|||
234 | {key: 'Ctrl-m l', help: 'toggle line numbers'}, |
|
|||
235 | {key: 'Ctrl-m s', help: 'save notebook'}, |
|
|||
236 | {key: 'Ctrl-m j', help: 'move cell down'}, |
|
|||
237 | {key: 'Ctrl-m k', help: 'move cell up'}, |
|
|||
238 | {key: 'Ctrl-m c', help: 'code cell'}, |
|
|||
239 | {key: 'Ctrl-m m', help: 'markdown cell'}, |
|
|||
240 | {key: 'Ctrl-m p', help: 'select previous'}, |
|
|||
241 | {key: 'Ctrl-m n', help: 'select next'}, |
|
|||
242 | {key: 'Ctrl-m i', help: 'interrupt kernel'}, |
|
|||
243 | {key: 'Ctrl-m .', help: 'restart kernel'}, |
|
|||
244 | {key: 'Ctrl-m h', help: 'show keyboard shortcuts'} |
|
|||
245 | ]; |
|
|||
246 | for (var i=0; i<shortcuts.length; i++) { |
|
|||
247 | dialog.append($('<div>'). |
|
|||
248 | append($('<span/>').addClass('shortcut_key').html(shortcuts[i].key)). |
|
|||
249 | append($('<span/>').addClass('shortcut_descr').html(' : ' + shortcuts[i].help)) |
|
|||
250 | ); |
|
|||
251 | }; |
|
|||
252 | dialog.bind('dialogclose', function(event) { |
|
|||
253 | // dialog has been closed, allow it to be drawn again. |
|
|||
254 | that.shortcut_dialog = null; |
|
|||
255 | }); |
|
|||
256 | dialog.dialog({title: 'Keyboard shortcuts'}); |
|
|||
257 | }; |
|
|||
258 |
|
||||
259 |
|
||||
260 | Notebook.prototype.scroll_to_bottom = function () { |
|
216 | Notebook.prototype.scroll_to_bottom = function () { | |
261 | this.element.animate({scrollTop:this.element.get(0).scrollHeight}, 0); |
|
217 | this.element.animate({scrollTop:this.element.get(0).scrollHeight}, 0); | |
262 | }; |
|
218 | }; | |
@@ -691,6 +647,7 var IPython = (function (IPython) { | |||||
691 | resizable: false, |
|
647 | resizable: false, | |
692 | modal: true, |
|
648 | modal: true, | |
693 | title: "Restart kernel or continue running?", |
|
649 | title: "Restart kernel or continue running?", | |
|
650 | closeText: '', | |||
694 | buttons : { |
|
651 | buttons : { | |
695 | "Restart": function () { |
|
652 | "Restart": function () { | |
696 | that.kernel.restart($.proxy(that.kernel_started, that)); |
|
653 | that.kernel.restart($.proxy(that.kernel_started, that)); |
@@ -12,24 +12,49 | |||||
12 | var IPython = (function (IPython) { |
|
12 | var IPython = (function (IPython) { | |
13 |
|
13 | |||
14 | var QuickHelp = function (selector) { |
|
14 | var QuickHelp = function (selector) { | |
15 | this.selector = selector; |
|
|||
16 | if (this.selector !== undefined) { |
|
|||
17 | this.element = $(selector); |
|
|||
18 | this.style(); |
|
|||
19 | this.bind_events(); |
|
|||
20 | } |
|
|||
21 | }; |
|
|||
22 |
|
||||
23 | QuickHelp.prototype.style = function () { |
|
|||
24 | this.element.find('button#quick_help').button(); |
|
|||
25 | this.element.find('button#quick_help').attr('title', "Show/Hide the keyboard shortcuts for the IPython Notebook"); |
|
|||
26 | }; |
|
15 | }; | |
27 |
|
16 | |||
28 |
QuickHelp.prototype. |
|
17 | QuickHelp.prototype.show_keyboard_shortcuts = function () { | |
|
18 | // toggles display of keyboard shortcut dialog | |||
29 | var that = this; |
|
19 | var that = this; | |
30 | this.element.find("button#quick_help").click(function () { |
|
20 | if ( this.shortcut_dialog ){ | |
31 | IPython.notebook.toggle_keyboard_shortcuts(); |
|
21 | // if dialog is already shown, close it | |
|
22 | this.shortcut_dialog.dialog("close"); | |||
|
23 | this.shortcut_dialog = null; | |||
|
24 | return; | |||
|
25 | } | |||
|
26 | var dialog = $('<div/>'); | |||
|
27 | this.shortcut_dialog = dialog; | |||
|
28 | var shortcuts = [ | |||
|
29 | {key: 'Shift-Enter', help: 'run cell'}, | |||
|
30 | {key: 'Ctrl-Enter', help: 'run cell in-place'}, | |||
|
31 | {key: 'Ctrl-m d', help: 'delete cell'}, | |||
|
32 | {key: 'Ctrl-m a', help: 'insert cell above'}, | |||
|
33 | {key: 'Ctrl-m b', help: 'insert cell below'}, | |||
|
34 | {key: 'Ctrl-m t', help: 'toggle output'}, | |||
|
35 | {key: 'Ctrl-m l', help: 'toggle line numbers'}, | |||
|
36 | {key: 'Ctrl-m s', help: 'save notebook'}, | |||
|
37 | {key: 'Ctrl-m j', help: 'move cell down'}, | |||
|
38 | {key: 'Ctrl-m k', help: 'move cell up'}, | |||
|
39 | {key: 'Ctrl-m c', help: 'code cell'}, | |||
|
40 | {key: 'Ctrl-m m', help: 'markdown cell'}, | |||
|
41 | {key: 'Ctrl-m p', help: 'select previous'}, | |||
|
42 | {key: 'Ctrl-m n', help: 'select next'}, | |||
|
43 | {key: 'Ctrl-m i', help: 'interrupt kernel'}, | |||
|
44 | {key: 'Ctrl-m .', help: 'restart kernel'}, | |||
|
45 | {key: 'Ctrl-m h', help: 'show keyboard shortcuts'} | |||
|
46 | ]; | |||
|
47 | for (var i=0; i<shortcuts.length; i++) { | |||
|
48 | dialog.append($('<div>'). | |||
|
49 | append($('<span/>').addClass('shortcut_key').html(shortcuts[i].key)). | |||
|
50 | append($('<span/>').addClass('shortcut_descr').html(' : ' + shortcuts[i].help)) | |||
|
51 | ); | |||
|
52 | }; | |||
|
53 | dialog.bind('dialogclose', function(event) { | |||
|
54 | // dialog has been closed, allow it to be drawn again. | |||
|
55 | that.shortcut_dialog = null; | |||
32 | }); |
|
56 | }); | |
|
57 | dialog.dialog({title: 'Keyboard shortcuts', closeText: ''}); | |||
33 | }; |
|
58 | }; | |
34 |
|
59 | |||
35 | // Set module variables |
|
60 | // Set module variables |
@@ -48,9 +48,6 | |||||
48 | <input type="text" id="notebook_name" size="20"></textarea> |
|
48 | <input type="text" id="notebook_name" size="20"></textarea> | |
49 | <button id="save_notebook"><u>S</u>ave</button> |
|
49 | <button id="save_notebook"><u>S</u>ave</button> | |
50 | </span> |
|
50 | </span> | |
51 | <span id="quick_help_area"> |
|
|||
52 | <button id="quick_help">Quick<u>H</u>elp</button> |
|
|||
53 | </span> |
|
|||
54 |
|
51 | |||
55 | <span id="login_widget"> |
|
52 | <span id="login_widget"> | |
56 | {% comment This is a temporary workaround to hide the logout button %} |
|
53 | {% comment This is a temporary workaround to hide the logout button %} | |
@@ -69,10 +66,15 | |||||
69 | <ul id="menus"> |
|
66 | <ul id="menus"> | |
70 | <li><a href="#">File</a> |
|
67 | <li><a href="#">File</a> | |
71 | <ul> |
|
68 | <ul> | |
72 |
<li id="new_notebook"><a |
|
69 | <li id="new_notebook"><span class="wijmo-wijmenu-text">New</span></li> | |
73 |
<li id="open_notebook"><a |
|
70 | <li id="open_notebook"><span class="wijmo-wijmenu-text">Open</span></li> | |
74 | <li></li> |
|
71 | <li></li> | |
75 |
<li id="save_notebook"> |
|
72 | <li id="save_notebook"> | |
|
73 | <div> | |||
|
74 | <span class="wijmo-wijmenu-text">Save</span> | |||
|
75 | <span class="wijmo-wijmenu-icon-right">Ctrl+m s</span> | |||
|
76 | </div> | |||
|
77 | </li> | |||
76 | <li></li> |
|
78 | <li></li> | |
77 | <li><a href="#">Download as</a> |
|
79 | <li><a href="#">Download as</a> | |
78 | <ul> |
|
80 | <ul> | |
@@ -82,48 +84,124 | |||||
82 | </li> |
|
84 | </li> | |
83 | <li></li> |
|
85 | <li></li> | |
84 | <li id="print_notebook"><a href="#">Print</a></li> |
|
86 | <li id="print_notebook"><a href="#">Print</a></li> | |
85 |
|
||||
86 | </ul> |
|
87 | </ul> | |
87 | </li> |
|
88 | </li> | |
88 | <li><a href="#">Edit</a> |
|
89 | <li><a href="#">Edit</a> | |
89 | <ul> |
|
90 | <ul> | |
90 |
<li id="delete_cell"> |
|
91 | <li id="delete_cell"> | |
|
92 | <div> | |||
|
93 | <span class="wijmo-wijmenu-text">Delete</span> | |||
|
94 | <span class="wijmo-wijmenu-icon-right">Ctrl+m d</span> | |||
|
95 | </div> | |||
|
96 | </li> | |||
91 | <li></li> |
|
97 | <li></li> | |
92 |
<li id="move_cell_up"> |
|
98 | <li id="move_cell_up"> | |
93 | <li id="move_cell_down"><a href="#">Move Cell Down</a></li> |
|
99 | <div> | |
|
100 | <span class="wijmo-wijmenu-text">Move Cell Up</span> | |||
|
101 | <span class="wijmo-wijmenu-icon-right">Ctrl+m k</span> | |||
|
102 | </div> | |||
|
103 | </li> | |||
|
104 | <li id="move_cell_down"> | |||
|
105 | <div> | |||
|
106 | <span class="wijmo-wijmenu-text">Move Cell Down</span> | |||
|
107 | <span class="wijmo-wijmenu-icon-right">Ctrl+m j</span> | |||
|
108 | </div> | |||
|
109 | </li> | |||
|
110 | <li></li> | |||
|
111 | <li id="select_previous"> | |||
|
112 | <div> | |||
|
113 | <span class="wijmo-wijmenu-text">Select Previous</span> | |||
|
114 | <span class="wijmo-wijmenu-icon-right">Ctrl+m p</span> | |||
|
115 | </div> | |||
|
116 | </li> | |||
|
117 | <li id="select_next"> | |||
|
118 | <div> | |||
|
119 | <span class="wijmo-wijmenu-text">Select Next</span> | |||
|
120 | <span class="wijmo-wijmenu-icon-right">Ctrl+m n</span> | |||
|
121 | </div> | |||
|
122 | </li> | |||
94 | </ul> |
|
123 | </ul> | |
95 | </li> |
|
124 | </li> | |
96 | <li><a href="#">Insert</a> |
|
125 | <li><a href="#">Insert</a> | |
97 | <ul> |
|
126 | <ul> | |
98 |
<li id="insert_cell_above"> |
|
127 | <li id="insert_cell_above"> | |
99 | <li id="insert_cell_below"><a href="#">Insert Cell Below</a> |
|
128 | <div> | |
|
129 | <span class="wijmo-wijmenu-text">Insert Cell Above</span> | |||
|
130 | <span class="wijmo-wijmenu-icon-right">Ctrl+m a</span> | |||
|
131 | </div> | |||
|
132 | </li> | |||
|
133 | <li id="insert_cell_below"> | |||
|
134 | <div> | |||
|
135 | <span class="wijmo-wijmenu-text">Insert Cell Below</span> | |||
|
136 | <span class="wijmo-wijmenu-icon-right">Ctrl+m b</span> | |||
|
137 | </div> | |||
100 | </li> |
|
138 | </li> | |
101 | </ul> |
|
139 | </ul> | |
102 | </li> |
|
140 | </li> | |
103 | <li><a href="#">Cell</a> |
|
141 | <li><a href="#">Cell</a> | |
104 | <ul> |
|
142 | <ul> | |
105 |
<li id="run_cell"> |
|
143 | <li id="run_cell"> | |
106 | <li id="run_cell_in_place"><a href="#">Run in Place</a></li> |
|
144 | <div> | |
|
145 | <span class="wijmo-wijmenu-text">Run</span> | |||
|
146 | <span class="wijmo-wijmenu-icon-right">Shift+Enter</span> | |||
|
147 | </div> | |||
|
148 | </li> | |||
|
149 | <li id="run_cell_in_place"> | |||
|
150 | <div> | |||
|
151 | <span class="wijmo-wijmenu-text">Run in Place</span> | |||
|
152 | <span class="wijmo-wijmenu-icon-right">Ctrl+Enter</span> | |||
|
153 | </div> | |||
|
154 | </li> | |||
107 | <li id="run_all_cells"><a href="#">Run All</a></li> |
|
155 | <li id="run_all_cells"><a href="#">Run All</a></li> | |
108 | <li></li> |
|
156 | <li></li> | |
109 |
<li id="to_code"> |
|
157 | <li id="to_code"> | |
110 | <li id="to_markdown"><a href="#">Markdown Cell</a></li> |
|
158 | <div> | |
|
159 | <span class="wijmo-wijmenu-text">Code Cell</span> | |||
|
160 | <span class="wijmo-wijmenu-icon-right">Ctrl+m c</span> | |||
|
161 | </div> | |||
|
162 | </li> | |||
|
163 | <li id="to_markdown"> | |||
|
164 | <div> | |||
|
165 | <span class="wijmo-wijmenu-text">Markdown Cell</span> | |||
|
166 | <span class="wijmo-wijmenu-icon-right">Ctrl+m s</span> | |||
|
167 | </div> | |||
|
168 | </li> | |||
111 | <li></li> |
|
169 | <li></li> | |
112 |
<li id="toggle_output"> |
|
170 | <li id="toggle_output"> | |
|
171 | <div> | |||
|
172 | <span class="wijmo-wijmenu-text">Toggle Output</span> | |||
|
173 | <span class="wijmo-wijmenu-icon-right">Ctrl+m t</span> | |||
|
174 | </div> | |||
|
175 | </li> | |||
113 | <li id="clear_all_output"><a href="#">Clear All Output</a></li> |
|
176 | <li id="clear_all_output"><a href="#">Clear All Output</a></li> | |
114 | </ul> |
|
177 | </ul> | |
115 | </li> |
|
178 | </li> | |
116 | <li><a href="#">Kernel</a> |
|
179 | <li><a href="#">Kernel</a> | |
117 | <ul> |
|
180 | <ul> | |
118 |
<li id="int_kernel"> |
|
181 | <li id="int_kernel"> | |
119 | <li id="restart_kernel"><a href="#">Restart</a></li> |
|
182 | <div> | |
|
183 | <span class="wijmo-wijmenu-text">Interrupt</span> | |||
|
184 | <span class="wijmo-wijmenu-icon-right">Ctrl+m i</span> | |||
|
185 | </div> | |||
|
186 | </li> | |||
|
187 | <li id="restart_kernel"> | |||
|
188 | <div> | |||
|
189 | <span class="wijmo-wijmenu-text">Restart</span> | |||
|
190 | <span class="wijmo-wijmenu-icon-right">Ctrl+m s</span> | |||
|
191 | </div> | |||
|
192 | </li> | |||
120 | </ul> |
|
193 | </ul> | |
121 | </li> |
|
194 | </li> | |
122 | <li><a href="#">Help</a> |
|
195 | <li><a href="#">Help</a> | |
123 | <ul> |
|
196 | <ul> | |
124 | <li><a href="http://ipython.org/documentation.html" target="_blank">IPython Help</a></li> |
|
197 | <li><a href="http://ipython.org/documentation.html" target="_blank">IPython Help</a></li> | |
125 | <li><a href="http://ipython.org/ipython-doc/stable/interactive/htmlnotebook.html" target="_blank">Notebook Help</a></li> |
|
198 | <li><a href="http://ipython.org/ipython-doc/stable/interactive/htmlnotebook.html" target="_blank">Notebook Help</a></li> | |
126 | <li><a href="#">Notebook QuickRef</a></li> |
|
199 | <li id="keyboard_shortcuts"> | |
|
200 | <div> | |||
|
201 | <span class="wijmo-wijmenu-text">Keyboard Shortcuts</span> | |||
|
202 | <span class="wijmo-wijmenu-icon-right">Ctrl+m h</span> | |||
|
203 | </div> | |||
|
204 | </li> | |||
127 | <li><h2>External Docs</h2></li> |
|
205 | <li><h2>External Docs</h2></li> | |
128 | <li><a href="http://docs.python.org" target="_blank">Python</a></li> |
|
206 | <li><a href="http://docs.python.org" target="_blank">Python</a></li> | |
129 | <li><a href="http://docs.scipy.org/doc/numpy/reference/" target="_blank">NumPy</a></li> |
|
207 | <li><a href="http://docs.scipy.org/doc/numpy/reference/" target="_blank">NumPy</a></li> |
General Comments 0
You need to be logged in to leave comments.
Login now