##// END OF EJS Templates
Removing KBN null mode and replacing with enable/disable.
Brian E. Granger -
Show More
@@ -69,12 +69,13 b' IPython.dialog = (function (IPython) {'
69 if (IPython.notebook) {
69 if (IPython.notebook) {
70 var cell = IPython.notebook.get_selected_cell();
70 var cell = IPython.notebook.get_selected_cell();
71 if (cell) cell.select();
71 if (cell) cell.select();
72 IPython.keyboard_manager.enable();
72 IPython.keyboard_manager.command_mode();
73 IPython.keyboard_manager.command_mode();
73 }
74 }
74 });
75 });
75
76
76 if (IPython.keyboard_manager) {
77 if (IPython.keyboard_manager) {
77 IPython.keyboard_manager.null_mode();
78 IPython.keyboard_manager.disable();
78 }
79 }
79
80
80 return dialog.modal(options);
81 return dialog.modal(options);
@@ -257,7 +257,7 b' var IPython = (function (IPython) {'
257 this.build_gui_list(this.raw_result);
257 this.build_gui_list(this.raw_result);
258
258
259 this.sel.focus();
259 this.sel.focus();
260 IPython.keyboard_manager.null_mode();
260 IPython.keyboard_manager.disable();
261 // Opera sometimes ignores focusing a freshly created node
261 // Opera sometimes ignores focusing a freshly created node
262 if (window.opera) setTimeout(function () {
262 if (window.opera) setTimeout(function () {
263 if (!this.done) this.sel.focus();
263 if (!this.done) this.sel.focus();
@@ -282,7 +282,7 b' var IPython = (function (IPython) {'
282 if (this.done) return;
282 if (this.done) return;
283 this.done = true;
283 this.done = true;
284 $('.completions').remove();
284 $('.completions').remove();
285 IPython.keyboard_manager.edit_mode();
285 IPython.keyboard_manager.enable();
286 }
286 }
287
287
288 Completer.prototype.pick = function () {
288 Completer.prototype.pick = function () {
@@ -16,7 +16,7 b' var IPython = (function (IPython) {'
16
16
17 var KeyboardManager = function () {
17 var KeyboardManager = function () {
18 this.mode = 'command';
18 this.mode = 'command';
19 this.last_mode = 'command';
19 this.enabled = true;
20 this.bind_events();
20 this.bind_events();
21 };
21 };
22
22
@@ -38,8 +38,8 b' var IPython = (function (IPython) {'
38 event.preventDefault();
38 event.preventDefault();
39 }
39 }
40
40
41 if (this.mode === 'null') {
41 if (!this.enabled) {
42 return this.handle_null_mode(event);
42 return true;
43 }
43 }
44
44
45 // Event handlers for both command and edit mode
45 // Event handlers for both command and edit mode
@@ -75,11 +75,6 b' var IPython = (function (IPython) {'
75 }
75 }
76 }
76 }
77
77
78 KeyboardManager.prototype.handle_null_mode = function (event) {
79 return true;
80 }
81
82
83 KeyboardManager.prototype.handle_edit_mode = function (event) {
78 KeyboardManager.prototype.handle_edit_mode = function (event) {
84 var notebook = IPython.notebook;
79 var notebook = IPython.notebook;
85
80
@@ -263,19 +258,6 b' var IPython = (function (IPython) {'
263 this.mode = 'command';
258 this.mode = 'command';
264 }
259 }
265
260
266 KeyboardManager.prototype.null_mode = function () {
267 console.log('KeyboardManager', 'changing to null mode');
268 this.last_mode = this.mode;
269 this.mode = 'null';
270 }
271
272 KeyboardManager.prototype.last_mode = function () {
273 var lm = this.last_mode;
274 this.last_mode = this.mode;
275 this.mode = lm;
276 }
277
278
279 IPython.KeyboardManager = KeyboardManager;
261 IPython.KeyboardManager = KeyboardManager;
280
262
281 return IPython;
263 return IPython;
General Comments 0
You need to be logged in to leave comments. Login now