Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite398156

Browse files
authored
Merge pull request#3314 from Shels1909/1097-close-halt
#1097 Add close and halt to shortcut menu
2 parents0db7ef7 +9b9c191 commite398156

File tree

5 files changed

+27
-15
lines changed

5 files changed

+27
-15
lines changed

‎notebook/static/notebook/js/actions.js‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -694,6 +694,13 @@ define([
694694
// Execute a CM command
695695
selected_cell.code_mirror.execCommand('indentAuto');
696696
}
697+
},
698+
'close-and-halt':{
699+
cmd:i18n.msg._('shutdown kernel and close window'),
700+
help :i18n.msg._('shutdown kernel and close window'),
701+
handler :function(env){
702+
env.notebook.close_and_halt();
703+
}
697704
}
698705
};
699706

‎notebook/static/notebook/js/menubar.js‎

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -231,18 +231,6 @@ define([
231231
}
232232
});
233233

234-
this.element.find('#kill_and_exit').click(function(){
235-
varclose_window=function(){
236-
/**
237-
* allow closing of new tabs in Chromium, impossible in FF
238-
*/
239-
window.open('','_self','');
240-
window.close();
241-
};
242-
// finish with close on success or failure
243-
that.notebook.session.delete(close_window,close_window);
244-
});
245-
246234
// View
247235
this._add_celltoolbar_list();
248236

@@ -252,7 +240,7 @@ define([
252240
notebook:that.notebook,
253241
keyboard_manager:that.notebook.keyboard_manager});
254242
});
255-
243+
256244
varid_actions_dict={
257245
'#trust_notebook' :'trust-notebook',
258246
'#rename_notebook' :'rename-notebook',
@@ -262,6 +250,7 @@ define([
262250
'#restart_kernel':'confirm-restart-kernel',
263251
'#restart_clear_output':'confirm-restart-kernel-and-clear-output',
264252
'#restart_run_all':'confirm-restart-kernel-and-run-all-cells',
253+
'#close_and_halt':'close-and-halt',
265254
'#int_kernel':'interrupt-kernel',
266255
'#cut_cell':'cut-cell',
267256
'#copy_cell':'copy-cell',

‎notebook/static/notebook/js/notebook.js‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2399,6 +2399,22 @@ define([
23992399
returnpromise;
24002400
};
24012401

2402+
/**
2403+
*
2404+
* Halt the kernel and close the notebook window
2405+
*/
2406+
Notebook.prototype.close_and_halt=function(){
2407+
varclose_window=function(){
2408+
/**
2409+
* allow closing of new tabs in Chromium, impossible in FF
2410+
*/
2411+
window.open('','_self','');
2412+
window.close();
2413+
};
2414+
// finish with close on success or failure
2415+
this.session.delete(close_window,close_window);
2416+
};
2417+
24022418
/**
24032419
* Execute cells corresponding to the given indices.
24042420
*

‎notebook/templates/notebook.html‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@
124124
title="{% trans %}Trust the output of this notebook{% endtrans %}">
125125
<ahref="#">{% trans %}Trust Notebook{% endtrans %}</a></li>
126126
<liclass="divider"></li>
127-
<liid="kill_and_exit"
127+
<liid="close_and_halt"
128128
title="{% trans %}Shutdown this notebook's kernel, and close this window{% endtrans %}">
129129
<ahref="#">{% trans %}Close and Halt{% endtrans %}</a></li>
130130
</ul>

‎notebook/tests/notebook/shutdown.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ casper.notebook_test(function () {
2525
this.waitForPopup('');
2626
this.withPopup('',function(){
2727
this.thenEvaluate(function(){
28-
$('#kill_and_exit').click();
28+
$('#close_and_halt').click();
2929
});
3030

3131
this.thenEvaluate(function(){

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp