##// END OF EJS Templates
fix tooltip location...
Min RK -
Show More
@@ -1,321 +1,324 b''
1 // Copyright (c) IPython Development Team.
1 // Copyright (c) IPython Development Team.
2 // Distributed under the terms of the Modified BSD License.
2 // Distributed under the terms of the Modified BSD License.
3
3
4 define([
4 define([
5 'base/js/namespace',
5 'base/js/namespace',
6 'jquery',
6 'jquery',
7 'base/js/utils',
7 'base/js/utils',
8 ], function(IPython, $, utils) {
8 ], function(IPython, $, utils) {
9 "use strict";
9 "use strict";
10
10
11 // tooltip constructor
11 // tooltip constructor
12 var Tooltip = function (events) {
12 var Tooltip = function (events) {
13 var that = this;
13 var that = this;
14 this.events = events;
14 this.events = events;
15 this.time_before_tooltip = 1200;
15 this.time_before_tooltip = 1200;
16
16
17 // handle to html
17 // handle to html
18 this.tooltip = $('#tooltip');
18 this.tooltip = $('#tooltip');
19 this._hidden = true;
19 this._hidden = true;
20
20
21 // variable for consecutive call
21 // variable for consecutive call
22 this._old_cell = null;
22 this._old_cell = null;
23 this._old_request = null;
23 this._old_request = null;
24 this._consecutive_counter = 0;
24 this._consecutive_counter = 0;
25
25
26 // 'sticky ?'
26 // 'sticky ?'
27 this._sticky = false;
27 this._sticky = false;
28
28
29 // display tooltip if the docstring is empty?
29 // display tooltip if the docstring is empty?
30 this._hide_if_no_docstring = false;
30 this._hide_if_no_docstring = false;
31
31
32 // contain the button in the upper right corner
32 // contain the button in the upper right corner
33 this.buttons = $('<div/>').addClass('tooltipbuttons');
33 this.buttons = $('<div/>').addClass('tooltipbuttons');
34
34
35 // will contain the docstring
35 // will contain the docstring
36 this.text = $('<div/>').addClass('tooltiptext').addClass('smalltooltip');
36 this.text = $('<div/>').addClass('tooltiptext').addClass('smalltooltip');
37
37
38 // build the buttons menu on the upper right
38 // build the buttons menu on the upper right
39 // expand the tooltip to see more
39 // expand the tooltip to see more
40 var expandlink = $('<a/>').attr('href', "#").addClass("ui-corner-all") //rounded corner
40 var expandlink = $('<a/>').attr('href', "#").addClass("ui-corner-all") //rounded corner
41 .attr('role', "button").attr('id', 'expanbutton').attr('title', 'Grow the tooltip vertically (press shift-tab twice)').click(function () {
41 .attr('role', "button").attr('id', 'expanbutton').attr('title', 'Grow the tooltip vertically (press shift-tab twice)').click(function () {
42 that.expand();
42 that.expand();
43 event.preventDefault();
43 event.preventDefault();
44 }).append(
44 }).append(
45 $('<span/>').text('Expand').addClass('ui-icon').addClass('ui-icon-plus'));
45 $('<span/>').text('Expand').addClass('ui-icon').addClass('ui-icon-plus'));
46
46
47 // open in pager
47 // open in pager
48 var morelink = $('<a/>').attr('href', "#").attr('role', "button").addClass('ui-button').attr('title', 'show the current docstring in pager (press shift-tab 4 times)');
48 var morelink = $('<a/>').attr('href', "#").attr('role', "button").addClass('ui-button').attr('title', 'show the current docstring in pager (press shift-tab 4 times)');
49 var morespan = $('<span/>').text('Open in Pager').addClass('ui-icon').addClass('ui-icon-arrowstop-l-n');
49 var morespan = $('<span/>').text('Open in Pager').addClass('ui-icon').addClass('ui-icon-arrowstop-l-n');
50 morelink.append(morespan);
50 morelink.append(morespan);
51 morelink.click(function () {
51 morelink.click(function () {
52 that.showInPager(that._old_cell);
52 that.showInPager(that._old_cell);
53 event.preventDefault();
53 event.preventDefault();
54 });
54 });
55
55
56 // close the tooltip
56 // close the tooltip
57 var closelink = $('<a/>').attr('href', "#").attr('role', "button").addClass('ui-button');
57 var closelink = $('<a/>').attr('href', "#").attr('role', "button").addClass('ui-button');
58 var closespan = $('<span/>').text('Close').addClass('ui-icon').addClass('ui-icon-close');
58 var closespan = $('<span/>').text('Close').addClass('ui-icon').addClass('ui-icon-close');
59 closelink.append(closespan);
59 closelink.append(closespan);
60 closelink.click(function () {
60 closelink.click(function () {
61 that.remove_and_cancel_tooltip(true);
61 that.remove_and_cancel_tooltip(true);
62 event.preventDefault();
62 event.preventDefault();
63 });
63 });
64
64
65 this._clocklink = $('<a/>').attr('href', "#");
65 this._clocklink = $('<a/>').attr('href', "#");
66 this._clocklink.attr('role', "button");
66 this._clocklink.attr('role', "button");
67 this._clocklink.addClass('ui-button');
67 this._clocklink.addClass('ui-button');
68 this._clocklink.attr('title', 'Tootip is not dismissed while typing for 10 seconds');
68 this._clocklink.attr('title', 'Tootip is not dismissed while typing for 10 seconds');
69 var clockspan = $('<span/>').text('Close');
69 var clockspan = $('<span/>').text('Close');
70 clockspan.addClass('ui-icon');
70 clockspan.addClass('ui-icon');
71 clockspan.addClass('ui-icon-clock');
71 clockspan.addClass('ui-icon-clock');
72 this._clocklink.append(clockspan);
72 this._clocklink.append(clockspan);
73 this._clocklink.click(function () {
73 this._clocklink.click(function () {
74 that.cancel_stick();
74 that.cancel_stick();
75 event.preventDefault();
75 event.preventDefault();
76 });
76 });
77
77
78
78
79
79
80
80
81 //construct the tooltip
81 //construct the tooltip
82 // add in the reverse order you want them to appear
82 // add in the reverse order you want them to appear
83 this.buttons.append(closelink);
83 this.buttons.append(closelink);
84 this.buttons.append(expandlink);
84 this.buttons.append(expandlink);
85 this.buttons.append(morelink);
85 this.buttons.append(morelink);
86 this.buttons.append(this._clocklink);
86 this.buttons.append(this._clocklink);
87 this._clocklink.hide();
87 this._clocklink.hide();
88
88
89
89
90 // we need a phony element to make the small arrow
90 // we need a phony element to make the small arrow
91 // of the tooltip in css
91 // of the tooltip in css
92 // we will move the arrow later
92 // we will move the arrow later
93 this.arrow = $('<div/>').addClass('pretooltiparrow');
93 this.arrow = $('<div/>').addClass('pretooltiparrow');
94 this.tooltip.append(this.buttons);
94 this.tooltip.append(this.buttons);
95 this.tooltip.append(this.arrow);
95 this.tooltip.append(this.arrow);
96 this.tooltip.append(this.text);
96 this.tooltip.append(this.text);
97
97
98 // function that will be called if you press tab 1, 2, 3... times in a row
98 // function that will be called if you press tab 1, 2, 3... times in a row
99 this.tabs_functions = [function (cell, text, cursor) {
99 this.tabs_functions = [function (cell, text, cursor) {
100 that._request_tooltip(cell, text, cursor);
100 that._request_tooltip(cell, text, cursor);
101 }, function () {
101 }, function () {
102 that.expand();
102 that.expand();
103 }, function () {
103 }, function () {
104 that.stick();
104 that.stick();
105 }, function (cell) {
105 }, function (cell) {
106 that.cancel_stick();
106 that.cancel_stick();
107 that.showInPager(cell);
107 that.showInPager(cell);
108 }];
108 }];
109 // call after all the tabs function above have bee call to clean their effects
109 // call after all the tabs function above have bee call to clean their effects
110 // if necessary
110 // if necessary
111 this.reset_tabs_function = function (cell, text) {
111 this.reset_tabs_function = function (cell, text) {
112 this._old_cell = (cell) ? cell : null;
112 this._old_cell = (cell) ? cell : null;
113 this._old_request = (text) ? text : null;
113 this._old_request = (text) ? text : null;
114 this._consecutive_counter = 0;
114 this._consecutive_counter = 0;
115 };
115 };
116 };
116 };
117
117
118 Tooltip.prototype.is_visible = function () {
118 Tooltip.prototype.is_visible = function () {
119 return !this._hidden;
119 return !this._hidden;
120 };
120 };
121
121
122 Tooltip.prototype.showInPager = function (cell) {
122 Tooltip.prototype.showInPager = function (cell) {
123 /**
123 /**
124 * reexecute last call in pager by appending ? to show back in pager
124 * reexecute last call in pager by appending ? to show back in pager
125 */
125 */
126 this.events.trigger('open_with_text.Pager', this._reply.content);
126 this.events.trigger('open_with_text.Pager', this._reply.content);
127 this.remove_and_cancel_tooltip();
127 this.remove_and_cancel_tooltip();
128 };
128 };
129
129
130 // grow the tooltip verticaly
130 // grow the tooltip verticaly
131 Tooltip.prototype.expand = function () {
131 Tooltip.prototype.expand = function () {
132 this.text.removeClass('smalltooltip');
132 this.text.removeClass('smalltooltip');
133 this.text.addClass('bigtooltip');
133 this.text.addClass('bigtooltip');
134 $('#expanbutton').hide('slow');
134 $('#expanbutton').hide('slow');
135 };
135 };
136
136
137 // deal with all the logic of hiding the tooltip
137 // deal with all the logic of hiding the tooltip
138 // and reset it's status
138 // and reset it's status
139 Tooltip.prototype._hide = function () {
139 Tooltip.prototype._hide = function () {
140 this._hidden = true;
140 this._hidden = true;
141 this.tooltip.fadeOut('fast');
141 this.tooltip.fadeOut('fast');
142 $('#expanbutton').show('slow');
142 $('#expanbutton').show('slow');
143 this.text.removeClass('bigtooltip');
143 this.text.removeClass('bigtooltip');
144 this.text.addClass('smalltooltip');
144 this.text.addClass('smalltooltip');
145 // keep scroll top to be sure to always see the first line
145 // keep scroll top to be sure to always see the first line
146 this.text.scrollTop(0);
146 this.text.scrollTop(0);
147 this.code_mirror = null;
147 this.code_mirror = null;
148 };
148 };
149
149
150 // return true on successfully removing a visible tooltip; otherwise return
150 // return true on successfully removing a visible tooltip; otherwise return
151 // false.
151 // false.
152 Tooltip.prototype.remove_and_cancel_tooltip = function (force) {
152 Tooltip.prototype.remove_and_cancel_tooltip = function (force) {
153 /**
153 /**
154 * note that we don't handle closing directly inside the calltip
154 * note that we don't handle closing directly inside the calltip
155 * as in the completer, because it is not focusable, so won't
155 * as in the completer, because it is not focusable, so won't
156 * get the event.
156 * get the event.
157 */
157 */
158 this.cancel_pending();
158 this.cancel_pending();
159 if (!this._hidden) {
159 if (!this._hidden) {
160 if (force || !this._sticky) {
160 if (force || !this._sticky) {
161 this.cancel_stick();
161 this.cancel_stick();
162 this._hide();
162 this._hide();
163 }
163 }
164 this.reset_tabs_function();
164 this.reset_tabs_function();
165 return true;
165 return true;
166 } else {
166 } else {
167 return false;
167 return false;
168 }
168 }
169 };
169 };
170
170
171 // cancel autocall done after '(' for example.
171 // cancel autocall done after '(' for example.
172 Tooltip.prototype.cancel_pending = function () {
172 Tooltip.prototype.cancel_pending = function () {
173 if (this._tooltip_timeout !== null) {
173 if (this._tooltip_timeout !== null) {
174 clearTimeout(this._tooltip_timeout);
174 clearTimeout(this._tooltip_timeout);
175 this._tooltip_timeout = null;
175 this._tooltip_timeout = null;
176 }
176 }
177 };
177 };
178
178
179 // will trigger tooltip after timeout
179 // will trigger tooltip after timeout
180 Tooltip.prototype.pending = function (cell, hide_if_no_docstring) {
180 Tooltip.prototype.pending = function (cell, hide_if_no_docstring) {
181 var that = this;
181 var that = this;
182 this._tooltip_timeout = setTimeout(function () {
182 this._tooltip_timeout = setTimeout(function () {
183 that.request(cell, hide_if_no_docstring);
183 that.request(cell, hide_if_no_docstring);
184 }, that.time_before_tooltip);
184 }, that.time_before_tooltip);
185 };
185 };
186
186
187 // easy access for julia monkey patching.
187 // easy access for julia monkey patching.
188 Tooltip.last_token_re = /[a-z_][0-9a-z._]*$/gi;
188 Tooltip.last_token_re = /[a-z_][0-9a-z._]*$/gi;
189
189
190 Tooltip.prototype._request_tooltip = function (cell, text, cursor_pos) {
190 Tooltip.prototype._request_tooltip = function (cell, text, cursor_pos) {
191 var callbacks = $.proxy(this._show, this);
191 var callbacks = $.proxy(this._show, this);
192 var msg_id = cell.kernel.inspect(text, cursor_pos, callbacks);
192 var msg_id = cell.kernel.inspect(text, cursor_pos, callbacks);
193 };
193 };
194
194
195 // make an immediate completion request
195 // make an immediate completion request
196 Tooltip.prototype.request = function (cell, hide_if_no_docstring) {
196 Tooltip.prototype.request = function (cell, hide_if_no_docstring) {
197 /**
197 /**
198 * request(codecell)
198 * request(codecell)
199 * Deal with extracting the text from the cell and counting
199 * Deal with extracting the text from the cell and counting
200 * call in a row
200 * call in a row
201 */
201 */
202 this.cancel_pending();
202 this.cancel_pending();
203 var editor = cell.code_mirror;
203 var editor = cell.code_mirror;
204 var cursor = editor.getCursor();
204 var cursor = editor.getCursor();
205 var cursor_pos = utils.to_absolute_cursor_pos(editor, cursor);
205 var cursor_pos = utils.to_absolute_cursor_pos(editor, cursor);
206 var text = cell.get_text();
206 var text = cell.get_text();
207
207
208 this._hide_if_no_docstring = hide_if_no_docstring;
208 this._hide_if_no_docstring = hide_if_no_docstring;
209
209
210 if(editor.somethingSelected()){
210 if(editor.somethingSelected()){
211 // get only the most recent selection.
211 // get only the most recent selection.
212 text = editor.getSelection();
212 text = editor.getSelection();
213 }
213 }
214
214
215 // need a permanent handle to code_mirror for future auto recall
215 // need a permanent handle to code_mirror for future auto recall
216 this.code_mirror = editor;
216 this.code_mirror = editor;
217
217
218 // now we treat the different number of keypress
218 // now we treat the different number of keypress
219 // first if same cell, same text, increment counter by 1
219 // first if same cell, same text, increment counter by 1
220 if (this._old_cell == cell && this._old_request == text && this._hidden === false) {
220 if (this._old_cell == cell && this._old_request == text && this._hidden === false) {
221 this._consecutive_counter++;
221 this._consecutive_counter++;
222 } else {
222 } else {
223 // else reset
223 // else reset
224 this.cancel_stick();
224 this.cancel_stick();
225 this.reset_tabs_function (cell, text);
225 this.reset_tabs_function (cell, text);
226 }
226 }
227
227
228 this.tabs_functions[this._consecutive_counter](cell, text, cursor_pos);
228 this.tabs_functions[this._consecutive_counter](cell, text, cursor_pos);
229
229
230 // then if we are at the end of list function, reset
230 // then if we are at the end of list function, reset
231 if (this._consecutive_counter == this.tabs_functions.length) {
231 if (this._consecutive_counter == this.tabs_functions.length) {
232 this.reset_tabs_function (cell, text, cursor);
232 this.reset_tabs_function (cell, text, cursor);
233 }
233 }
234
234
235 return;
235 return;
236 };
236 };
237
237
238 // cancel the option of having the tooltip to stick
238 // cancel the option of having the tooltip to stick
239 Tooltip.prototype.cancel_stick = function () {
239 Tooltip.prototype.cancel_stick = function () {
240 clearTimeout(this._stick_timeout);
240 clearTimeout(this._stick_timeout);
241 this._stick_timeout = null;
241 this._stick_timeout = null;
242 this._clocklink.hide('slow');
242 this._clocklink.hide('slow');
243 this._sticky = false;
243 this._sticky = false;
244 };
244 };
245
245
246 // put the tooltip in a sicky state for 10 seconds
246 // put the tooltip in a sicky state for 10 seconds
247 // it won't be removed by remove_and_cancell() unless you called with
247 // it won't be removed by remove_and_cancell() unless you called with
248 // the first parameter set to true.
248 // the first parameter set to true.
249 // remove_and_cancell_tooltip(true)
249 // remove_and_cancell_tooltip(true)
250 Tooltip.prototype.stick = function (time) {
250 Tooltip.prototype.stick = function (time) {
251 time = (time !== undefined) ? time : 10;
251 time = (time !== undefined) ? time : 10;
252 var that = this;
252 var that = this;
253 this._sticky = true;
253 this._sticky = true;
254 this._clocklink.show('slow');
254 this._clocklink.show('slow');
255 this._stick_timeout = setTimeout(function () {
255 this._stick_timeout = setTimeout(function () {
256 that._sticky = false;
256 that._sticky = false;
257 that._clocklink.hide('slow');
257 that._clocklink.hide('slow');
258 }, time * 1000);
258 }, time * 1000);
259 };
259 };
260
260
261 // should be called with the kernel reply to actually show the tooltip
261 // should be called with the kernel reply to actually show the tooltip
262 Tooltip.prototype._show = function (reply) {
262 Tooltip.prototype._show = function (reply) {
263 /**
263 /**
264 * move the bubble if it is not hidden
264 * move the bubble if it is not hidden
265 * otherwise fade it
265 * otherwise fade it
266 */
266 */
267 this._reply = reply;
267 this._reply = reply;
268 var content = reply.content;
268 var content = reply.content;
269 if (!content.found) {
269 if (!content.found) {
270 // object not found, nothing to show
270 // object not found, nothing to show
271 return;
271 return;
272 }
272 }
273 this.name = content.name;
273 this.name = content.name;
274
274
275 // do some math to have the tooltip arrow on more or less on left or right
275 // do some math to have the tooltip arrow on more or less on left or right
276 // width of the editor
276 // width of the editor
277 var w = $(this.code_mirror.getScrollerElement()).width();
277 var w = $(this.code_mirror.getScrollerElement()).width();
278 // ofset of the editor
278 // ofset of the editor
279 var o = $(this.code_mirror.getScrollerElement()).offset();
279 var o = $(this.code_mirror.getScrollerElement()).offset();
280
280
281 // whatever anchor/head order but arrow at mid x selection
281 // whatever anchor/head order but arrow at mid x selection
282 var anchor = this.code_mirror.cursorCoords(false);
282 var anchor = this.code_mirror.cursorCoords(false);
283 var head = this.code_mirror.cursorCoords(true);
283 var head = this.code_mirror.cursorCoords(true);
284 var xinit = (head.left+anchor.left)/2;
284 var xinit = (head.left+anchor.left)/2;
285 var xinter = o.left + (xinit - o.left) / w * (w - 450);
285 var xinter = o.left + (xinit - o.left) / w * (w - 450);
286 var posarrowleft = xinit - xinter;
286 var posarrowleft = xinit - xinter;
287
288 var left = xinter - 30 + 'px';
289 var top = (head.bottom + 10 - $("#header").height()) + 'px';
287
290
288 if (this._hidden === false) {
291 if (this._hidden === false) {
289 this.tooltip.animate({
292 this.tooltip.animate({
290 'left': xinter - 30 + 'px',
293 left: left,
291 'top': (head.bottom + 10) + 'px'
294 top: top
292 });
295 });
293 } else {
296 } else {
294 this.tooltip.css({
297 this.tooltip.css({
295 'left': xinter - 30 + 'px'
298 left: left
296 });
299 });
297 this.tooltip.css({
300 this.tooltip.css({
298 'top': (head.bottom + 10) + 'px'
301 top: top
299 });
302 });
300 }
303 }
301 this.arrow.animate({
304 this.arrow.animate({
302 'left': posarrowleft + 'px'
305 'left': posarrowleft + 'px'
303 });
306 });
304
307
305 this._hidden = false;
308 this._hidden = false;
306 this.tooltip.fadeIn('fast');
309 this.tooltip.fadeIn('fast');
307 this.text.children().remove();
310 this.text.children().remove();
308
311
309 // This should support rich data types, but only text/plain for now
312 // This should support rich data types, but only text/plain for now
310 // Any HTML within the docstring is escaped by the fixConsole() method.
313 // Any HTML within the docstring is escaped by the fixConsole() method.
311 var pre = $('<pre/>').html(utils.fixConsole(content.data['text/plain']));
314 var pre = $('<pre/>').html(utils.fixConsole(content.data['text/plain']));
312 this.text.append(pre);
315 this.text.append(pre);
313 // keep scroll top to be sure to always see the first line
316 // keep scroll top to be sure to always see the first line
314 this.text.scrollTop(0);
317 this.text.scrollTop(0);
315 };
318 };
316
319
317 // Backwards compatibility.
320 // Backwards compatibility.
318 IPython.Tooltip = Tooltip;
321 IPython.Tooltip = Tooltip;
319
322
320 return {'Tooltip': Tooltip};
323 return {'Tooltip': Tooltip};
321 });
324 });
@@ -1,321 +1,321 b''
1 {% extends "page.html" %}
1 {% extends "page.html" %}
2
2
3 {% block stylesheet %}
3 {% block stylesheet %}
4
4
5 {% if mathjax_url %}
5 {% if mathjax_url %}
6 <script type="text/javascript" src="{{mathjax_url}}?config=TeX-AMS_HTML-full&delayStartupUntil=configured" charset="utf-8"></script>
6 <script type="text/javascript" src="{{mathjax_url}}?config=TeX-AMS_HTML-full&delayStartupUntil=configured" charset="utf-8"></script>
7 {% endif %}
7 {% endif %}
8 <script type="text/javascript">
8 <script type="text/javascript">
9 // MathJax disabled, set as null to distingish from *missing* MathJax,
9 // MathJax disabled, set as null to distingish from *missing* MathJax,
10 // where it will be undefined, and should prompt a dialog later.
10 // where it will be undefined, and should prompt a dialog later.
11 window.mathjax_url = "{{mathjax_url}}";
11 window.mathjax_url = "{{mathjax_url}}";
12 </script>
12 </script>
13
13
14 <link rel="stylesheet" href="{{ static_url("components/bootstrap-tour/build/css/bootstrap-tour.min.css") }}" type="text/css" />
14 <link rel="stylesheet" href="{{ static_url("components/bootstrap-tour/build/css/bootstrap-tour.min.css") }}" type="text/css" />
15 <link rel="stylesheet" href="{{ static_url("components/codemirror/lib/codemirror.css") }}">
15 <link rel="stylesheet" href="{{ static_url("components/codemirror/lib/codemirror.css") }}">
16
16
17 {{super()}}
17 {{super()}}
18
18
19 <link rel="stylesheet" href="{{ static_url("notebook/css/override.css") }}" type="text/css" />
19 <link rel="stylesheet" href="{{ static_url("notebook/css/override.css") }}" type="text/css" />
20 <link rel="stylesheet" href="" id='kernel-css' type="text/css" />
20 <link rel="stylesheet" href="" id='kernel-css' type="text/css" />
21
21
22 {% endblock %}
22 {% endblock %}
23
23
24 {% block bodyclasses %}notebook_app {{super()}}{% endblock %}
24 {% block bodyclasses %}notebook_app {{super()}}{% endblock %}
25
25
26 {% block params %}
26 {% block params %}
27
27
28 data-project="{{project}}"
28 data-project="{{project}}"
29 data-base-url="{{base_url}}"
29 data-base-url="{{base_url}}"
30 data-ws-url="{{ws_url}}"
30 data-ws-url="{{ws_url}}"
31 data-notebook-name="{{notebook_name}}"
31 data-notebook-name="{{notebook_name}}"
32 data-notebook-path="{{notebook_path}}"
32 data-notebook-path="{{notebook_path}}"
33
33
34 {% endblock %}
34 {% endblock %}
35
35
36
36
37 {% block headercontainer %}
37 {% block headercontainer %}
38
38
39
39
40 <span id="save_widget" class="pull-left save_widget">
40 <span id="save_widget" class="pull-left save_widget">
41 <span id="notebook_name" class="filename"></span>
41 <span id="notebook_name" class="filename"></span>
42 <span class="checkpoint_status"></span>
42 <span class="checkpoint_status"></span>
43 <span class="autosave_status"></span>
43 <span class="autosave_status"></span>
44 </span>
44 </span>
45
45
46 <span id="kernel_logo_widget">
46 <span id="kernel_logo_widget">
47 <img class="current_kernel_logo" src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"/>
47 <img class="current_kernel_logo" src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"/>
48 </span>
48 </span>
49
49
50 {% endblock headercontainer %}
50 {% endblock headercontainer %}
51
51
52 {% block header %}
52 {% block header %}
53 <div id="menubar-container" class="container">
53 <div id="menubar-container" class="container">
54 <div id="menubar">
54 <div id="menubar">
55 <div id="menus" class="navbar navbar-default" role="navigation">
55 <div id="menus" class="navbar navbar-default" role="navigation">
56 <div class="container-fluid">
56 <div class="container-fluid">
57 <button type="button" class="btn btn-default navbar-btn navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
57 <button type="button" class="btn btn-default navbar-btn navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
58 <i class="fa fa-bars"></i>
58 <i class="fa fa-bars"></i>
59 <span class="navbar-text">Menu</span>
59 <span class="navbar-text">Menu</span>
60 </button>
60 </button>
61 <p id="kernel_indicator" class="navbar-text indicator_area">
61 <p id="kernel_indicator" class="navbar-text indicator_area">
62 <span class="kernel_indicator_name">Kernel</span>
62 <span class="kernel_indicator_name">Kernel</span>
63 <i id="kernel_indicator_icon"></i>
63 <i id="kernel_indicator_icon"></i>
64 </p>
64 </p>
65 <i id="modal_indicator" class="navbar-text"></i>
65 <i id="modal_indicator" class="navbar-text"></i>
66 <span id="notification_area"></span>
66 <span id="notification_area"></span>
67 <div class="navbar-collapse collapse">
67 <div class="navbar-collapse collapse">
68 <ul class="nav navbar-nav">
68 <ul class="nav navbar-nav">
69 <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">File</a>
69 <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">File</a>
70 <ul id="file_menu" class="dropdown-menu">
70 <ul id="file_menu" class="dropdown-menu">
71 <li id="new_notebook" class="dropdown-submenu">
71 <li id="new_notebook" class="dropdown-submenu">
72 <a href="#">New Notebook</a>
72 <a href="#">New Notebook</a>
73 <ul class="dropdown-menu" id="menu-new-notebook-submenu"></ul>
73 <ul class="dropdown-menu" id="menu-new-notebook-submenu"></ul>
74 </li>
74 </li>
75 <li id="open_notebook"
75 <li id="open_notebook"
76 title="Opens a new window with the Dashboard view">
76 title="Opens a new window with the Dashboard view">
77 <a href="#">Open...</a></li>
77 <a href="#">Open...</a></li>
78 <!-- <hr/> -->
78 <!-- <hr/> -->
79 <li class="divider"></li>
79 <li class="divider"></li>
80 <li id="copy_notebook"
80 <li id="copy_notebook"
81 title="Open a copy of this notebook's contents and start a new kernel">
81 title="Open a copy of this notebook's contents and start a new kernel">
82 <a href="#">Make a Copy...</a></li>
82 <a href="#">Make a Copy...</a></li>
83 <li id="rename_notebook"><a href="#">Rename...</a></li>
83 <li id="rename_notebook"><a href="#">Rename...</a></li>
84 <li id="save_checkpoint"><a href="#">Save and Checkpoint</a></li>
84 <li id="save_checkpoint"><a href="#">Save and Checkpoint</a></li>
85 <!-- <hr/> -->
85 <!-- <hr/> -->
86 <li class="divider"></li>
86 <li class="divider"></li>
87 <li id="restore_checkpoint" class="dropdown-submenu"><a href="#">Revert to Checkpoint</a>
87 <li id="restore_checkpoint" class="dropdown-submenu"><a href="#">Revert to Checkpoint</a>
88 <ul class="dropdown-menu">
88 <ul class="dropdown-menu">
89 <li><a href="#"></a></li>
89 <li><a href="#"></a></li>
90 <li><a href="#"></a></li>
90 <li><a href="#"></a></li>
91 <li><a href="#"></a></li>
91 <li><a href="#"></a></li>
92 <li><a href="#"></a></li>
92 <li><a href="#"></a></li>
93 <li><a href="#"></a></li>
93 <li><a href="#"></a></li>
94 </ul>
94 </ul>
95 </li>
95 </li>
96 <li class="divider"></li>
96 <li class="divider"></li>
97 <li id="print_preview"><a href="#">Print Preview</a></li>
97 <li id="print_preview"><a href="#">Print Preview</a></li>
98 <li class="dropdown-submenu"><a href="#">Download as</a>
98 <li class="dropdown-submenu"><a href="#">Download as</a>
99 <ul class="dropdown-menu">
99 <ul class="dropdown-menu">
100 <li id="download_ipynb"><a href="#">IPython Notebook (.ipynb)</a></li>
100 <li id="download_ipynb"><a href="#">IPython Notebook (.ipynb)</a></li>
101 <li id="download_script"><a href="#">Script</a></li>
101 <li id="download_script"><a href="#">Script</a></li>
102 <li id="download_html"><a href="#">HTML (.html)</a></li>
102 <li id="download_html"><a href="#">HTML (.html)</a></li>
103 <li id="download_rst"><a href="#">reST (.rst)</a></li>
103 <li id="download_rst"><a href="#">reST (.rst)</a></li>
104 <li id="download_pdf"><a href="#">PDF (.pdf)</a></li>
104 <li id="download_pdf"><a href="#">PDF (.pdf)</a></li>
105 </ul>
105 </ul>
106 </li>
106 </li>
107 <li class="divider"></li>
107 <li class="divider"></li>
108 <li id="trust_notebook"
108 <li id="trust_notebook"
109 title="Trust the output of this notebook">
109 title="Trust the output of this notebook">
110 <a href="#" >Trust Notebook</a></li>
110 <a href="#" >Trust Notebook</a></li>
111 <li class="divider"></li>
111 <li class="divider"></li>
112 <li id="kill_and_exit"
112 <li id="kill_and_exit"
113 title="Shutdown this notebook's kernel, and close this window">
113 title="Shutdown this notebook's kernel, and close this window">
114 <a href="#" >Close and halt</a></li>
114 <a href="#" >Close and halt</a></li>
115 </ul>
115 </ul>
116 </li>
116 </li>
117 <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">Edit</a>
117 <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">Edit</a>
118 <ul id="edit_menu" class="dropdown-menu">
118 <ul id="edit_menu" class="dropdown-menu">
119 <li id="cut_cell"><a href="#">Cut Cell</a></li>
119 <li id="cut_cell"><a href="#">Cut Cell</a></li>
120 <li id="copy_cell"><a href="#">Copy Cell</a></li>
120 <li id="copy_cell"><a href="#">Copy Cell</a></li>
121 <li id="paste_cell_above" class="disabled"><a href="#">Paste Cell Above</a></li>
121 <li id="paste_cell_above" class="disabled"><a href="#">Paste Cell Above</a></li>
122 <li id="paste_cell_below" class="disabled"><a href="#">Paste Cell Below</a></li>
122 <li id="paste_cell_below" class="disabled"><a href="#">Paste Cell Below</a></li>
123 <li id="paste_cell_replace" class="disabled"><a href="#">Paste Cell &amp; Replace</a></li>
123 <li id="paste_cell_replace" class="disabled"><a href="#">Paste Cell &amp; Replace</a></li>
124 <li id="delete_cell"><a href="#">Delete Cell</a></li>
124 <li id="delete_cell"><a href="#">Delete Cell</a></li>
125 <li id="undelete_cell" class="disabled"><a href="#">Undo Delete Cell</a></li>
125 <li id="undelete_cell" class="disabled"><a href="#">Undo Delete Cell</a></li>
126 <li class="divider"></li>
126 <li class="divider"></li>
127 <li id="split_cell"><a href="#">Split Cell</a></li>
127 <li id="split_cell"><a href="#">Split Cell</a></li>
128 <li id="merge_cell_above"><a href="#">Merge Cell Above</a></li>
128 <li id="merge_cell_above"><a href="#">Merge Cell Above</a></li>
129 <li id="merge_cell_below"><a href="#">Merge Cell Below</a></li>
129 <li id="merge_cell_below"><a href="#">Merge Cell Below</a></li>
130 <li class="divider"></li>
130 <li class="divider"></li>
131 <li id="move_cell_up"><a href="#">Move Cell Up</a></li>
131 <li id="move_cell_up"><a href="#">Move Cell Up</a></li>
132 <li id="move_cell_down"><a href="#">Move Cell Down</a></li>
132 <li id="move_cell_down"><a href="#">Move Cell Down</a></li>
133 <li class="divider"></li>
133 <li class="divider"></li>
134 <li id="edit_nb_metadata"><a href="#">Edit Notebook Metadata</a></li>
134 <li id="edit_nb_metadata"><a href="#">Edit Notebook Metadata</a></li>
135 </ul>
135 </ul>
136 </li>
136 </li>
137 <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">View</a>
137 <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">View</a>
138 <ul id="view_menu" class="dropdown-menu">
138 <ul id="view_menu" class="dropdown-menu">
139 <li id="toggle_header"
139 <li id="toggle_header"
140 title="Show/Hide the IPython Notebook logo and notebook title (above menu bar)">
140 title="Show/Hide the IPython Notebook logo and notebook title (above menu bar)">
141 <a href="#">Toggle Header</a></li>
141 <a href="#">Toggle Header</a></li>
142 <li id="toggle_toolbar"
142 <li id="toggle_toolbar"
143 title="Show/Hide the action icons (below menu bar)">
143 title="Show/Hide the action icons (below menu bar)">
144 <a href="#">Toggle Toolbar</a></li>
144 <a href="#">Toggle Toolbar</a></li>
145 </ul>
145 </ul>
146 </li>
146 </li>
147 <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">Insert</a>
147 <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">Insert</a>
148 <ul id="insert_menu" class="dropdown-menu">
148 <ul id="insert_menu" class="dropdown-menu">
149 <li id="insert_cell_above"
149 <li id="insert_cell_above"
150 title="Insert an empty Code cell above the currently active cell">
150 title="Insert an empty Code cell above the currently active cell">
151 <a href="#">Insert Cell Above</a></li>
151 <a href="#">Insert Cell Above</a></li>
152 <li id="insert_cell_below"
152 <li id="insert_cell_below"
153 title="Insert an empty Code cell below the currently active cell">
153 title="Insert an empty Code cell below the currently active cell">
154 <a href="#">Insert Cell Below</a></li>
154 <a href="#">Insert Cell Below</a></li>
155 </ul>
155 </ul>
156 </li>
156 </li>
157 <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">Cell</a>
157 <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">Cell</a>
158 <ul id="cell_menu" class="dropdown-menu">
158 <ul id="cell_menu" class="dropdown-menu">
159 <li id="run_cell" title="Run this cell, and move cursor to the next one">
159 <li id="run_cell" title="Run this cell, and move cursor to the next one">
160 <a href="#">Run</a></li>
160 <a href="#">Run</a></li>
161 <li id="run_cell_select_below" title="Run this cell, select below">
161 <li id="run_cell_select_below" title="Run this cell, select below">
162 <a href="#">Run and Select Below</a></li>
162 <a href="#">Run and Select Below</a></li>
163 <li id="run_cell_insert_below" title="Run this cell, insert below">
163 <li id="run_cell_insert_below" title="Run this cell, insert below">
164 <a href="#">Run and Insert Below</a></li>
164 <a href="#">Run and Insert Below</a></li>
165 <li id="run_all_cells" title="Run all cells in the notebook">
165 <li id="run_all_cells" title="Run all cells in the notebook">
166 <a href="#">Run All</a></li>
166 <a href="#">Run All</a></li>
167 <li id="run_all_cells_above" title="Run all cells above (but not including) this cell">
167 <li id="run_all_cells_above" title="Run all cells above (but not including) this cell">
168 <a href="#">Run All Above</a></li>
168 <a href="#">Run All Above</a></li>
169 <li id="run_all_cells_below" title="Run this cell and all cells below it">
169 <li id="run_all_cells_below" title="Run this cell and all cells below it">
170 <a href="#">Run All Below</a></li>
170 <a href="#">Run All Below</a></li>
171 <li class="divider"></li>
171 <li class="divider"></li>
172 <li id="change_cell_type" class="dropdown-submenu"
172 <li id="change_cell_type" class="dropdown-submenu"
173 title="All cells in the notebook have a cell type. By default, new cells are created as 'Code' cells">
173 title="All cells in the notebook have a cell type. By default, new cells are created as 'Code' cells">
174 <a href="#">Cell Type</a>
174 <a href="#">Cell Type</a>
175 <ul class="dropdown-menu">
175 <ul class="dropdown-menu">
176 <li id="to_code"
176 <li id="to_code"
177 title="Contents will be sent to the kernel for execution, and output will display in the footer of cell">
177 title="Contents will be sent to the kernel for execution, and output will display in the footer of cell">
178 <a href="#">Code</a></li>
178 <a href="#">Code</a></li>
179 <li id="to_markdown"
179 <li id="to_markdown"
180 title="Contents will be rendered as HTML and serve as explanatory text">
180 title="Contents will be rendered as HTML and serve as explanatory text">
181 <a href="#">Markdown</a></li>
181 <a href="#">Markdown</a></li>
182 <li id="to_raw"
182 <li id="to_raw"
183 title="Contents will pass through nbconvert unmodified">
183 title="Contents will pass through nbconvert unmodified">
184 <a href="#">Raw NBConvert</a></li>
184 <a href="#">Raw NBConvert</a></li>
185 </ul>
185 </ul>
186 </li>
186 </li>
187 <li class="divider"></li>
187 <li class="divider"></li>
188 <li id="current_outputs" class="dropdown-submenu"><a href="#">Current Output</a>
188 <li id="current_outputs" class="dropdown-submenu"><a href="#">Current Output</a>
189 <ul class="dropdown-menu">
189 <ul class="dropdown-menu">
190 <li id="toggle_current_output"
190 <li id="toggle_current_output"
191 title="Hide/Show the output of the current cell">
191 title="Hide/Show the output of the current cell">
192 <a href="#">Toggle</a>
192 <a href="#">Toggle</a>
193 </li>
193 </li>
194 <li id="toggle_current_output_scroll"
194 <li id="toggle_current_output_scroll"
195 title="Scroll the output of the current cell">
195 title="Scroll the output of the current cell">
196 <a href="#">Toggle Scrolling</a>
196 <a href="#">Toggle Scrolling</a>
197 </li>
197 </li>
198 <li id="clear_current_output"
198 <li id="clear_current_output"
199 title="Clear the output of the current cell">
199 title="Clear the output of the current cell">
200 <a href="#">Clear</a>
200 <a href="#">Clear</a>
201 </li>
201 </li>
202 </ul>
202 </ul>
203 </li>
203 </li>
204 <li id="all_outputs" class="dropdown-submenu"><a href="#">All Output</a>
204 <li id="all_outputs" class="dropdown-submenu"><a href="#">All Output</a>
205 <ul class="dropdown-menu">
205 <ul class="dropdown-menu">
206 <li id="toggle_all_output"
206 <li id="toggle_all_output"
207 title="Hide/Show the output of all cells">
207 title="Hide/Show the output of all cells">
208 <a href="#">Toggle</a>
208 <a href="#">Toggle</a>
209 </li>
209 </li>
210 <li id="toggle_all_output_scroll"
210 <li id="toggle_all_output_scroll"
211 title="Scroll the output of all cells">
211 title="Scroll the output of all cells">
212 <a href="#">Toggle Scrolling</a>
212 <a href="#">Toggle Scrolling</a>
213 </li>
213 </li>
214 <li id="clear_all_output"
214 <li id="clear_all_output"
215 title="Clear the output of all cells">
215 title="Clear the output of all cells">
216 <a href="#">Clear</a>
216 <a href="#">Clear</a>
217 </li>
217 </li>
218 </ul>
218 </ul>
219 </li>
219 </li>
220 </ul>
220 </ul>
221 </li>
221 </li>
222 <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">Kernel</a>
222 <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">Kernel</a>
223 <ul id="kernel_menu" class="dropdown-menu">
223 <ul id="kernel_menu" class="dropdown-menu">
224 <li id="int_kernel"
224 <li id="int_kernel"
225 title="Send KeyboardInterrupt (CTRL-C) to the Kernel">
225 title="Send KeyboardInterrupt (CTRL-C) to the Kernel">
226 <a href="#">Interrupt</a>
226 <a href="#">Interrupt</a>
227 </li>
227 </li>
228 <li id="restart_kernel"
228 <li id="restart_kernel"
229 title="Restart the Kernel">
229 title="Restart the Kernel">
230 <a href="#">Restart</a>
230 <a href="#">Restart</a>
231 </li>
231 </li>
232 <li id="reconnect_kernel"
232 <li id="reconnect_kernel"
233 title="Reconnect to the Kernel">
233 title="Reconnect to the Kernel">
234 <a href="#">Reconnect</a>
234 <a href="#">Reconnect</a>
235 </li>
235 </li>
236 <li class="divider"></li>
236 <li class="divider"></li>
237 <li id="menu-change-kernel" class="dropdown-submenu">
237 <li id="menu-change-kernel" class="dropdown-submenu">
238 <a href="#">Change kernel</a>
238 <a href="#">Change kernel</a>
239 <ul class="dropdown-menu" id="menu-change-kernel-submenu"></ul>
239 <ul class="dropdown-menu" id="menu-change-kernel-submenu"></ul>
240 </li>
240 </li>
241 </ul>
241 </ul>
242 </li>
242 </li>
243 <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">Help</a>
243 <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">Help</a>
244 <ul id="help_menu" class="dropdown-menu">
244 <ul id="help_menu" class="dropdown-menu">
245 <li id="notebook_tour" title="A quick tour of the notebook user interface"><a href="#">User Interface Tour</a></li>
245 <li id="notebook_tour" title="A quick tour of the notebook user interface"><a href="#">User Interface Tour</a></li>
246 <li id="keyboard_shortcuts" title="Opens a tooltip with all keyboard shortcuts"><a href="#">Keyboard Shortcuts</a></li>
246 <li id="keyboard_shortcuts" title="Opens a tooltip with all keyboard shortcuts"><a href="#">Keyboard Shortcuts</a></li>
247 <li class="divider"></li>
247 <li class="divider"></li>
248 {% set
248 {% set
249 sections = (
249 sections = (
250 (
250 (
251 ("http://nbviewer.ipython.org/github/ipython/ipython/blob/3.x/examples/Notebook/Index.ipynb", "Notebook Help", True),
251 ("http://nbviewer.ipython.org/github/ipython/ipython/blob/3.x/examples/Notebook/Index.ipynb", "Notebook Help", True),
252 ("https://help.github.com/articles/markdown-basics/","Markdown",True),
252 ("https://help.github.com/articles/markdown-basics/","Markdown",True),
253 ),
253 ),
254 )
254 )
255 %}
255 %}
256
256
257 {% for helplinks in sections %}
257 {% for helplinks in sections %}
258 {% for link in helplinks %}
258 {% for link in helplinks %}
259 <li><a href="{{link[0]}}" {{'target="_blank" title="Opens in a new window"' if link[2]}}>
259 <li><a href="{{link[0]}}" {{'target="_blank" title="Opens in a new window"' if link[2]}}>
260 {{'<i class="fa fa-external-link menu-icon pull-right"></i>' if link[2]}}
260 {{'<i class="fa fa-external-link menu-icon pull-right"></i>' if link[2]}}
261 {{link[1]}}
261 {{link[1]}}
262 </a></li>
262 </a></li>
263 {% endfor %}
263 {% endfor %}
264 {% if not loop.last %}
264 {% if not loop.last %}
265 <li class="divider"></li>
265 <li class="divider"></li>
266 {% endif %}
266 {% endif %}
267 {% endfor %}
267 {% endfor %}
268 <li class="divider"></li>
268 <li class="divider"></li>
269 <li title="About IPython Notebook"><a id="notebook_about" href="#">About</a></li>
269 <li title="About IPython Notebook"><a id="notebook_about" href="#">About</a></li>
270 </ul>
270 </ul>
271 </li>
271 </li>
272 </ul>
272 </ul>
273 </div>
273 </div>
274 </div>
274 </div>
275 </div>
275 </div>
276 </div>
276 </div>
277
277
278 <div id="maintoolbar" class="navbar">
278 <div id="maintoolbar" class="navbar">
279 <div class="toolbar-inner navbar-inner navbar-nobg">
279 <div class="toolbar-inner navbar-inner navbar-nobg">
280 <div id="maintoolbar-container" class="container"></div>
280 <div id="maintoolbar-container" class="container"></div>
281 </div>
281 </div>
282 </div>
282 </div>
283 </div>
283 </div>
284
284
285 <div class="lower-header-bar"></div>
285 <div class="lower-header-bar"></div>
286 {% endblock header %}
286 {% endblock header %}
287
287
288 {% block site %}
288 {% block site %}
289
289
290 <div id="ipython-main-app">
290 <div id="ipython-main-app">
291 <div id="notebook_panel">
291 <div id="notebook_panel">
292 <div id="notebook"></div>
292 <div id="notebook"></div>
293 </div>
293 </div>
294 </div>
294 </div>
295
295
296 <div id='tooltip' class='ipython_tooltip' style='display:none'></div>
297
296 {% endblock %}
298 {% endblock %}
297
299
298 {% block after_site %}
300 {% block after_site %}
299
301
300 <div id="pager">
302 <div id="pager">
301 <div id="pager-contents">
303 <div id="pager-contents">
302 <div id="pager-container" class="container"></div>
304 <div id="pager-container" class="container"></div>
303 </div>
305 </div>
304 <div id='pager-button-area'></div>
306 <div id='pager-button-area'></div>
305 </div>
307 </div>
306
308
307 <div id='tooltip' class='ipython_tooltip' style='display:none'></div>
308
309 {% endblock %}
309 {% endblock %}
310
310
311 {% block script %}
311 {% block script %}
312 {{super()}}
312 {{super()}}
313 <script type="text/javascript">
313 <script type="text/javascript">
314 sys_info = {{sys_info}};
314 sys_info = {{sys_info}};
315 </script>
315 </script>
316
316
317 <script src="{{ static_url("components/text-encoding/lib/encoding.js") }}" charset="utf-8"></script>
317 <script src="{{ static_url("components/text-encoding/lib/encoding.js") }}" charset="utf-8"></script>
318
318
319 <script src="{{ static_url("notebook/js/main.js") }}" charset="utf-8"></script>
319 <script src="{{ static_url("notebook/js/main.js") }}" charset="utf-8"></script>
320
320
321 {% endblock %}
321 {% endblock %}
General Comments 0
You need to be logged in to leave comments. Login now