Skip to content

Commit 27b16b0

Browse files
committed
added demo.html
1 parent a7a05f6 commit 27b16b0

3 files changed

Lines changed: 54 additions & 0 deletions

File tree

‎v3/demo.html‎

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2+
<html xmlns="http://www.w3.org/1999/xhtml">
3+
4+
<!--
5+
6+
Usage: Put a valid trace file in test-trace.js, and it will render when
7+
you load this file. see here for directions:
8+
9+
https://github.com/pgbovine/OnlinePythonTutor/blob/master/v3/docs/opt-trace-format.md#interlude-viewing-a-trace-in-the-opt-frontend
10+
11+
-->
12+
13+
<head>
14+
<title>Online Python Tutor embedding demo</title>
15+
16+
<!-- dependencies for pytutor.js -->
17+
<script type="text/javascript" src="js/d3.v2.min.js"></script>
18+
<script type="text/javascript" src="js/jquery-1.8.2.min.js"></script>
19+
<script type="text/javascript" src="js/jquery.simplemodal.js"></script> <!-- for questions -->
20+
<script type="text/javascript" src="js/jquery.ba-bbq.min.js"></script> <!-- for handling back button and URL hashes -->
21+
<script type="text/javascript" src="js/jquery.jsPlumb-1.3.10-all-min.js "></script> <!-- for rendering SVG connectors
22+
DO NOT UPGRADE ABOVE 1.3.10 OR ELSE BREAKAGE WILL OCCUR -->
23+
<script type="text/javascript" src="js/jquery-ui-1.8.24.custom.min.js"></script> <!-- for sliders and other UI elements -->
24+
<link type="text/css" href="css/ui-lightness/jquery-ui-1.8.24.custom.css" rel="stylesheet" />
25+
<link type="text/css" href="css/basic.css" rel="stylesheet" />
26+
27+
<!-- Python Tutor frontend code and styles -->
28+
<script type="text/javascript" src="js/pytutor.js"></script>
29+
<link rel="stylesheet" href="css/pytutor.css"/>
30+
31+
32+
<!-- This JavaScript file contains the demo code - READ IT!!!
33+
(Include this file AFTER all of its dependencies.)
34+
-->
35+
<script type="text/javascript" src="test-trace.js"></script>
36+
<script type="text/javascript">
37+
$(document).ready(function() {
38+
var myViz = new ExecutionVisualizer('myDiv', trace /* from test-trace.js */,
39+
{debugMode: true});
40+
});
41+
</script>
42+
43+
</head>
44+
45+
<body>
46+
<div id="myDiv"></div>
47+
</body>
48+
</html>

‎v3/js/pytutor.js‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ var curVisualizerID = 1; // global to uniquely identify each ExecutionVisualizer
115115
// granularity instead of line-level granularity (HIGHLY EXPERIMENTAL!)
116116
// hideCode - hide the code display and show only the data structure viz
117117
// tabularView - render a tabular view of ALL steps at once (EXPERIMENTAL)
118+
// debugMode - some extra debugging printouts
118119
function ExecutionVisualizer(domRootID, dat, params) {
119120
this.curInputCode = dat.code.rtrim(); // kill trailing spaces
120121
this.curTrace = dat.trace;
@@ -1394,6 +1395,10 @@ ExecutionVisualizer.prototype.updateOutputFull = function(smoothTransition) {
13941395
$('#'+curEntry.question.div).modal({position:["25%","50%"]});
13951396
}
13961397

1398+
if (myViz.params.debugMode) {
1399+
console.log('updateOutputFull', curEntry);
1400+
}
1401+
13971402
// render VCR controls:
13981403
var totalInstrs = this.curTrace.length;
13991404

‎v3/test-trace.js‎

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)