Skip to content

Commit

Permalink
Clear all output is implemented.
Browse files Browse the repository at this point in the history
  • Loading branch information
ellisonbg committed Aug 13, 2011
1 parent 453bf75 commit 31e9da5
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 9 deletions.
14 changes: 13 additions & 1 deletion IPython/frontend/html/notebook/static/js/notebook.js
Expand Up @@ -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);
Expand All @@ -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 () {
Expand Down
3 changes: 3 additions & 0 deletions IPython/frontend/html/notebook/static/js/panelsection.js
Expand Up @@ -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();
});
Expand Down
17 changes: 9 additions & 8 deletions IPython/frontend/html/notebook/templates/notebook.html
Expand Up @@ -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">
Expand All @@ -105,13 +113,6 @@ <h3 class="section_header">Cell</h3>
</span>
<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>
Expand Down

0 comments on commit 31e9da5

Please sign in to comment.