Show More
@@ -236,16 +236,21 b' class NotebookManager(LoggingConfigurable):' | |||||
236 | os.unlink(path) |
|
236 | os.unlink(path) | |
237 | self.delete_notebook_id(notebook_id) |
|
237 | self.delete_notebook_id(notebook_id) | |
238 |
|
238 | |||
239 | def new_notebook(self): |
|
239 | def increment_filename(self, basename): | |
240 | """Create a new notebook and returns its notebook_id.""" |
|
240 | """Return a non-used filename of the form basename0.""" | |
241 | i = 0 |
|
241 | i = 0 | |
242 | while True: |
|
242 | while True: | |
243 |
name = u' |
|
243 | name = u'%s%i' % (basename,i) | |
244 | path = self.get_path_by_name(name) |
|
244 | path = self.get_path_by_name(name) | |
245 | if not os.path.isfile(path): |
|
245 | if not os.path.isfile(path): | |
246 | break |
|
246 | break | |
247 | else: |
|
247 | else: | |
248 | i = i+1 |
|
248 | i = i+1 | |
|
249 | return path, name | |||
|
250 | ||||
|
251 | def new_notebook(self): | |||
|
252 | """Create a new notebook and return its notebook_id.""" | |||
|
253 | path, name = self.increment_filename('Untitled') | |||
249 | notebook_id = self.new_notebook_id(name) |
|
254 | notebook_id = self.new_notebook_id(name) | |
250 | metadata = current.new_metadata(name=name) |
|
255 | metadata = current.new_metadata(name=name) | |
251 | nb = current.new_notebook(metadata=metadata) |
|
256 | nb = current.new_notebook(metadata=metadata) | |
@@ -254,9 +259,10 b' class NotebookManager(LoggingConfigurable):' | |||||
254 | return notebook_id |
|
259 | return notebook_id | |
255 |
|
260 | |||
256 | def copy_notebook(self, notebook_id): |
|
261 | def copy_notebook(self, notebook_id): | |
257 |
"""C |
|
262 | """Copy an existing notebook and return its notebook_id.""" | |
258 | last_mod, nb = self.get_notebook_object(notebook_id) |
|
263 | last_mod, nb = self.get_notebook_object(notebook_id) | |
259 | name = nb.metadata.name + '-Copy' |
|
264 | name = nb.metadata.name + '-Copy' | |
|
265 | path, name = self.increment_filename(name) | |||
260 | nb.metadata.name = name |
|
266 | nb.metadata.name = name | |
261 | notebook_id = self.new_notebook_id(name) |
|
267 | notebook_id = self.new_notebook_id(name) | |
262 | self.save_notebook_object(notebook_id, nb) |
|
268 | self.save_notebook_object(notebook_id, nb) |
@@ -311,9 +311,6 b' var IPython = (function (IPython) {' | |||||
311 | { |
|
311 | { | |
312 | if(this.npressed >fallback_on_tooltip_after && this.prevmatch==matched_text) |
|
312 | if(this.npressed >fallback_on_tooltip_after && this.prevmatch==matched_text) | |
313 | { |
|
313 | { | |
314 | console.log('Ok, you really want to complete after pressing tab '+this.npressed+' times !'); |
|
|||
315 | console.log('You should understand that there is no (more) completion for that !'); |
|
|||
316 | console.log("I'll show you the tooltip, will you stop bothering me ?"); |
|
|||
317 | this.request_tooltip_after_time(matched_text+'(',0); |
|
314 | this.request_tooltip_after_time(matched_text+'(',0); | |
318 | return; |
|
315 | return; | |
319 | } |
|
316 | } | |
@@ -487,8 +484,6 b' var IPython = (function (IPython) {' | |||||
487 | // dismiss the completer and go back to before invoking it |
|
484 | // dismiss the completer and go back to before invoking it | |
488 | insert(matched_text,event); |
|
485 | insert(matched_text,event); | |
489 |
} else if( |
|
486 | } else if (press) { // abort only on .keypress or esc | |
490 | // abort with what the user have pressed until now |
|
|||
491 | console.log('aborting with keycode : '+code+' is down :'+down); |
|
|||
492 | } |
|
487 | } | |
493 | } |
|
488 | } | |
494 | select.keydown(function (event) { |
|
489 | select.keydown(function (event) { | |
@@ -790,7 +785,6 b' var IPython = (function (IPython) {' | |||||
790 |
|
785 | |||
791 |
|
786 | |||
792 | CodeCell.prototype.fromJSON = function (data) { |
|
787 | CodeCell.prototype.fromJSON = function (data) { | |
793 | console.log('Import from JSON:', data); |
|
|||
794 | if (data.cell_type === 'code') { |
|
788 | if (data.cell_type === 'code') { | |
795 | if (data.input !== undefined) { |
|
789 | if (data.input !== undefined) { | |
796 | this.set_code(data.input); |
|
790 | this.set_code(data.input); | |
@@ -828,7 +822,6 b' var IPython = (function (IPython) {' | |||||
828 | data.outputs = outputs; |
|
822 | data.outputs = outputs; | |
829 | data.language = 'python'; |
|
823 | data.language = 'python'; | |
830 | data.collapsed = this.collapsed; |
|
824 | data.collapsed = this.collapsed; | |
831 | // console.log('Export to JSON:',data); |
|
|||
832 | return data; |
|
825 | return data; | |
833 | }; |
|
826 | }; | |
834 |
|
827 |
@@ -31,7 +31,6 b' var IPython = (function (IPython) {' | |||||
31 | // in the DOM. |
|
31 | // in the DOM. | |
32 | $(".wijmo-wijmenu-text").parent().bind("click", function () { |
|
32 | $(".wijmo-wijmenu-text").parent().bind("click", function () { | |
33 | $('ul#menus').wijmenu("hideAllMenus"); |
|
33 | $('ul#menus').wijmenu("hideAllMenus"); | |
34 | console.log('I am closing you!'); |
|
|||
35 | }); |
|
34 | }); | |
36 | // Make sure we hover over menu items correctly. This is needed when |
|
35 | // Make sure we hover over menu items correctly. This is needed when | |
37 | // menu shortcuts are used as they have a slightly different structure |
|
36 | // menu shortcuts are used as they have a slightly different structure |
@@ -587,17 +587,14 b' var IPython = (function (IPython) {' | |||||
587 |
|
587 | |||
588 |
|
588 | |||
589 | Notebook.prototype.set_timebeforetooltip = function (time) { |
|
589 | Notebook.prototype.set_timebeforetooltip = function (time) { | |
590 | console.log("change time before tooltip to : "+time); |
|
|||
591 | this.time_before_tooltip = time; |
|
590 | this.time_before_tooltip = time; | |
592 | }; |
|
591 | }; | |
593 |
|
592 | |||
594 | Notebook.prototype.set_tooltipontab = function (state) { |
|
593 | Notebook.prototype.set_tooltipontab = function (state) { | |
595 | console.log("change tooltip on tab to : "+state); |
|
|||
596 | this.tooltip_on_tab = state; |
|
594 | this.tooltip_on_tab = state; | |
597 | }; |
|
595 | }; | |
598 |
|
596 | |||
599 | Notebook.prototype.set_smartcompleter = function (state) { |
|
597 | Notebook.prototype.set_smartcompleter = function (state) { | |
600 | console.log("Smart completion (kwargs first) changed to to : "+state); |
|
|||
601 | this.smart_completer = state; |
|
598 | this.smart_completer = state; | |
602 | }; |
|
599 | }; | |
603 |
|
600 |
@@ -120,7 +120,8 b' var IPython = (function (IPython) {' | |||||
120 | SaveWidget.prototype.update_url = function () { |
|
120 | SaveWidget.prototype.update_url = function () { | |
121 | var notebook_id = this.get_notebook_id(); |
|
121 | var notebook_id = this.get_notebook_id(); | |
122 | if (notebook_id !== '') { |
|
122 | if (notebook_id !== '') { | |
123 | window.history.replaceState({}, '', notebook_id); |
|
123 | var new_url = '/'+notebook_id; | |
|
124 | window.history.replaceState({}, '', new_url); | |||
124 | }; |
|
125 | }; | |
125 | }; |
|
126 | }; | |
126 |
|
127 |
@@ -68,8 +68,8 b'' | |||||
68 | <li id="new_notebook"><span class="wijmo-wijmenu-text">New</span></li> |
|
68 | <li id="new_notebook"><span class="wijmo-wijmenu-text">New</span></li> | |
69 | <li id="open_notebook"><span class="wijmo-wijmenu-text">Open...</span></li> |
|
69 | <li id="open_notebook"><span class="wijmo-wijmenu-text">Open...</span></li> | |
70 | <li></li> |
|
70 | <li></li> | |
71 | <li id="rename_notebook"><span class="wijmo-wijmenu-text">Rename...</span></li> |
|
|||
72 | <li id="copy_notebook"><span class="wijmo-wijmenu-text">Make a Copy...</span></li> |
|
71 | <li id="copy_notebook"><span class="wijmo-wijmenu-text">Make a Copy...</span></li> | |
|
72 | <li id="rename_notebook"><span class="wijmo-wijmenu-text">Rename...</span></li> | |||
73 | <li id="save_notebook"> |
|
73 | <li id="save_notebook"> | |
74 | <div> |
|
74 | <div> | |
75 | <span class="wijmo-wijmenu-text">Save</span> |
|
75 | <span class="wijmo-wijmenu-text">Save</span> |
General Comments 0
You need to be logged in to leave comments.
Login now