##// END OF EJS Templates
Merge pull request #4802 from ivanov/ui-docs...
Thomas Kluyver -
r15738:4416c604 merge
parent child Browse files
Show More
@@ -0,0 +1,175 b''
1 //----------------------------------------------------------------------------
2 // Copyright (C) 2011 The IPython Development Team
3 //
4 // Distributed under the terms of the BSD License. The full license is in
5 // the file COPYING, distributed as part of this software.
6 //----------------------------------------------------------------------------
7
8 //============================================================================
9 // Tour of IPython Notebok UI (with Bootstrap Tour)
10 //============================================================================
11
12 var tour_steps = [
13 {
14 element: $("#ipython_notebook"),
15 title: "Welcome to the Notebook Tour",
16 placement: 'bottom',
17 content: "This tour will take 2 minutes.",
18 backdrop: true,
19 }, {
20 element: "#notebook_name",
21 title: "Filename",
22 placement: 'bottom',
23 content: "Click here to change the filename for this notebook."
24 }, {
25 element: "#checkpoint_status",
26 title: "Checkpoint Status",
27 placement: 'bottom',
28 content: "Information about the last time this notebook was saved."
29 }, {
30 element: $("#menus").parent(),
31 placement: 'bottom',
32 backdrop: true,
33 title: "Notebook Menubar",
34 content: "The menubar has menus for actions on the notebook, its cells, and the kernel it communicates with."
35 }, {
36 element: "#maintoolbar",
37 placement: 'bottom',
38 backdrop: true,
39 title: "Notebook Toolbar",
40 content: "The toolbar has buttons for the most common actions. Hover your mouse over each button for more information."
41 }, {
42 element: "#modal_indicator",
43 title: "Mode Indicator",
44 placement: 'bottom',
45 content: "The Notebook has two modes: Edit Mode and Command Mode. In this area, an indicator can appear to tell you which mode you are in.",
46 onShow: function(tour) { command_icon_hack(); }
47 }, {
48 element: "#modal_indicator",
49 title: "Command Mode",
50 placement: 'bottom',
51 onShow: function(tour) { IPython.notebook.command_mode(); command_icon_hack(); },
52 onNext: function(tour) { edit_mode(); },
53 content: "Right now you are in Command Mode, and many keyboard shortcuts are available. In this mode, no icon is displayed in the indicator area."
54 }, {
55 element: "#modal_indicator",
56 title: "Edit Mode",
57 placement: 'bottom',
58 onShow: function(tour) { edit_mode(); },
59 content: "Pressing <code>enter</code> or clicking in the input text area of the cell switches to Edit Mode."
60 }, {
61 element: '.selected',
62 title: "Edit Mode",
63 placement: 'bottom',
64 onShow: function(tour) { edit_mode(); },
65 content: "Notice that the border around the currently active cell changed color. Typing will insert text into the currently active cell."
66 }, {
67 element: '.selected',
68 title: "Back to Command Mode",
69 placement: 'bottom',
70 onShow: function(tour) { IPython.notebook.command_mode(); },
71 content: "Pressing <code>esc</code> or clicking outside of the input text area takes you back to Command Mode."
72 }, {
73 element: '#keyboard_shortcuts',
74 title: "Keyboard Shortcuts",
75 placement: 'bottom',
76 onShow: function(tour) { $('#help_menu').parent().addClass('open'); },
77 onHide: function(tour) { $('#help_menu').parent().removeClass('open'); },
78 content: "You can click here to get a list of all of the keyboard shortcuts."
79 }, {
80 element: "#kernel_indicator",
81 title: "Kernel Indicator",
82 placement: 'bottom',
83 onShow: function(tour) { $([IPython.events]).trigger('status_idle.Kernel');},
84 content: "This is the Kernel indicator. It looks like this when the Kernel is idle.",
85 }, {
86 element: "#kernel_indicator",
87 title: "Kernel Indicator",
88 placement: 'bottom',
89 onShow: function(tour) { $([IPython.events]).trigger('status_busy.Kernel'); },
90 content: "The Kernel indicator looks like this when the Kernel is busy.",
91 }, {
92 element: ".icon-stop",
93 placement: 'bottom',
94 title: "Interrupting the Kernel",
95 onHide: function(tour) { $([IPython.events]).trigger('status_idle.Kernel'); },
96 content: "To cancel a computation in progress, you can click here."
97 }, {
98 element: "#notification_kernel",
99 placement: 'bottom',
100 onShow: function(tour) { $('.icon-stop').click(); },
101 title: "Notification Area",
102 content: "Messages in response to user actions (Save, Interrupt, etc) appear here."
103 }, {
104 element: "#ipython_notebook",
105 title: "Fin.",
106 placement: 'bottom',
107 backdrop: true,
108 content: "This concludes the IPython Notebook User Interface Tour. Happy hacking!",
109 }
110 ];
111
112 var tour_style = "<div class='popover tour' style='position:relative'>\
113 <div class='arrow'></div>\
114 <div style='position:absolute; top:7px; right:7px'>\
115 <button class='btn btn-sm icon-remove' data-role='end'></button></div>\
116 <h3 class='popover-title'></h3>\
117 <div class='popover-content'></div>\
118 <div class='popover-navigation'>\
119 <button class='btn btn-default icon-step-backward' data-role='prev'></button>\
120 <button class='btn btn-default icon-step-forward pull-right' data-role='next'></button>\
121 <button id='tour-pause' class='btn btn-sm btn-default icon-pause' data-resume-text='' data-pause-text='' data-role='pause-resume'></button>\
122 </div>\
123 </div>";
124
125 var command_icon_hack = function() {$('#modal_indicator').css('min-height', 20);}
126 var toggle_pause_play = function () { $('#tour-pause').toggleClass('icon-pause icon-play'); };
127 var edit_mode = function() {
128 IPython.notebook.focus_cell();
129 IPython.notebook.edit_mode();
130 ;}
131
132 IPython = (function (IPython) {
133 "use strict";
134
135
136 var NotebookTour = function () {
137 this.step_duration = 0;
138 this.tour_steps = tour_steps ;
139 this.tour_steps[0].content = "You can use the left and right arrow keys to go backwards and forwards.";
140 this.tour = new Tour({
141 //orphan: true,
142 storage: false, // start tour from beginning every time
143 //element: $("#ipython_notebook"),
144 debug: true,
145 reflex: true, // click on element to continue tour
146 //backdrop: true, // show dark behind popover
147 animation: false,
148 duration: this.step_duration,
149 onStart: function() { console.log('tour started'); },
150 // TODO: remove the onPause/onResume logic once pi's patch has been
151 // merged upstream to make this work via data-resume-class and
152 // data-resume-text attributes.
153 onPause: toggle_pause_play,
154 onResume: toggle_pause_play,
155 steps: this.tour_steps,
156 template: tour_style
157 });
158 this.tour.init();
159 };
160
161 NotebookTour.prototype.start = function () {
162 console.log("let's start the tour");
163 this.tour.start();
164 if (this.tour.ended())
165 {
166 this.tour.restart();
167 }
168 };
169
170 // Set module variables
171 IPython.NotebookTour = NotebookTour;
172
173 return IPython;
174
175 }(IPython));
@@ -0,0 +1,6 b''
1 Interactive Notebook Tour
2 -------------------------
3
4 Familiarize yourself with the updated notebook user interface, including an
5 explanation of Edit and Command modes, by going through the short guided tour
6 which can be started from the Help menu.
@@ -13,9 +13,9 b' Developers of the IPython Notebook will need to install the following tools:'
13
13
14 We are moving to a model where our JavaScript dependencies are managed using
14 We are moving to a model where our JavaScript dependencies are managed using
15 [bower](http://bower.io/). These packages are installed in `static/components`
15 [bower](http://bower.io/). These packages are installed in `static/components`
16 and commited into our git repo. Our dependencies are described in the file
16 and committed into our git repo. Our dependencies are described in the file
17 `static/bower.json`. To update our bower packages, run `fab components` in this
17 `static/components/bower.json`. To update our bower packages, run `fab update`
18 directory.
18 in this directory.
19
19
20 Because CodeMirror does not use proper semantic versioning for its GitHub tags,
20 Because CodeMirror does not use proper semantic versioning for its GitHub tags,
21 we maintain our own fork of CodeMirror that is used with bower. This fork should
21 we maintain our own fork of CodeMirror that is used with bower. This fork should
@@ -14,7 +14,8 b''
14 // which make both this file fail at setting marked configuration, and textcell.js
14 // which make both this file fail at setting marked configuration, and textcell.js
15 // which search marked into global.
15 // which search marked into global.
16 require(['components/marked/lib/marked',
16 require(['components/marked/lib/marked',
17 'widgets/js/init'],
17 'widgets/js/init',
18 'components/bootstrap-tour/build/js/bootstrap-tour.min'],
18
19
19 function (marked) {
20 function (marked) {
20 "use strict";
21 "use strict";
@@ -56,6 +57,7 b' function (marked) {'
56 IPython.layout_manager = new IPython.LayoutManager();
57 IPython.layout_manager = new IPython.LayoutManager();
57 IPython.pager = new IPython.Pager('div#pager', 'div#pager_splitter');
58 IPython.pager = new IPython.Pager('div#pager', 'div#pager_splitter');
58 IPython.quick_help = new IPython.QuickHelp();
59 IPython.quick_help = new IPython.QuickHelp();
60 IPython.tour = new IPython.NotebookTour();
59 IPython.login_widget = new IPython.LoginWidget('span#login_widget', opts);
61 IPython.login_widget = new IPython.LoginWidget('span#login_widget', opts);
60 IPython.notebook = new IPython.Notebook('div#notebook', opts);
62 IPython.notebook = new IPython.Notebook('div#notebook', opts);
61 IPython.keyboard_manager = new IPython.KeyboardManager();
63 IPython.keyboard_manager = new IPython.KeyboardManager();
@@ -280,6 +280,9 b' var IPython = (function (IPython) {'
280 IPython.notebook.restart_kernel();
280 IPython.notebook.restart_kernel();
281 });
281 });
282 // Help
282 // Help
283 this.element.find('#notebook_tour').click(function () {
284 IPython.tour.start();
285 });
283 this.element.find('#keyboard_shortcuts').click(function () {
286 this.element.find('#keyboard_shortcuts').click(function () {
284 IPython.quick_help.show_keyboard_shortcuts();
287 IPython.quick_help.show_keyboard_shortcuts();
285 });
288 });
@@ -65,7 +65,7 b' var IPython = (function (IPython) {'
65 var i, half, n;
65 var i, half, n;
66
66
67 // Command mode
67 // Command mode
68 var cmd_div = $('<div/>').append($('<h4>Command Mode (press ESC to enable)</h4>'));
68 var cmd_div = $('<div/>').append($('<h4>Command Mode (press <code>esc</code> to enable)</h4>'));
69 var cmd_sub_div = $('<div/>').addClass('hbox');
69 var cmd_sub_div = $('<div/>').addClass('hbox');
70 var cmd_col1 = $('<div/>').addClass('box-flex0');
70 var cmd_col1 = $('<div/>').addClass('box-flex0');
71 var cmd_col2 = $('<div/>').addClass('box-flex0');
71 var cmd_col2 = $('<div/>').addClass('box-flex0');
@@ -98,7 +98,7 b' var IPython = (function (IPython) {'
98 var i, half, n;
98 var i, half, n;
99
99
100 // Edit mode
100 // Edit mode
101 var edit_div = $('<div/>').append($('<h4>Edit Mode (press ENTER to enable)</h4>'));
101 var edit_div = $('<div/>').append($('<h4>Edit Mode (press <code>enter</code> to enable)</h4>'));
102 var edit_sub_div = $('<div/>').addClass('hbox');
102 var edit_sub_div = $('<div/>').addClass('hbox');
103 var edit_col1 = $('<div/>').addClass('box-flex0');
103 var edit_col1 = $('<div/>').addClass('box-flex0');
104 var edit_col2 = $('<div/>').addClass('box-flex0');
104 var edit_col2 = $('<div/>').addClass('box-flex0');
@@ -11,6 +11,7 b''
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/codemirror/lib/codemirror.css") }}">
15 <link rel="stylesheet" href="{{ static_url("components/codemirror/lib/codemirror.css") }}">
15
16
16 {{super()}}
17 {{super()}}
@@ -218,6 +219,7 b' class="notebook_app"'
218 </li>
219 </li>
219 <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">Help</a>
220 <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">Help</a>
220 <ul id="help_menu" class="dropdown-menu">
221 <ul id="help_menu" class="dropdown-menu">
222 <li id="notebook_tour" title="A quick tour of the notebook user interface"><a href="#">User Interface Tour</a></li>
221 <li id="keyboard_shortcuts" title="Opens a tooltip with all keyboard shortcuts"><a href="#">Keyboard Shortcuts</a></li>
223 <li id="keyboard_shortcuts" title="Opens a tooltip with all keyboard shortcuts"><a href="#">Keyboard Shortcuts</a></li>
222 <li class="divider"></li>
224 <li class="divider"></li>
223 {% set
225 {% set
@@ -346,6 +348,8 b' class="notebook_app"'
346 <script src="{{ static_url("notebook/js/notificationwidget.js") }}" type="text/javascript" charset="utf-8"></script>
348 <script src="{{ static_url("notebook/js/notificationwidget.js") }}" type="text/javascript" charset="utf-8"></script>
347 <script src="{{ static_url("notebook/js/notificationarea.js") }}" type="text/javascript" charset="utf-8"></script>
349 <script src="{{ static_url("notebook/js/notificationarea.js") }}" type="text/javascript" charset="utf-8"></script>
348 <script src="{{ static_url("notebook/js/tooltip.js") }}" type="text/javascript" charset="utf-8"></script>
350 <script src="{{ static_url("notebook/js/tooltip.js") }}" type="text/javascript" charset="utf-8"></script>
351 <script src="{{ static_url("notebook/js/tour.js") }}" type="text/javascript" charset="utf-8"></script>
352
349 <script src="{{ static_url("notebook/js/config.js") }}" type="text/javascript" charset="utf-8"></script>
353 <script src="{{ static_url("notebook/js/config.js") }}" type="text/javascript" charset="utf-8"></script>
350 <script src="{{ static_url("notebook/js/main.js") }}" type="text/javascript" charset="utf-8"></script>
354 <script src="{{ static_url("notebook/js/main.js") }}" type="text/javascript" charset="utf-8"></script>
351
355
@@ -34,7 +34,18 b''
34 "cell_type": "markdown",
34 "cell_type": "markdown",
35 "metadata": {},
35 "metadata": {},
36 "source": [
36 "source": [
37 "Run a code cell using `Shift-Enter` or pressing the \"Play\" button in the toolbar above:"
37 "\n",
38 "<script type=\"text/javascript\">\n",
39 "var _toggle=false;\n",
40 "var hl = function (id, on){\n",
41 " $(id)[0].style.background = '';\n",
42 " if (on) {\n",
43 " $(id)[0].style.background = 'lightcyan';\n",
44 " }\n",
45 "};\n",
46 "</script>\n",
47 "\n",
48 "Run a code cell using `shift-enter` or pressing the <button><i class=\"icon-play\"></i></button> button in the <a href=\"#\" onMouseover=\"hl('#maintoolbar-container', 1)\" onMouseout=\"hl('#maintoolbar-container', 0)\">toolbar</a> above:"
38 ]
49 ]
39 },
50 },
40 {
51 {
@@ -79,7 +90,7 b''
79 "cell_type": "markdown",
90 "cell_type": "markdown",
80 "metadata": {},
91 "metadata": {},
81 "source": [
92 "source": [
82 "Code is run in a separate process called the IPython Kernel. The Kernel can be interrupted or restarted. Try running the following cell and then hit the \"Stop\" button in the toolbar above."
93 "Code is run in a separate process called the IPython Kernel. The Kernel can be interrupted or restarted. Try running the following cell and then hit the <button><i class='icon-stop'></i></button> button in the <a href=\"#\" onMouseover=\"hl('#maintoolbar-container', 1)\" onMouseout=\"hl('#maintoolbar-container', 0)\">toolbar</a> above."
83 ]
94 ]
84 },
95 },
85 {
96 {
@@ -149,6 +149,7 b' def find_package_data():'
149 static_data.extend([
149 static_data.extend([
150 pjoin(components, "backbone", "backbone-min.js"),
150 pjoin(components, "backbone", "backbone-min.js"),
151 pjoin(components, "bootstrap", "bootstrap", "js", "bootstrap.min.js"),
151 pjoin(components, "bootstrap", "bootstrap", "js", "bootstrap.min.js"),
152 pjoin(components, "bootstrap-tour", "build", "js", "bootstrap-tour.min.js"),
152 pjoin(components, "font-awesome", "font", "*.*"),
153 pjoin(components, "font-awesome", "font", "*.*"),
153 pjoin(components, "google-caja", "html-css-sanitizer-minified.js"),
154 pjoin(components, "google-caja", "html-css-sanitizer-minified.js"),
154 pjoin(components, "highlight.js", "build", "highlight.pack.js"),
155 pjoin(components, "highlight.js", "build", "highlight.pack.js"),
General Comments 0
You need to be logged in to leave comments. Login now