Show More
@@ -418,24 +418,28 b' var IPython = (function (IPython) {' | |||||
418 | }; |
|
418 | }; | |
419 |
|
419 | |||
420 |
|
420 | |||
421 | CodeCell.prototype.collapse = function () { |
|
421 | CodeCell.prototype.collapse_output = function () { | |
422 | this.collapsed = true; |
|
422 | this.collapsed = true; | |
423 | this.output_area.collapse(); |
|
423 | this.output_area.collapse(); | |
424 | }; |
|
424 | }; | |
425 |
|
425 | |||
426 |
|
426 | |||
427 | CodeCell.prototype.expand = function () { |
|
427 | CodeCell.prototype.expand_output = function () { | |
428 | this.collapsed = false; |
|
428 | this.collapsed = false; | |
429 | this.output_area.expand(); |
|
429 | this.output_area.expand(); | |
|
430 | this.output_area.unscroll_area(); | |||
430 | }; |
|
431 | }; | |
431 |
|
432 | |||
|
433 | CodeCell.prototype.scroll_output = function () { | |||
|
434 | this.output_area.expand(); | |||
|
435 | this.output_area.scroll_if_long(); | |||
|
436 | }; | |||
432 |
|
437 | |||
433 | CodeCell.prototype.toggle_output = function () { |
|
438 | CodeCell.prototype.toggle_output = function () { | |
434 | this.collapsed = Boolean(1 - this.collapsed); |
|
439 | this.collapsed = Boolean(1 - this.collapsed); | |
435 | this.output_area.toggle_output(); |
|
440 | this.output_area.toggle_output(); | |
436 | }; |
|
441 | }; | |
437 |
|
442 | |||
438 |
|
||||
439 | CodeCell.prototype.toggle_output_scroll = function () { |
|
443 | CodeCell.prototype.toggle_output_scroll = function () { | |
440 | this.output_area.toggle_scroll(); |
|
444 | this.output_area.toggle_scroll(); | |
441 | }; |
|
445 | }; | |
@@ -510,6 +514,7 b' var IPython = (function (IPython) {' | |||||
510 |
|
514 | |||
511 | CodeCell.prototype.clear_output = function (wait) { |
|
515 | CodeCell.prototype.clear_output = function (wait) { | |
512 | this.output_area.clear_output(wait); |
|
516 | this.output_area.clear_output(wait); | |
|
517 | this.set_input_prompt(); | |||
513 | }; |
|
518 | }; | |
514 |
|
519 | |||
515 |
|
520 | |||
@@ -533,9 +538,9 b' var IPython = (function (IPython) {' | |||||
533 | this.output_area.fromJSON(data.outputs); |
|
538 | this.output_area.fromJSON(data.outputs); | |
534 | if (data.collapsed !== undefined) { |
|
539 | if (data.collapsed !== undefined) { | |
535 | if (data.collapsed) { |
|
540 | if (data.collapsed) { | |
536 | this.collapse(); |
|
541 | this.collapse_output(); | |
537 | } else { |
|
542 | } else { | |
538 | this.expand(); |
|
543 | this.expand_output(); | |
539 | } |
|
544 | } | |
540 | } |
|
545 | } | |
541 | } |
|
546 | } |
@@ -225,35 +225,17 b' var IPython = (function (IPython) {' | |||||
225 | this.element.find('#run_all_cells_below').click(function () { |
|
225 | this.element.find('#run_all_cells_below').click(function () { | |
226 | IPython.notebook.execute_cells_below(); |
|
226 | IPython.notebook.execute_cells_below(); | |
227 | }); |
|
227 | }); | |
228 |
this.element.find('# |
|
228 | this.element.find('#collapse_current_output').click(function () { | |
229 |
IPython.notebook. |
|
229 | IPython.notebook.collapse_output(); | |
230 | }); |
|
230 | }); | |
231 |
this.element.find('# |
|
231 | this.element.find('#scroll_current_output').click(function () { | |
232 |
IPython.notebook. |
|
232 | IPython.notebook.scroll_output(); | |
233 | }); |
|
233 | }); | |
234 |
this.element.find('# |
|
234 | this.element.find('#expand_current_output').click(function () { | |
235 |
IPython.notebook. |
|
235 | IPython.notebook.expand_output(); | |
236 | }); |
|
236 | }); | |
237 |
this.element.find('# |
|
237 | this.element.find('#clear_current_output').click(function () { | |
238 |
IPython.notebook. |
|
238 | IPython.notebook.clear_output(); | |
239 | }); |
|
|||
240 | this.element.find('#to_heading2').click(function () { |
|
|||
241 | IPython.notebook.to_heading(undefined, 2); |
|
|||
242 | }); |
|
|||
243 | this.element.find('#to_heading3').click(function () { |
|
|||
244 | IPython.notebook.to_heading(undefined, 3); |
|
|||
245 | }); |
|
|||
246 | this.element.find('#to_heading4').click(function () { |
|
|||
247 | IPython.notebook.to_heading(undefined, 4); |
|
|||
248 | }); |
|
|||
249 | this.element.find('#to_heading5').click(function () { |
|
|||
250 | IPython.notebook.to_heading(undefined, 5); |
|
|||
251 | }); |
|
|||
252 | this.element.find('#to_heading6').click(function () { |
|
|||
253 | IPython.notebook.to_heading(undefined, 6); |
|
|||
254 | }); |
|
|||
255 | this.element.find('#toggle_output').click(function () { |
|
|||
256 | IPython.notebook.toggle_output(); |
|
|||
257 | }); |
|
239 | }); | |
258 | this.element.find('#collapse_all_output').click(function () { |
|
240 | this.element.find('#collapse_all_output').click(function () { | |
259 | IPython.notebook.collapse_all_output(); |
|
241 | IPython.notebook.collapse_all_output(); |
@@ -1165,67 +1165,114 b' var IPython = (function (IPython) {' | |||||
1165 | /** |
|
1165 | /** | |
1166 | * Hide a cell's output. |
|
1166 | * Hide a cell's output. | |
1167 | * |
|
1167 | * | |
1168 | * @method collapse |
|
1168 | * @method collapse_output | |
1169 | * @param {Number} index A cell's numeric index |
|
1169 | * @param {Number} index A cell's numeric index | |
1170 | */ |
|
1170 | */ | |
1171 | Notebook.prototype.collapse = function (index) { |
|
1171 | Notebook.prototype.collapse_output = function (index) { | |
1172 | var i = this.index_or_selected(index); |
|
1172 | var i = this.index_or_selected(index); | |
1173 |
this.get_cell(i) |
|
1173 | var cell = this.get_cell(i); | |
|
1174 | if (cell !== null && (cell instanceof IPython.CodeCell)) { | |||
|
1175 | cell.collapse_output(); | |||
|
1176 | this.set_dirty(true); | |||
|
1177 | } | |||
|
1178 | }; | |||
|
1179 | ||||
|
1180 | /** | |||
|
1181 | * Hide each code cell's output area. | |||
|
1182 | * | |||
|
1183 | * @method collapse_all_output | |||
|
1184 | */ | |||
|
1185 | Notebook.prototype.collapse_all_output = function () { | |||
|
1186 | var ncells = this.ncells(); | |||
|
1187 | var cells = this.get_cells(); | |||
|
1188 | for (var i=0; i<ncells; i++) { | |||
|
1189 | if (cells[i] instanceof IPython.CodeCell) { | |||
|
1190 | cells[i].collapse_output(); | |||
|
1191 | } | |||
|
1192 | }; | |||
|
1193 | // this should not be set if the `collapse` key is removed from nbformat | |||
1174 | this.set_dirty(true); |
|
1194 | this.set_dirty(true); | |
1175 | }; |
|
1195 | }; | |
1176 |
|
1196 | |||
1177 | /** |
|
1197 | /** | |
1178 | * Show a cell's output. |
|
1198 | * Show a cell's output. | |
1179 | * |
|
1199 | * | |
1180 | * @method expand |
|
1200 | * @method expand_output | |
1181 | * @param {Number} index A cell's numeric index |
|
1201 | * @param {Number} index A cell's numeric index | |
1182 | */ |
|
1202 | */ | |
1183 | Notebook.prototype.expand = function (index) { |
|
1203 | Notebook.prototype.expand_output = function (index) { | |
1184 | var i = this.index_or_selected(index); |
|
1204 | var i = this.index_or_selected(index); | |
1185 |
this.get_cell(i) |
|
1205 | var cell = this.get_cell(i); | |
|
1206 | if (cell !== null && (cell instanceof IPython.CodeCell)) { | |||
|
1207 | cell.expand_output(); | |||
1186 | this.set_dirty(true); |
|
1208 | this.set_dirty(true); | |
|
1209 | } | |||
1187 | }; |
|
1210 | }; | |
1188 |
|
1211 | |||
1189 | /** Toggle whether a cell's output is collapsed or expanded. |
|
1212 | /** | |
|
1213 | * Expand each code cell's output area, and remove scrollbars. | |||
1190 | * |
|
1214 | * | |
1191 |
* @method |
|
1215 | * @method expand_all_output | |
1192 | * @param {Number} index A cell's numeric index |
|
|||
1193 | */ |
|
1216 | */ | |
1194 |
Notebook.prototype. |
|
1217 | Notebook.prototype.expand_all_output = function () { | |
1195 |
var |
|
1218 | var ncells = this.ncells(); | |
1196 |
this.get_cell |
|
1219 | var cells = this.get_cells(); | |
|
1220 | for (var i=0; i<ncells; i++) { | |||
|
1221 | if (cells[i] instanceof IPython.CodeCell) { | |||
|
1222 | cells[i].expand_output(); | |||
|
1223 | } | |||
|
1224 | }; | |||
|
1225 | // this should not be set if the `collapse` key is removed from nbformat | |||
1197 | this.set_dirty(true); |
|
1226 | this.set_dirty(true); | |
1198 | }; |
|
1227 | }; | |
1199 |
|
1228 | |||
1200 | /** |
|
1229 | /** | |
1201 | * Toggle a scrollbar for long cell outputs. |
|
1230 | * Clear the selected CodeCell's output area. | |
1202 | * |
|
1231 | * | |
1203 |
* @method |
|
1232 | * @method clear_output | |
1204 | * @param {Number} index A cell's numeric index |
|
1233 | * @param {Number} index A cell's numeric index | |
1205 | */ |
|
1234 | */ | |
1206 |
Notebook.prototype. |
|
1235 | Notebook.prototype.clear_output = function (index) { | |
1207 | var i = this.index_or_selected(index); |
|
1236 | var i = this.index_or_selected(index); | |
1208 | this.get_cell(i).toggle_output_scroll(); |
|
1237 | var cell = this.get_cell(i); | |
|
1238 | if (cell !== null && (cell instanceof IPython.CodeCell)) { | |||
|
1239 | cell.clear_output(); | |||
|
1240 | this.set_dirty(true); | |||
|
1241 | } | |||
1209 | }; |
|
1242 | }; | |
1210 |
|
1243 | |||
1211 | /** |
|
1244 | /** | |
1212 |
* |
|
1245 | * Clear each code cell's output area. | |
1213 | * |
|
1246 | * | |
1214 |
* @method c |
|
1247 | * @method clear_all_output | |
1215 | */ |
|
1248 | */ | |
1216 |
Notebook.prototype.c |
|
1249 | Notebook.prototype.clear_all_output = function () { | |
1217 | var ncells = this.ncells(); |
|
1250 | var ncells = this.ncells(); | |
1218 | var cells = this.get_cells(); |
|
1251 | var cells = this.get_cells(); | |
1219 | for (var i=0; i<ncells; i++) { |
|
1252 | for (var i=0; i<ncells; i++) { | |
1220 | if (cells[i] instanceof IPython.CodeCell) { |
|
1253 | if (cells[i] instanceof IPython.CodeCell) { | |
1221 |
cells[i].output |
|
1254 | cells[i].clear_output(); | |
1222 | } |
|
1255 | } | |
1223 | }; |
|
1256 | }; | |
1224 | // this should not be set if the `collapse` key is removed from nbformat |
|
|||
1225 | this.set_dirty(true); |
|
1257 | this.set_dirty(true); | |
1226 | }; |
|
1258 | }; | |
1227 |
|
1259 | |||
1228 | /** |
|
1260 | /** | |
|
1261 | * Scroll the selected CodeCell's output area. | |||
|
1262 | * | |||
|
1263 | * @method scroll_output | |||
|
1264 | * @param {Number} index A cell's numeric index | |||
|
1265 | */ | |||
|
1266 | Notebook.prototype.scroll_output = function (index) { | |||
|
1267 | var i = this.index_or_selected(index); | |||
|
1268 | var cell = this.get_cell(i); | |||
|
1269 | if (cell !== null && (cell instanceof IPython.CodeCell)) { | |||
|
1270 | cell.scroll_output(); | |||
|
1271 | this.set_dirty(true); | |||
|
1272 | } | |||
|
1273 | }; | |||
|
1274 | ||||
|
1275 | /** | |||
1229 | * Expand each code cell's output area, and add a scrollbar for long output. |
|
1276 | * Expand each code cell's output area, and add a scrollbar for long output. | |
1230 | * |
|
1277 | * | |
1231 | * @method scroll_all_output |
|
1278 | * @method scroll_all_output | |
@@ -1235,49 +1282,40 b' var IPython = (function (IPython) {' | |||||
1235 | var cells = this.get_cells(); |
|
1282 | var cells = this.get_cells(); | |
1236 | for (var i=0; i<ncells; i++) { |
|
1283 | for (var i=0; i<ncells; i++) { | |
1237 | if (cells[i] instanceof IPython.CodeCell) { |
|
1284 | if (cells[i] instanceof IPython.CodeCell) { | |
1238 |
cells[i].output |
|
1285 | cells[i].scroll_output(); | |
1239 | cells[i].output_area.scroll_if_long(); |
|
|||
1240 | } |
|
1286 | } | |
1241 | }; |
|
1287 | }; | |
1242 | // this should not be set if the `collapse` key is removed from nbformat |
|
1288 | // this should not be set if the `collapse` key is removed from nbformat | |
1243 | this.set_dirty(true); |
|
1289 | this.set_dirty(true); | |
1244 | }; |
|
1290 | }; | |
1245 |
|
1291 | |||
1246 | /** |
|
1292 | /** Toggle whether a cell's output is collapsed or expanded. | |
1247 | * Expand each code cell's output area, and remove scrollbars. |
|
|||
1248 | * |
|
1293 | * | |
1249 |
* @method |
|
1294 | * @method toggle_output | |
|
1295 | * @param {Number} index A cell's numeric index | |||
1250 | */ |
|
1296 | */ | |
1251 |
Notebook.prototype. |
|
1297 | Notebook.prototype.toggle_output = function (index) { | |
1252 |
var |
|
1298 | var i = this.index_or_selected(index); | |
1253 |
var cell |
|
1299 | var cell = this.get_cell(i); | |
1254 | for (var i=0; i<ncells; i++) { |
|
1300 | if (cell !== null && (cell instanceof IPython.CodeCell)) { | |
1255 | if (cells[i] instanceof IPython.CodeCell) { |
|
1301 | cell.toggle_output(); | |
1256 | cells[i].output_area.expand(); |
|
|||
1257 | cells[i].output_area.unscroll_area(); |
|
|||
1258 | } |
|
|||
1259 | }; |
|
|||
1260 | // this should not be set if the `collapse` key is removed from nbformat |
|
|||
1261 | this.set_dirty(true); |
|
1302 | this.set_dirty(true); | |
|
1303 | } | |||
1262 | }; |
|
1304 | }; | |
1263 |
|
1305 | |||
1264 | /** |
|
1306 | /** | |
1265 |
* |
|
1307 | * Toggle a scrollbar for long cell outputs. | |
1266 | * |
|
1308 | * | |
1267 |
* @method |
|
1309 | * @method toggle_output_scroll | |
|
1310 | * @param {Number} index A cell's numeric index | |||
1268 | */ |
|
1311 | */ | |
1269 |
Notebook.prototype. |
|
1312 | Notebook.prototype.toggle_output_scroll = function (index) { | |
1270 |
var |
|
1313 | var i = this.index_or_selected(index); | |
1271 |
var cell |
|
1314 | var cell = this.get_cell(i); | |
1272 | for (var i=0; i<ncells; i++) { |
|
1315 | if (cell !== null && (cell instanceof IPython.CodeCell)) { | |
1273 | if (cells[i] instanceof IPython.CodeCell) { |
|
1316 | cell.toggle_output_scroll(); | |
1274 | cells[i].clear_output(); |
|
|||
1275 | // Make all In[] prompts blank, as well |
|
|||
1276 | // TODO: make this configurable (via checkbox?) |
|
|||
1277 | cells[i].set_input_prompt(); |
|
|||
1278 | } |
|
|||
1279 | }; |
|
|||
1280 | this.set_dirty(true); |
|
1317 | this.set_dirty(true); | |
|
1318 | } | |||
1281 | }; |
|
1319 | }; | |
1282 |
|
1320 | |||
1283 |
|
1321 |
@@ -151,39 +151,26 b' class="notebook_app"' | |||||
151 | <li id="run_all_cells_below" title="Run this cell and all cells below it"> |
|
151 | <li id="run_all_cells_below" title="Run this cell and all cells below it"> | |
152 | <a href="#">Run All Below</a></li> |
|
152 | <a href="#">Run All Below</a></li> | |
153 | <li class="divider"></li> |
|
153 | <li class="divider"></li> | |
154 |
<li id="c |
|
154 | <li id="current_outputs" class="dropdown-submenu"><a href="#">Current Output</a> | |
155 | title="All cells in the notebook have a cell type. By default, new cells are created as 'Code' cells"> |
|
|||
156 | <a href="#">Cell Type</a> |
|
|||
157 | <ul class="dropdown-menu"> |
|
155 | <ul class="dropdown-menu"> | |
158 | <li id="to_code" |
|
156 | <li id="collapse_current_output"><a href="#">Collapse</a></li> | |
159 | title="Contents will be sent to the kernel for execution, and output will display in the footer of cell"> |
|
157 | <li id="expand_current_output"><a href="#">Expand</a></li> | |
160 | <a href="#">Code</a></li> |
|
158 | <li id="clear_current_output" | |
161 | <li id="to_markdown" |
|
159 | title="Clear the output portion of the current cell"> | |
162 | title="Contents will be rendered as HTML and serve as explanatory text"> |
|
160 | <a href="#">Clear</a> | |
163 |
|
|
161 | </li> | |
164 | <li id="to_raw" |
|
162 | <li id="scroll_current_output"><a href="#">Scroll Long</a></li> | |
165 | title="Contents will pass through nbconvert unmodified"> |
|
|||
166 | <a href="#">Raw NBConvert</a></li> |
|
|||
167 | <li id="to_heading1"><a href="#">Heading 1</a></li> |
|
|||
168 | <li id="to_heading2"><a href="#">Heading 2</a></li> |
|
|||
169 | <li id="to_heading3"><a href="#">Heading 3</a></li> |
|
|||
170 | <li id="to_heading4"><a href="#">Heading 4</a></li> |
|
|||
171 | <li id="to_heading5"><a href="#">Heading 5</a></li> |
|
|||
172 | <li id="to_heading6"><a href="#">Heading 6</a></li> |
|
|||
173 | </ul> |
|
163 | </ul> | |
174 | </li> |
|
164 | </li> | |
175 | <li class="divider"></li> |
|
|||
176 | <li id="toggle_output" |
|
|||
177 | title="Show/Hide the output portion of a Code cell"> |
|
|||
178 | <a href="#">Toggle Current Output</a></li> |
|
|||
179 | <li id="all_outputs" class="dropdown-submenu"><a href="#">All Output</a> |
|
165 | <li id="all_outputs" class="dropdown-submenu"><a href="#">All Output</a> | |
180 | <ul class="dropdown-menu"> |
|
166 | <ul class="dropdown-menu"> | |
181 | <li id="expand_all_output"><a href="#">Expand</a></li> |
|
|||
182 | <li id="scroll_all_output"><a href="#">Scroll Long</a></li> |
|
|||
183 | <li id="collapse_all_output"><a href="#">Collapse</a></li> |
|
167 | <li id="collapse_all_output"><a href="#">Collapse</a></li> | |
|
168 | <li id="expand_all_output"><a href="#">Expand</a></li> | |||
184 | <li id="clear_all_output" |
|
169 | <li id="clear_all_output" | |
185 |
title=" |
|
170 | title="Clear the output portion of all Code cells"> | |
186 |
<a href="#">Clear</a> |
|
171 | <a href="#">Clear</a> | |
|
172 | </li> | |||
|
173 | <li id="scroll_all_output"><a href="#">Scroll Long</a></li> | |||
187 | </ul> |
|
174 | </ul> | |
188 | </li> |
|
175 | </li> | |
189 | </ul> |
|
176 | </ul> |
General Comments 0
You need to be logged in to leave comments.
Login now