Skip to content
Browse files

Clear all output is implemented.

  • Loading branch information...
1 parent 453bf75 commit 31e9da53de3d3a8387626d1588cc2d0b9f049dea @ellisonbg ellisonbg committed Aug 13, 2011
View
14 IPython/frontend/html/notebook/static/js/notebook.js
@@ -443,7 +443,7 @@ var IPython = (function (IPython) {
};
- // Cell collapsing
+ // Cell collapsing and output clearing
Notebook.prototype.collapse = function (index) {
var i = this.index_or_selected(index);
@@ -465,6 +465,18 @@ var IPython = (function (IPython) {
};
};
+
+ Notebook.prototype.clear_all_output = function () {
+ var ncells = this.ncells();
+ var cells = this.cells();
+ for (var i=0; i<ncells; i++) {
+ if (cells[i] instanceof IPython.CodeCell) {
+ cells[i].clear_output();
+ }
+ };
+ };
+
+
// Kernel related things
Notebook.prototype.start_kernel = function () {
View
3 IPython/frontend/html/notebook/static/js/panelsection.js
@@ -137,6 +137,9 @@ var IPython = (function (IPython) {
this.content.find('#expand_cell').click(function () {
IPython.notebook.expand();
});
+ this.content.find('#clear_all_output').click(function () {
+ IPython.notebook.clear_all_output();
+ });
this.content.find('#delete_cell').click(function () {
IPython.notebook.delete_cell();
});
View
17 IPython/frontend/html/notebook/templates/notebook.html
@@ -89,7 +89,15 @@ <h3 class="section_header">Cell</h3>
<button id="to_html">HTML</button>
<button id="to_markdown">Markdown</button>
</span>
- <!-- <span class="button_label">Format</span> -->
+ <span class="button_label">Format</span>
+ </div>
+ <div class="section_row">
+ <span id="toggle_output" class="section_row_buttons">
+ <button id="collapse_cell">Collapse</button>
+ <button id="expand_cell">Expand</button>
+ <button id="clear_all_output">Clear All</button>
+ </span>
+ <span class="button_label">Output</span>
</div>
<div class="section_row">
<span id="insert" class="section_row_buttons">
@@ -106,13 +114,6 @@ <h3 class="section_header">Cell</h3>
<span class="button_label">Move</span>
</div>
<div class="section_row">
- <span id="toggle_output" class="section_row_buttons">
- <button id="collapse_cell">Collapse</button>
- <button id="expand_cell">Expand</button>
- </span>
- <span class="button_label">Output</span>
- </div>
- <div class="section_row">
<span id="run_cells" class="section_row_buttons">
<button id="run_selected_cell">Selected</button>
<button id="run_all_cells">All</button>

0 comments on commit 31e9da5

Please sign in to comment.
Something went wrong with that request. Please try again.