Show More
@@ -1,160 +1,160 b'' | |||
|
1 | 1 | //---------------------------------------------------------------------------- |
|
2 | 2 | // Copyright (C) 2011 The IPython Development Team |
|
3 | 3 | // |
|
4 | 4 | // Distributed under the terms of the BSD License. The full license is in |
|
5 | 5 | // the file COPYING, distributed as part of this software. |
|
6 | 6 | //---------------------------------------------------------------------------- |
|
7 | 7 | |
|
8 | 8 | //============================================================================ |
|
9 | 9 | // Tour of IPython Notebok UI (with Bootstrap Tour) |
|
10 | 10 | //============================================================================ |
|
11 | 11 | |
|
12 | 12 | var tour_steps = [ |
|
13 | 13 | { |
|
14 | 14 | element: $("#ipython_notebook").parent(), |
|
15 | 15 | title: "Welcome to the Notebook Tour", |
|
16 | 16 | placement: 'bottom', |
|
17 | 17 | content: "This tour will take 2 minutes.", |
|
18 | 18 | backdrop: true, |
|
19 | 19 | }, { |
|
20 | 20 | element: "#ipython_notebook", |
|
21 | 21 | title: "Header", |
|
22 | 22 | placement: 'bottom', |
|
23 | 23 | content: "Clicking here takes you back to the Dashboard." |
|
24 | 24 | }, { |
|
25 | 25 | element: "#notebook_name", |
|
26 | 26 | title: "Filename", |
|
27 | 27 | placement: 'bottom', |
|
28 | 28 | content: "You can click here to change the filename for this notebook." |
|
29 | 29 | }, |
|
30 | 30 | { |
|
31 | 31 | element: "#checkpoint_status", |
|
32 | 32 | title: "Checkpoint status", |
|
33 | 33 | placement: 'bottom', |
|
34 | 34 | content: "Information about the last time this notebook was saved." |
|
35 | 35 | }, { |
|
36 | 36 | element: "#menus", |
|
37 | 37 | placement: 'left', |
|
38 | 38 | title: "Notebook Menubar", |
|
39 | 39 | content: "The actions that you can perform with this notebook, its cells, and its kernel" |
|
40 | 40 | }, { |
|
41 | 41 | element: "#menus", |
|
42 | 42 | placement: 'bottom', |
|
43 | 43 | title: "Notebook Menubar", |
|
44 | 44 | content: "The actions that you can perform with this notebook, its cells, and its kernel" |
|
45 | 45 | }, { |
|
46 | 46 | element: "#notification_kernel", |
|
47 | 47 | placement: 'bottom', |
|
48 | 48 | onShow: function(tour) { IPython.notification_area.widget_dict.kernel.set_message("sample notification"); }, |
|
49 | 49 | onHide: function(tour) { IPython.notification_area.widget_dict.kernel.set_message("sample notification", 100); }, |
|
50 | 50 | title: "Notification area", |
|
51 | 51 | content: "Messages in response to user action (Kernel busy, Interrupt, etc)" |
|
52 | 52 | }, { |
|
53 | 53 | element: "#modal_indicator", |
|
54 | 54 | title: "Mode indicator", |
|
55 | 55 | placement: 'bottom', |
|
56 | 56 | content: "IPython has two modes: Edit Mode and Command Mode. This indicator tells you which mode you are in." |
|
57 | 57 | }, { |
|
58 | 58 | element: "#modal_indicator", |
|
59 | 59 | title: "Mode indicator", |
|
60 | 60 | placement: 'bottom', |
|
61 | 61 | content: "Right now you are in Command mode, and many keyboard shortcuts are available." |
|
62 | 62 | }, { |
|
63 | 63 | element: "#modal_indicator", |
|
64 | 64 | title: "Edit Mode", |
|
65 | 65 | placement: 'bottom', |
|
66 | 66 | onShow: function(tour) { IPython.notebook.edit_mode(); }, |
|
67 | 67 | content: "And now we've switched to Edit Mode, regular typing will go into the currently active cell." |
|
68 | 68 | }, { |
|
69 | 69 | element: $('.selected'), |
|
70 | 70 | title: "Edit Mode", |
|
71 | 71 | placement: 'bottom', |
|
72 | 72 | onHide: function(tour) { IPython.notebook.command_mode(); }, |
|
73 | 73 | content: "Notice that the border around the currently active cell changed color." |
|
74 | 74 | }, { |
|
75 | 75 | element: $('.selected'), |
|
76 | 76 | title: "back to Command Mode", |
|
77 | 77 | placement: 'bottom', |
|
78 | 78 | onHide: function(tour) { IPython.notebook.command_mode(); }, |
|
79 | 79 | content: "Pressing Esc or clicking outside of the input text area takes you back to command mode." |
|
80 | 80 | }, { |
|
81 | 81 | element: "#kernel_indicator", |
|
82 | 82 | title: "Kernel indicator", |
|
83 | 83 | placement: 'bottom', |
|
84 | 84 | content: "This is the Kernel indicator. It looks like this when the Kernel is idle.", |
|
85 | 85 | }, { |
|
86 | 86 | element: "#kernel_indicator", |
|
87 | 87 | title: "Kernel Indicator", |
|
88 | 88 | placement: 'bottom', |
|
89 | 89 | onShow: function(tour) { $([IPython.events]).trigger('status_busy.Kernel'); }, |
|
90 | 90 | onHide: function(tour) { $([IPython.events]).trigger('status_idle.Kernel');}, |
|
91 | 91 | content: "The Kernel indicator looks like this when the Kernel is busy.", |
|
92 | 92 | }, { |
|
93 | 93 | element: "#kernel_indicator", |
|
94 | 94 | title: "Fin.", |
|
95 | 95 | placement: 'bottom', |
|
96 | 96 | onShow: function(tour) { $([IPython.events]).trigger('status_busy.Kernel'); }, |
|
97 | 97 | onHide: function(tour) { $([IPython.events]).trigger('status_idle.Kernel');}, |
|
98 | 98 | content: "This concludes the IPython Notebook User Interface Tour. Happy hacking!", |
|
99 | 99 | } |
|
100 | 100 | ]; |
|
101 | 101 | |
|
102 | var tour_style = "<div class='popover tour'>\ | |
|
102 | var tour_style = "<div class='popover tour' style='position:relative'>\ | |
|
103 | 103 | <div class='arrow'></div>\ |
|
104 | <h3 class='popover-title'> | |
|
105 |
<button class='btn btn- |
|
|
104 | <div style='position:absolute; top:7px; right:7px'>\ | |
|
105 | <button class='btn btn-sm icon-remove' data-role='end'></button></div>\ | |
|
106 | <h3 class='popover-title'></h3>\ | |
|
106 | 107 | <div class='popover-content'></div>\ |
|
107 | 108 | <div class='popover-navigation'>\ |
|
108 | 109 | <button class='btn btn-default icon-step-backward' data-role='prev'></button>\ |
|
109 | 110 | <button class='btn btn-default icon-step-forward' data-role='next'></button>\ |
|
110 | 111 | <button id='tour-pause' class='btn btn-sm btn-default icon-pause' data-resume-text='' data-pause-text='' data-role='pause-resume'></button>\ |
|
111 | ||
|
112 | 112 | </div>\ |
|
113 | 113 | </div>" |
|
114 | 114 | |
|
115 | 115 | var toggle_pause_play = function () { $('#tour-pause').toggleClass('icon-pause icon-play'); } |
|
116 | 116 | |
|
117 | 117 | IPython = (function (IPython) { |
|
118 | 118 | "use strict"; |
|
119 | 119 | |
|
120 | 120 | |
|
121 | 121 | var NotebookTour = function () { |
|
122 | 122 | this.step_duration = 5000; |
|
123 | 123 | this.tour_steps = tour_steps ; |
|
124 | 124 | this.tour_steps[0].content = "This tour will take " + this.step_duration * tour_steps.length / 1000 + " seconds"; |
|
125 | 125 | this.tour = new Tour({ |
|
126 | 126 | //orphan: true, |
|
127 | 127 | storage: false, // start tour from beginning every time |
|
128 | 128 | //element: $("#ipython_notebook"), |
|
129 | 129 | debug: true, |
|
130 | 130 | reflex: true, // click on element to continue tour |
|
131 | 131 | //backdrop: true, // show dark behind popover |
|
132 | 132 | animation: false, |
|
133 | 133 | duration: this.step_duration, |
|
134 | 134 | onStart: function() { console.log('tour started'); }, |
|
135 | 135 | // TODO: remove the onPause/onResume logic once pi's patch has been |
|
136 | 136 | // merged upstream to make this work via data-resume-class and |
|
137 | 137 | // data-resume-text attributes. |
|
138 | 138 | onPause: toggle_pause_play, |
|
139 | 139 | onResume: toggle_pause_play, |
|
140 | 140 | steps: this.tour_steps, |
|
141 | 141 | template: tour_style |
|
142 | 142 | }); |
|
143 | 143 | this.tour.init(); |
|
144 | 144 | }; |
|
145 | 145 | |
|
146 | 146 | NotebookTour.prototype.start = function () { |
|
147 | 147 | console.log("let's start the tour"); |
|
148 | 148 | this.tour.start(); |
|
149 | 149 | if (this.tour.ended()) |
|
150 | 150 | { |
|
151 | 151 | this.tour.restart(); |
|
152 | 152 | } |
|
153 | 153 | }; |
|
154 | 154 | |
|
155 | 155 | // Set module variables |
|
156 | 156 | IPython.NotebookTour = NotebookTour; |
|
157 | 157 | |
|
158 | 158 | return IPython; |
|
159 | 159 | |
|
160 | 160 | }(IPython)); |
General Comments 0
You need to be logged in to leave comments.
Login now