##// END OF EJS Templates
remove weird unicode space in the new copyright header...
MinRK -
Show More
@@ -1,74 +1,74 b''
1 =============================
1 =============================
2 The IPython licensing terms
2 The IPython licensing terms
3 =============================
3 =============================
4
4
5 IPython is licensed under the terms of the Modified BSD License (also known as
5 IPython is licensed under the terms of the Modified BSD License (also known as
6 New or Revised or 3-Clause BSD), as follows:
6 New or Revised or 3-Clause BSD), as follows:
7
7
8 - Copyright (c) 2008-2014, IPython Development Team
8 - Copyright (c) 2008-2014, IPython Development Team
9 - Copyright (c) 2001-2007, Fernando Perez <fernando.perez@colorado.edu>
9 - Copyright (c) 2001-2007, Fernando Perez <fernando.perez@colorado.edu>
10 - Copyright (c) 2001, Janko Hauser <jhauser@zscout.de>
10 - Copyright (c) 2001, Janko Hauser <jhauser@zscout.de>
11 - Copyright (c) 2001, Nathaniel Gray <n8gray@caltech.edu>
11 - Copyright (c) 2001, Nathaniel Gray <n8gray@caltech.edu>
12
12
13 All rights reserved.
13 All rights reserved.
14
14
15 Redistribution and use in source and binary forms, with or without
15 Redistribution and use in source and binary forms, with or without
16 modification, are permitted provided that the following conditions are met:
16 modification, are permitted provided that the following conditions are met:
17
17
18 Redistributions of source code must retain the above copyright notice, this
18 Redistributions of source code must retain the above copyright notice, this
19 list of conditions and the following disclaimer.
19 list of conditions and the following disclaimer.
20
20
21 Redistributions in binary form must reproduce the above copyright notice, this
21 Redistributions in binary form must reproduce the above copyright notice, this
22 list of conditions and the following disclaimer in the documentation and/or
22 list of conditions and the following disclaimer in the documentation and/or
23 other materials provided with the distribution.
23 other materials provided with the distribution.
24
24
25 Neither the name of the IPython Development Team nor the names of its
25 Neither the name of the IPython Development Team nor the names of its
26 contributors may be used to endorse or promote products derived from this
26 contributors may be used to endorse or promote products derived from this
27 software without specific prior written permission.
27 software without specific prior written permission.
28
28
29 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
29 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
30 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
30 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
31 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
31 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
32 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
32 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
33 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
33 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
34 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
34 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
35 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
35 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
36 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
36 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
37 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
37 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
38 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39
39
40 About the IPython Development Team
40 About the IPython Development Team
41 ----------------------------------
41 ----------------------------------
42
42
43 Fernando Perez began IPython in 2001 based on code from Janko Hauser
43 Fernando Perez began IPython in 2001 based on code from Janko Hauser
44 <jhauser@zscout.de> and Nathaniel Gray <n8gray@caltech.edu>. Fernando is still
44 <jhauser@zscout.de> and Nathaniel Gray <n8gray@caltech.edu>. Fernando is still
45 the project lead.
45 the project lead.
46
46
47 The IPython Development Team is the set of all contributors to the IPython
47 The IPython Development Team is the set of all contributors to the IPython
48 project. This includes all of the IPython subprojects. A full list with
48 project. This includes all of the IPython subprojects. A full list with
49 details is kept in the documentation directory, in the file
49 details is kept in the documentation directory, in the file
50 ``about/credits.txt``.
50 ``about/credits.txt``.
51
51
52 The core team that coordinates development on GitHub can be found here:
52 The core team that coordinates development on GitHub can be found here:
53 https://github.com/ipython/.
53 https://github.com/ipython/.
54
54
55 Our Copyright Policy
55 Our Copyright Policy
56 --------------------
56 --------------------
57
57
58 IPython uses a shared copyright model. Each contributor maintains copyright
58 IPython uses a shared copyright model. Each contributor maintains copyright
59 over their contributions to IPython. But, it is important to note that these
59 over their contributions to IPython. But, it is important to note that these
60 contributions are typically only changes to the repositories. Thus, the IPython
60 contributions are typically only changes to the repositories. Thus, the IPython
61 source code, in its entirety is not the copyright of any single person or
61 source code, in its entirety is not the copyright of any single person or
62 institution. Instead, it is the collective copyright of the entire IPython
62 institution. Instead, it is the collective copyright of the entire IPython
63 Development Team. If individual contributors want to maintain a record of what
63 Development Team. If individual contributors want to maintain a record of what
64 changes/contributions they have specific copyright on, they should indicate
64 changes/contributions they have specific copyright on, they should indicate
65 their copyright in the commit message of the change, when they commit the
65 their copyright in the commit message of the change, when they commit the
66 change to one of the IPython repositories.
66 change to one of the IPython repositories.
67
67
68 With this in mind, the following banner should be used in any source code file
68 With this in mind, the following banner should be used in any source code file
69 to indicate the copyright and license terms:
69 to indicate the copyright and license terms:
70
70
71 ::
71 ::
72
72
73 # Copyright (c) IPython Development Team.
73 # Copyright (c) IPython Development Team.
74 # Distributed under the terms of the Modified BSD License.
74 # Distributed under the terms of the Modified BSD License.
@@ -1,171 +1,171 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 //============================================================================
4 //============================================================================
5 // QuickHelp button
5 // QuickHelp button
6 //============================================================================
6 //============================================================================
7
7
8 var IPython = (function (IPython) {
8 var IPython = (function (IPython) {
9 "use strict";
9 "use strict";
10
10
11 var platform = IPython.utils.platform;
11 var platform = IPython.utils.platform;
12
12
13 var QuickHelp = function (selector) {
13 var QuickHelp = function (selector) {
14 };
14 };
15
15
16 var cmd_ctrl = 'Ctrl-';
16 var cmd_ctrl = 'Ctrl-';
17 var platform_specific;
17 var platform_specific;
18
18
19 if (platform === 'MacOS') {
19 if (platform === 'MacOS') {
20 // Mac OS X specific
20 // Mac OS X specific
21 cmd_ctrl = 'Cmd-';
21 cmd_ctrl = 'Cmd-';
22 platform_specific = [
22 platform_specific = [
23 { shortcut: "Cmd-Up", help:"go to cell start" },
23 { shortcut: "Cmd-Up", help:"go to cell start" },
24 { shortcut: "Cmd-Down", help:"go to cell end" },
24 { shortcut: "Cmd-Down", help:"go to cell end" },
25 { shortcut: "Opt-Left", help:"go one word left" },
25 { shortcut: "Opt-Left", help:"go one word left" },
26 { shortcut: "Opt-Right", help:"go one word right" },
26 { shortcut: "Opt-Right", help:"go one word right" },
27 { shortcut: "Opt-Backspace", help:"del word before" },
27 { shortcut: "Opt-Backspace", help:"del word before" },
28 { shortcut: "Opt-Delete", help:"del word after" },
28 { shortcut: "Opt-Delete", help:"del word after" },
29 ];
29 ];
30 } else {
30 } else {
31 // PC specific
31 // PC specific
32 platform_specific = [
32 platform_specific = [
33 { shortcut: "Ctrl-Home", help:"go to cell start" },
33 { shortcut: "Ctrl-Home", help:"go to cell start" },
34 { shortcut: "Ctrl-Up", help:"go to cell start" },
34 { shortcut: "Ctrl-Up", help:"go to cell start" },
35 { shortcut: "Ctrl-End", help:"go to cell end" },
35 { shortcut: "Ctrl-End", help:"go to cell end" },
36 { shortcut: "Ctrl-Down", help:"go to cell end" },
36 { shortcut: "Ctrl-Down", help:"go to cell end" },
37 { shortcut: "Ctrl-Left", help:"go one word left" },
37 { shortcut: "Ctrl-Left", help:"go one word left" },
38 { shortcut: "Ctrl-Right", help:"go one word right" },
38 { shortcut: "Ctrl-Right", help:"go one word right" },
39 { shortcut: "Ctrl-Backspace", help:"del word before" },
39 { shortcut: "Ctrl-Backspace", help:"del word before" },
40 { shortcut: "Ctrl-Delete", help:"del word after" },
40 { shortcut: "Ctrl-Delete", help:"del word after" },
41 ];
41 ];
42 }
42 }
43
43
44 var cm_shortcuts = [
44 var cm_shortcuts = [
45 { shortcut:"Tab", help:"code completion or indent" },
45 { shortcut:"Tab", help:"code completion or indent" },
46 { shortcut:"Shift-Tab", help:"tooltip" },
46 { shortcut:"Shift-Tab", help:"tooltip" },
47 { shortcut: cmd_ctrl + "]", help:"indent" },
47 { shortcut: cmd_ctrl + "]", help:"indent" },
48 { shortcut: cmd_ctrl + "[", help:"dedent" },
48 { shortcut: cmd_ctrl + "[", help:"dedent" },
49 { shortcut: cmd_ctrl + "a", help:"select all" },
49 { shortcut: cmd_ctrl + "a", help:"select all" },
50 { shortcut: cmd_ctrl + "z", help:"undo" },
50 { shortcut: cmd_ctrl + "z", help:"undo" },
51 { shortcut: cmd_ctrl + "Shift-z", help:"redo" },
51 { shortcut: cmd_ctrl + "Shift-z", help:"redo" },
52 { shortcut: cmd_ctrl + "y", help:"redo" },
52 { shortcut: cmd_ctrl + "y", help:"redo" },
53 ].concat( platform_specific );
53 ].concat( platform_specific );
54
54
55
55
56
56
57
57
58
58
59
59
60 QuickHelp.prototype.show_keyboard_shortcuts = function () {
60 QuickHelp.prototype.show_keyboard_shortcuts = function () {
61 // toggles display of keyboard shortcut dialog
61 // toggles display of keyboard shortcut dialog
62 var that = this;
62 var that = this;
63 if ( this.force_rebuild ) {
63 if ( this.force_rebuild ) {
64 this.shortcut_dialog.remove();
64 this.shortcut_dialog.remove();
65 delete(this.shortcut_dialog);
65 delete(this.shortcut_dialog);
66 this.force_rebuild = false;
66 this.force_rebuild = false;
67 }
67 }
68 if ( this.shortcut_dialog ){
68 if ( this.shortcut_dialog ){
69 // if dialog is already shown, close it
69 // if dialog is already shown, close it
70 $(this.shortcut_dialog).modal("toggle");
70 $(this.shortcut_dialog).modal("toggle");
71 return;
71 return;
72 }
72 }
73 var command_shortcuts = IPython.keyboard_manager.command_shortcuts.help();
73 var command_shortcuts = IPython.keyboard_manager.command_shortcuts.help();
74 var edit_shortcuts = IPython.keyboard_manager.edit_shortcuts.help();
74 var edit_shortcuts = IPython.keyboard_manager.edit_shortcuts.help();
75 var help, shortcut;
75 var help, shortcut;
76 var i, half, n;
76 var i, half, n;
77 var element = $('<div/>');
77 var element = $('<div/>');
78
78
79 // The documentation
79 // The documentation
80 var doc = $('<div/>').addClass('alert');
80 var doc = $('<div/>').addClass('alert');
81 doc.append(
81 doc.append(
82 $('<button/>').addClass('close').attr('data-dismiss','alert').html('&times;')
82 $('<button/>').addClass('close').attr('data-dismiss','alert').html('&times;')
83 ).append(
83 ).append(
84 'The IPython Notebook has two different keyboard input modes. <b>Edit mode</b> '+
84 'The IPython Notebook has two different keyboard input modes. <b>Edit mode</b> '+
85 'allows you to type code/text into a cell and is indicated by a green cell '+
85 'allows you to type code/text into a cell and is indicated by a green cell '+
86 'border. <b>Command mode</b> binds the keyboard to notebook level actions '+
86 'border. <b>Command mode</b> binds the keyboard to notebook level actions '+
87 'and is indicated by a grey cell border.'
87 'and is indicated by a grey cell border.'
88 );
88 );
89 element.append(doc);
89 element.append(doc);
90
90
91 // Command mode
91 // Command mode
92 var cmd_div = this.build_command_help();
92 var cmd_div = this.build_command_help();
93 element.append(cmd_div);
93 element.append(cmd_div);
94
94
95 // Edit mode
95 // Edit mode
96 var edit_div = this.build_edit_help(cm_shortcuts);
96 var edit_div = this.build_edit_help(cm_shortcuts);
97 element.append(edit_div);
97 element.append(edit_div);
98
98
99 this.shortcut_dialog = IPython.dialog.modal({
99 this.shortcut_dialog = IPython.dialog.modal({
100 title : "Keyboard shortcuts",
100 title : "Keyboard shortcuts",
101 body : element,
101 body : element,
102 destroy : false,
102 destroy : false,
103 buttons : {
103 buttons : {
104 Close : {}
104 Close : {}
105 }
105 }
106 });
106 });
107 this.shortcut_dialog.addClass("modal_stretch");
107 this.shortcut_dialog.addClass("modal_stretch");
108
108
109 $([IPython.events]).on('rebuild.QuickHelp', function() { that.force_rebuild = true;});
109 $([IPython.events]).on('rebuild.QuickHelp', function() { that.force_rebuild = true;});
110 };
110 };
111
111
112 QuickHelp.prototype.build_command_help = function () {
112 QuickHelp.prototype.build_command_help = function () {
113 var command_shortcuts = IPython.keyboard_manager.command_shortcuts.help();
113 var command_shortcuts = IPython.keyboard_manager.command_shortcuts.help();
114 return build_div('<h4>Command Mode (press <code>Esc</code> to enable)</h4>', command_shortcuts);
114 return build_div('<h4>Command Mode (press <code>Esc</code> to enable)</h4>', command_shortcuts);
115 };
115 };
116
116
117 var special_case = { pageup: "PageUp", pagedown: "Page Down", 'minus': '-' };
117 var special_case = { pageup: "PageUp", pagedown: "Page Down", 'minus': '-' };
118 var prettify = function (s) {
118 var prettify = function (s) {
119 s = s.replace(/-$/, 'minus'); // catch shortcuts using '-' key
119 s = s.replace(/-$/, 'minus'); // catch shortcuts using '-' key
120 var keys = s.split('-');
120 var keys = s.split('-');
121 var k, i;
121 var k, i;
122 for (i in keys) {
122 for (i in keys) {
123 k = keys[i];
123 k = keys[i];
124 if ( k.length == 1 ) {
124 if ( k.length == 1 ) {
125 keys[i] = "<code><strong>" + k + "</strong></code>";
125 keys[i] = "<code><strong>" + k + "</strong></code>";
126 continue; // leave individual keys lower-cased
126 continue; // leave individual keys lower-cased
127 }
127 }
128 keys[i] = ( special_case[k] ? special_case[k] : k.charAt(0).toUpperCase() + k.slice(1) );
128 keys[i] = ( special_case[k] ? special_case[k] : k.charAt(0).toUpperCase() + k.slice(1) );
129 keys[i] = "<code><strong>" + keys[i] + "</strong></code>";
129 keys[i] = "<code><strong>" + keys[i] + "</strong></code>";
130 }
130 }
131 return keys.join('-');
131 return keys.join('-');
132
132
133
133
134 };
134 };
135
135
136 QuickHelp.prototype.build_edit_help = function (cm_shortcuts) {
136 QuickHelp.prototype.build_edit_help = function (cm_shortcuts) {
137 var edit_shortcuts = IPython.keyboard_manager.edit_shortcuts.help();
137 var edit_shortcuts = IPython.keyboard_manager.edit_shortcuts.help();
138 jQuery.extend(cm_shortcuts, edit_shortcuts);
138 jQuery.extend(cm_shortcuts, edit_shortcuts);
139 return build_div('<h4>Edit Mode (press <code>Enter</code> to enable)</h4>', cm_shortcuts);
139 return build_div('<h4>Edit Mode (press <code>Enter</code> to enable)</h4>', cm_shortcuts);
140 };
140 };
141
141
142 var build_one = function (s) {
142 var build_one = function (s) {
143 var help = s.help;
143 var help = s.help;
144 var shortcut = prettify(s.shortcut);
144 var shortcut = prettify(s.shortcut);
145 return $('<div>').addClass('quickhelp').
145 return $('<div>').addClass('quickhelp').
146 append($('<span/>').addClass('shortcut_key').append($(shortcut))).
146 append($('<span/>').addClass('shortcut_key').append($(shortcut))).
147 append($('<span/>').addClass('shortcut_descr').text(' : ' + help));
147 append($('<span/>').addClass('shortcut_descr').text(' : ' + help));
148
148
149 };
149 };
150
150
151 var build_div = function (title, shortcuts) {
151 var build_div = function (title, shortcuts) {
152 var i, half, n;
152 var i, half, n;
153 var div = $('<div/>').append($(title));
153 var div = $('<div/>').append($(title));
154 var sub_div = $('<div/>').addClass('hbox');
154 var sub_div = $('<div/>').addClass('hbox');
155 var col1 = $('<div/>').addClass('box-flex1');
155 var col1 = $('<div/>').addClass('box-flex1');
156 var col2 = $('<div/>').addClass('box-flex1');
156 var col2 = $('<div/>').addClass('box-flex1');
157 n = shortcuts.length;
157 n = shortcuts.length;
158 half = ~~(n/2); // Truncate :)
158 half = ~~(n/2); // Truncate :)
159 for (i=0; i<half; i++) { col1.append( build_one(shortcuts[i]) ); }
159 for (i=0; i<half; i++) { col1.append( build_one(shortcuts[i]) ); }
160 for (i=half; i<n; i++) { col2.append( build_one(shortcuts[i]) ); }
160 for (i=half; i<n; i++) { col2.append( build_one(shortcuts[i]) ); }
161 sub_div.append(col1).append(col2);
161 sub_div.append(col1).append(col2);
162 div.append(sub_div);
162 div.append(sub_div);
163 return div;
163 return div;
164 };
164 };
165
165
166 // Set module variables
166 // Set module variables
167 IPython.QuickHelp = QuickHelp;
167 IPython.QuickHelp = QuickHelp;
168
168
169 return IPython;
169 return IPython;
170
170
171 }(IPython));
171 }(IPython));
General Comments 0
You need to be logged in to leave comments. Login now