##// END OF EJS Templates
semantic names for indicator icons...
semantic names for indicator icons For all of the discussion that we had about what kind of icons should and should not be used to indicate what mode the notebook is in, we never went through to make it possible to override it. With this change, it is now possible to override what icons are displayed for Command and Edit Modes. For example, @minrk liked the fighter-jet icon for Command Mode, so he can put this in his custom.css .ipython-command-mode:before { content: "\f0fb"; }

File last commit:

r15706:079f2d7e
r15806:6b3b303a
Show More
tour.js
175 lines | 6.8 KiB | application/javascript | JavascriptLexer
Paul Ivanov
initial bootstrap tour...
r15564 //----------------------------------------------------------------------------
// Copyright (C) 2011 The IPython Development Team
//
// Distributed under the terms of the BSD License. The full license is in
// the file COPYING, distributed as part of this software.
//----------------------------------------------------------------------------
//============================================================================
// Tour of IPython Notebok UI (with Bootstrap Tour)
//============================================================================
var tour_steps = [
{
Paul Ivanov
tidying up the tour explanation of modes
r15574 element: $("#ipython_notebook"),
Paul Ivanov
more work on the tour
r15567 title: "Welcome to the Notebook Tour",
Paul Ivanov
initial bootstrap tour...
r15564 placement: 'bottom',
Paul Ivanov
more work on the tour
r15567 content: "This tour will take 2 minutes.",
Paul Ivanov
initial bootstrap tour...
r15564 backdrop: true,
}, {
element: "#notebook_name",
title: "Filename",
placement: 'bottom',
Paul Ivanov
don't automatically advance the tour
r15577 content: "Click here to change the filename for this notebook."
Paul Ivanov
fix vertical position of command mode tooltip
r15675 }, {
Paul Ivanov
initial bootstrap tour...
r15564 element: "#checkpoint_status",
Paul Ivanov
tidy up capitalization
r15679 title: "Checkpoint Status",
Paul Ivanov
initial bootstrap tour...
r15564 placement: 'bottom',
content: "Information about the last time this notebook was saved."
}, {
Paul Ivanov
horizontally center menubar popup
r15676 element: $("#menus").parent(),
Paul Ivanov
initial bootstrap tour...
r15564 placement: 'bottom',
Paul Ivanov
tidying up the tour explanation of modes
r15574 backdrop: true,
Paul Ivanov
initial bootstrap tour...
r15564 title: "Notebook Menubar",
Paul Ivanov
rewording according to feedback in #4802
r15677 content: "The menubar has menus for actions on the notebook, its cells, and the kernel it communicates with."
Paul Ivanov
initial bootstrap tour...
r15564 }, {
Paul Ivanov
more refinement of the tour contents
r15576 element: "#maintoolbar",
Paul Ivanov
initial bootstrap tour...
r15564 placement: 'bottom',
Paul Ivanov
more refinement of the tour contents
r15576 backdrop: true,
title: "Notebook Toolbar",
Paul Ivanov
rewording according to feedback in #4802
r15677 content: "The toolbar has buttons for the most common actions. Hover your mouse over each button for more information."
Paul Ivanov
initial bootstrap tour...
r15564 }, {
element: "#modal_indicator",
Paul Ivanov
rewording according to feedback in #4802
r15677 title: "Mode Indicator",
Paul Ivanov
initial bootstrap tour...
r15564 placement: 'bottom',
Paul Ivanov
added a note to what's new
r15706 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.",
Paul Ivanov
fix vertical position of command mode tooltip
r15675 onShow: function(tour) { command_icon_hack(); }
Paul Ivanov
initial bootstrap tour...
r15564 }, {
element: "#modal_indicator",
Paul Ivanov
addressing Fernando's feedback
r15582 title: "Command Mode",
Paul Ivanov
initial bootstrap tour...
r15564 placement: 'bottom',
Paul Ivanov
fix vertical position of command mode tooltip
r15675 onShow: function(tour) { IPython.notebook.command_mode(); command_icon_hack(); },
Paul Ivanov
entering edit mode now requires focus_cell
r15585 onNext: function(tour) { edit_mode(); },
Paul Ivanov
addressing Fernando's feedback
r15582 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."
Paul Ivanov
initial bootstrap tour...
r15564 }, {
element: "#modal_indicator",
title: "Edit Mode",
placement: 'bottom',
Paul Ivanov
entering edit mode now requires focus_cell
r15585 onShow: function(tour) { edit_mode(); },
Paul Ivanov
oops, <tt> went the way of the dodo, using <code>
r15705 content: "Pressing <code>enter</code> or clicking in the input text area of the cell switches to Edit Mode."
Paul Ivanov
initial bootstrap tour...
r15564 }, {
Paul Ivanov
tidying up the tour explanation of modes
r15574 element: '.selected',
Paul Ivanov
initial bootstrap tour...
r15564 title: "Edit Mode",
placement: 'bottom',
Paul Ivanov
entering edit mode now requires focus_cell
r15585 onShow: function(tour) { edit_mode(); },
Paul Ivanov
rewording according to feedback in #4802
r15677 content: "Notice that the border around the currently active cell changed color. Typing will insert text into the currently active cell."
Paul Ivanov
tidying up the tour explanation of modes
r15574 }, {
element: '.selected',
Paul Ivanov
tidy up capitalization
r15679 title: "Back to Command Mode",
Paul Ivanov
tidying up the tour explanation of modes
r15574 placement: 'bottom',
onShow: function(tour) { IPython.notebook.command_mode(); },
Paul Ivanov
oops, <tt> went the way of the dodo, using <code>
r15705 content: "Pressing <code>esc</code> or clicking outside of the input text area takes you back to Command Mode."
Paul Ivanov
more work on the tour
r15567 }, {
Paul Ivanov
tidy up and add to the tour...
r15575 element: '#keyboard_shortcuts',
title: "Keyboard Shortcuts",
Paul Ivanov
tidying up the tour explanation of modes
r15574 placement: 'bottom',
Paul Ivanov
more robust forward and back tour transitions
r15583 onShow: function(tour) { $('#help_menu').parent().addClass('open'); },
onHide: function(tour) { $('#help_menu').parent().removeClass('open'); },
Paul Ivanov
tidy up and add to the tour...
r15575 content: "You can click here to get a list of all of the keyboard shortcuts."
Paul Ivanov
tidying up the tour explanation of modes
r15574 }, {
Paul Ivanov
initial bootstrap tour...
r15564 element: "#kernel_indicator",
Paul Ivanov
tidy up capitalization
r15679 title: "Kernel Indicator",
Paul Ivanov
initial bootstrap tour...
r15564 placement: 'bottom',
Paul Ivanov
tidy up and add to the tour...
r15575 onShow: function(tour) { $([IPython.events]).trigger('status_idle.Kernel');},
Paul Ivanov
initial bootstrap tour...
r15564 content: "This is the Kernel indicator. It looks like this when the Kernel is idle.",
}, {
element: "#kernel_indicator",
title: "Kernel Indicator",
placement: 'bottom',
onShow: function(tour) { $([IPython.events]).trigger('status_busy.Kernel'); },
content: "The Kernel indicator looks like this when the Kernel is busy.",
Paul Ivanov
allow tour restarting
r15570 }, {
Paul Ivanov
more refinement of the tour contents
r15576 element: ".icon-stop",
placement: 'bottom',
title: "Interrupting the Kernel",
Paul Ivanov
more robust forward and back tour transitions
r15583 onHide: function(tour) { $([IPython.events]).trigger('status_idle.Kernel'); },
Paul Ivanov
more refinement of the tour contents
r15576 content: "To cancel a computation in progress, you can click here."
}, {
element: "#notification_kernel",
placement: 'bottom',
Paul Ivanov
more robust forward and back tour transitions
r15583 onShow: function(tour) { $('.icon-stop').click(); },
Paul Ivanov
tidy up capitalization
r15679 title: "Notification Area",
Paul Ivanov
more robust forward and back tour transitions
r15583 content: "Messages in response to user actions (Save, Interrupt, etc) appear here."
Paul Ivanov
more refinement of the tour contents
r15576 }, {
element: "#ipython_notebook",
Paul Ivanov
allow tour restarting
r15570 title: "Fin.",
placement: 'bottom',
Paul Ivanov
more refinement of the tour contents
r15576 backdrop: true,
Paul Ivanov
allow tour restarting
r15570 content: "This concludes the IPython Notebook User Interface Tour. Happy hacking!",
Paul Ivanov
initial bootstrap tour...
r15564 }
];
Paul Ivanov
more work on the tour
r15567
Paul Ivanov
End tour via 'x' in upper right corner of window
r15573 var tour_style = "<div class='popover tour' style='position:relative'>\
Paul Ivanov
pause/play buttons for starting/stopping the tour
r15572 <div class='arrow'></div>\
Paul Ivanov
End tour via 'x' in upper right corner of window
r15573 <div style='position:absolute; top:7px; right:7px'>\
<button class='btn btn-sm icon-remove' data-role='end'></button></div>\
<h3 class='popover-title'></h3>\
Paul Ivanov
pause/play buttons for starting/stopping the tour
r15572 <div class='popover-content'></div>\
<div class='popover-navigation'>\
<button class='btn btn-default icon-step-backward' data-role='prev'></button>\
Paul Ivanov
tour: put the right arrow on the right side
r15592 <button class='btn btn-default icon-step-forward pull-right' data-role='next'></button>\
Paul Ivanov
pause/play buttons for starting/stopping the tour
r15572 <button id='tour-pause' class='btn btn-sm btn-default icon-pause' data-resume-text='' data-pause-text='' data-role='pause-resume'></button>\
</div>\
Paul Ivanov
entering edit mode now requires focus_cell
r15585 </div>";
Paul Ivanov
pause/play buttons for starting/stopping the tour
r15572
Paul Ivanov
fix vertical position of command mode tooltip
r15675 var command_icon_hack = function() {$('#modal_indicator').css('min-height', 20);}
Paul Ivanov
entering edit mode now requires focus_cell
r15585 var toggle_pause_play = function () { $('#tour-pause').toggleClass('icon-pause icon-play'); };
var edit_mode = function() {
IPython.notebook.focus_cell();
IPython.notebook.edit_mode();
;}
Paul Ivanov
pause/play buttons for starting/stopping the tour
r15572
Paul Ivanov
starting the tour from the menu works now...
r15568 IPython = (function (IPython) {
"use strict";
Paul Ivanov
more work on the tour
r15567
Paul Ivanov
starting the tour from the menu works now...
r15568
var NotebookTour = function () {
Paul Ivanov
don't automatically advance the tour
r15577 this.step_duration = 0;
Paul Ivanov
starting the tour from the menu works now...
r15568 this.tour_steps = tour_steps ;
Paul Ivanov
don't automatically advance the tour
r15577 this.tour_steps[0].content = "You can use the left and right arrow keys to go backwards and forwards.";
Paul Ivanov
starting the tour from the menu works now...
r15568 this.tour = new Tour({
//orphan: true,
storage: false, // start tour from beginning every time
//element: $("#ipython_notebook"),
debug: true,
reflex: true, // click on element to continue tour
//backdrop: true, // show dark behind popover
animation: false,
duration: this.step_duration,
onStart: function() { console.log('tour started'); },
Paul Ivanov
pause/play buttons for starting/stopping the tour
r15572 // TODO: remove the onPause/onResume logic once pi's patch has been
// merged upstream to make this work via data-resume-class and
// data-resume-text attributes.
onPause: toggle_pause_play,
onResume: toggle_pause_play,
Paul Ivanov
starting the tour from the menu works now...
r15568 steps: this.tour_steps,
Paul Ivanov
pause/play buttons for starting/stopping the tour
r15572 template: tour_style
Paul Ivanov
starting the tour from the menu works now...
r15568 });
Paul Ivanov
allow tour restarting
r15570 this.tour.init();
Paul Ivanov
starting the tour from the menu works now...
r15568 };
Paul Ivanov
initial bootstrap tour...
r15564
Paul Ivanov
starting the tour from the menu works now...
r15568 NotebookTour.prototype.start = function () {
console.log("let's start the tour");
this.tour.start();
Paul Ivanov
allow tour restarting
r15570 if (this.tour.ended())
{
this.tour.restart();
}
Paul Ivanov
starting the tour from the menu works now...
r15568 };
// Set module variables
IPython.NotebookTour = NotebookTour;
return IPython;
}(IPython));