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

#1097 Add close and halt to shortcut menu#3314

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
takluyver merged 4 commits intojupyter:masterfrommfdooom:1097-close-halt
Feb 8, 2018
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletionsnotebook/static/notebook/js/actions.js
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -694,6 +694,13 @@ define([
// Execute a CM command
selected_cell.code_mirror.execCommand('indentAuto');
}
},
'close-and-halt': {
cmd: i18n.msg._('shutdown kernel and close window'),
help : i18n.msg._('shutdown kernel and close window'),
handler : function(env) {
env.notebook.close_and_halt();
}
}
};

Expand Down
15 changes: 2 additions & 13 deletionsnotebook/static/notebook/js/menubar.js
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -231,18 +231,6 @@ define([
}
});

this.element.find('#kill_and_exit').click(function () {
var close_window = function () {
/**
* allow closing of new tabs in Chromium, impossible in FF
*/
window.open('', '_self', '');
window.close();
};
// finish with close on success or failure
that.notebook.session.delete(close_window, close_window);
});

// View
this._add_celltoolbar_list();

Expand All@@ -252,7 +240,7 @@ define([
notebook: that.notebook,
keyboard_manager: that.notebook.keyboard_manager});
});

var id_actions_dict = {
'#trust_notebook' : 'trust-notebook',
'#rename_notebook' : 'rename-notebook',
Expand All@@ -262,6 +250,7 @@ define([
'#restart_kernel': 'confirm-restart-kernel',
'#restart_clear_output': 'confirm-restart-kernel-and-clear-output',
'#restart_run_all': 'confirm-restart-kernel-and-run-all-cells',
'#close_and_halt': 'close-and-halt',
'#int_kernel': 'interrupt-kernel',
'#cut_cell': 'cut-cell',
'#copy_cell': 'copy-cell',
Expand Down
16 changes: 16 additions & 0 deletionsnotebook/static/notebook/js/notebook.js
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -2399,6 +2399,22 @@ define([
return promise;
};

/**
*
* Halt the kernel and close the notebook window
*/
Notebook.prototype.close_and_halt = function () {
var close_window = function () {
/**
* allow closing of new tabs in Chromium, impossible in FF
*/
window.open('', '_self', '');
window.close();
};
// finish with close on success or failure
this.session.delete(close_window, close_window);
};

/**
* Execute cells corresponding to the given indices.
*
Expand Down
2 changes: 1 addition & 1 deletionnotebook/templates/notebook.html
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -124,7 +124,7 @@
title="{% trans %}Trust the output of this notebook{% endtrans %}">
<a href="#" >{% trans %}Trust Notebook{% endtrans %}</a></li>
<li class="divider"></li>
<li id="kill_and_exit"
<li id="close_and_halt"
title="{% trans %}Shutdown this notebook's kernel, and close this window{% endtrans %}">
<a href="#" >{% trans %}Close and Halt{% endtrans %}</a></li>
</ul>
Expand Down
2 changes: 1 addition & 1 deletionnotebook/tests/notebook/shutdown.js
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -25,7 +25,7 @@ casper.notebook_test(function () {
this.waitForPopup('');
this.withPopup('', function () {
this.thenEvaluate(function () {
$('#kill_and_exit').click();
$('#close_and_halt').click();
});

this.thenEvaluate(function () {
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp