Skip to content

Commit fe69c9e

Browse files
committed
added showAllFrameLabels option
1 parent 6ce850e commit fe69c9e

2 files changed

Lines changed: 11 additions & 4 deletions

File tree

v3/js/composingprograms.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ function executeCode(forceStartingInstr, forceRawInputLst) {
116116
executeCodeWithRawInputFunc: executeCodeWithRawInput,
117117
updateOutputCallback: function() {$('#urlOutput,#embedCodeOutput').val('');},
118118
compactFuncLabels: true,
119+
showAllFrameLabels: true,
119120
}
120121

121122
executePythonCode(pyInputCodeMirror.getValue(),

v3/js/pytutor.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ var curVisualizerID = 1; // global to uniquely identify each ExecutionVisualizer
110110
// highlightLines - highlight current and previously executed lines (default: false)
111111
// arrowLines - draw arrows pointing to current and previously executed lines (default: true)
112112
// compactFuncLabels - render functions with a 'func' prefix and no type label
113+
// showAllFrameLabels - display frame and parent frame labels for all functions (default: false)
113114
// pyCrazyMode - run with Py2crazy, which provides expression-level
114115
// granularity instead of line-level granularity (HIGHLY EXPERIMENTAL!)
115116
// hideCode - hide the code display and show only the data structure viz
@@ -192,8 +193,7 @@ function ExecutionVisualizer(domRootID, dat, params) {
192193
this.textualMemoryLabels = (this.params.textualMemoryLabels == true);
193194
this.showOnlyOutputs = (this.params.showOnlyOutputs == true);
194195
this.tabularView = (this.params.tabularView == true);
195-
196-
//this.tabularView = true; // for testing only
196+
this.showAllFrameLabels = (this.params.showAllFrameLabels == true);
197197

198198
this.executeCodeWithRawInputFunc = this.params.executeCodeWithRawInputFunc;
199199

@@ -2533,8 +2533,8 @@ ExecutionVisualizer.prototype.renderDataStructures = function(curEntry, curTople
25332533

25342534
var headerLabel = funcName;
25352535

2536-
// only display if you're someone's parent
2537-
if (frame.is_parent) {
2536+
// only display if you're someone's parent (unless showAllFrameLabels)
2537+
if (frame.is_parent || myViz.showAllFrameLabels) {
25382538
headerLabel = 'f' + frame.frame_id + ': ' + headerLabel;
25392539
}
25402540

@@ -2543,6 +2543,9 @@ ExecutionVisualizer.prototype.renderDataStructures = function(curEntry, curTople
25432543
var parentFrameID = frame.parent_frame_id_list[0];
25442544
headerLabel = headerLabel + ' [parent=f' + parentFrameID + ']';
25452545
}
2546+
else if (myViz.showAllFrameLabels) {
2547+
headerLabel = headerLabel + ' [parent=Global]';
2548+
}
25462549

25472550
return headerLabel;
25482551
});
@@ -3388,6 +3391,9 @@ function(objID, stepNum, d3DomElement, isTopLevel) {
33883391
if (parentFrameID) {
33893392
d3DomElement.append('<div class="funcObj">' + funcPrefix + ' ' + funcName + ' [parent=f'+ parentFrameID + ']</div>');
33903393
}
3394+
else if (myViz.showAllFrameLabels) {
3395+
d3DomElement.append('<div class="funcObj">' + funcPrefix + ' ' + funcName + ' [parent=Global]</div>');
3396+
}
33913397
else {
33923398
d3DomElement.append('<div class="funcObj">' + funcPrefix + ' ' + funcName + '</div>');
33933399
}

0 commit comments

Comments
 (0)