Skip to content

Commit 61320a1

Browse files
committed
Merge pull request #57 from mmmicedcoffee/master
added holistic experimental mode
2 parents 8866dfc + fd713f1 commit 61320a1

5 files changed

Lines changed: 651 additions & 16 deletions

File tree

‎v3/css/holistic.css‎

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
div.HolisticVisualizer div#debug::-webkit-scrollbar {
2+
width:9px;
3+
}
4+
5+
div.HolisticVisualizer div#debug::-webkit-scrollbar-track {
6+
-webkit-border-radius:5px;
7+
border-radius:5px;
8+
background:rgba(0,0,0,0.1);
9+
}
10+
11+
div.HolisticVisualizer div#debug::-webkit-scrollbar-thumb {
12+
-webkit-border-radius:5px;
13+
border-radius:5px;
14+
background:rgba(0,0,0,0.2);
15+
}
16+
17+
div.HolisticVisualizer div#debug::-webkit-scrollbar-thumb:hover {
18+
background:rgba(0,0,0,0.4);
19+
}
20+
21+
div.HolisticVisualizer div#debug::-webkit-scrollbar-thumb:window-inactive {
22+
background:rgba(0,0,0,0.05);
23+
}
24+
25+
div.HolisticVisualizer {
26+
font-family: "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
27+
font-size: 16px;
28+
}
29+
30+
div.HolisticVisualizer pre {
31+
margin: 0;
32+
}
33+
34+
div.HolisticVisualizer div.control {
35+
border :1px solid black;
36+
border-radius: 5px;
37+
display: block;
38+
height: 100px;
39+
margin-bottom: 10px;
40+
margin-left: 50px;
41+
padding: 5px;
42+
width: 240px;
43+
}
44+
45+
div.HolisticVisualizer table {
46+
border-collapse: collapse;
47+
display: inline-block;
48+
font-family: Courier, monospace;
49+
margin-left: 50px;
50+
margin-top: 1px;
51+
vertical-align: top;
52+
}
53+
54+
div.HolisticVisualizer #code tr, div.HolisticVisualizer #code td {
55+
border-width: 0px;
56+
padding: 0px;
57+
}
58+
59+
div.HolisticVisualizer #code td:hover, div.HolisticVisualizer #code td.v-hover {
60+
background-color: #b0e0e6;
61+
}
62+
63+
div.HolisticVisualizer div#slider {
64+
border: 1px solid gray;
65+
display: inline-block;
66+
height: 100%;
67+
overflow-x: scroll;
68+
vertical-align: top;
69+
width: 500px;
70+
}
71+
72+
div.HolisticVisualizer div#debug-panel {
73+
display: inline-block;
74+
font-size: 10pt;
75+
height: 400px;
76+
vertical-align: top;
77+
width: 400px;
78+
}
79+
80+
div.HolisticVisualizer div#debug {
81+
height: 90%;
82+
overflow: -moz-scrollbars-vertical;
83+
overflow-y: scroll;
84+
}
85+
86+
div.HolisticVisualizer path {
87+
stroke: steelblue;
88+
stroke-width: 1;
89+
fill: none;
90+
}
91+
92+
div.HolisticVisualizer .delimiter {
93+
stroke: black;
94+
stroke-opacity: 0.8;
95+
stroke-width: 1px;
96+
}
97+
98+
div.HolisticVisualizer .h-hover {
99+
fill-opacity: 0;
100+
stroke: black;
101+
stroke-opacity: 0;
102+
stroke-width: 20px;
103+
}
104+
105+
div.HolisticVisualizer .v-hover {
106+
fill-opacity: 0;
107+
}
108+
109+
div.HolisticVisualizer .v-guide, div.HolisticVisualizer .h-guide {
110+
stroke: black;
111+
stroke-opacity: 0.4;
112+
stroke-width: 1px;
113+
}
114+
115+
div.HolisticVisualizer .axis path,
116+
div.HolisticVisualizer .axis line {
117+
fill: none;
118+
stroke: black;
119+
shape-rendering: crispEdges;
120+
}
121+
122+
div.HolisticVisualizer .axis text {
123+
font-family: sans-serif;
124+
font-size: 11px;
125+
}

‎v3/js/holistic.js‎

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

‎v3/js/opt-frontend-common.js‎

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -125,24 +125,29 @@ function executePythonCode(pythonSourceCode,
125125
if (frontendOptionsObj.startingInstruction >= trace.length) {
126126
frontendOptionsObj.startingInstruction = 0;
127127
}
128-
myVisualizer = new ExecutionVisualizer(outputDiv, dataFromBackend, frontendOptionsObj);
129-
130-
// set keyboard bindings
131-
// VERY IMPORTANT to clear and reset this every time or
132-
// else the handlers might be bound multiple times
133-
$(document).unbind('keydown');
134-
$(document).keydown(function(k) {
135-
if (k.keyCode == 37) { // left arrow
136-
if (myVisualizer.stepBack()) {
137-
k.preventDefault(); // don't horizontally scroll the display
128+
129+
if (frontendOptionsObj.holisticMode) {
130+
myVisualizer = new HolisticVisualizer(outputDiv, dataFromBackend, frontendOptionsObj);
131+
} else {
132+
myVisualizer = new ExecutionVisualizer(outputDiv, dataFromBackend, frontendOptionsObj);
133+
134+
// set keyboard bindings
135+
// VERY IMPORTANT to clear and reset this every time or
136+
// else the handlers might be bound multiple times
137+
$(document).unbind('keydown');
138+
$(document).keydown(function(k) {
139+
if (k.keyCode == 37) { // left arrow
140+
if (myVisualizer.stepBack()) {
141+
k.preventDefault(); // don't horizontally scroll the display
142+
}
138143
}
139-
}
140-
else if (k.keyCode == 39) { // right arrow
141-
if (myVisualizer.stepForward()) {
142-
k.preventDefault(); // don't horizontally scroll the display
144+
else if (k.keyCode == 39) { // right arrow
145+
if (myVisualizer.stepForward()) {
146+
k.preventDefault(); // don't horizontally scroll the display
147+
}
143148
}
144-
}
145-
});
149+
});
150+
}
146151

147152
handleSuccessFunc();
148153
}

‎v3/js/opt-frontend.js‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ $(document).ready(function() {
177177

178178
// undocumented experimental modes:
179179
pyCrazyMode: ($('#pythonVersionSelector').val() == '2crazy'),
180+
holisticMode: ($('#cumulativeModeSelector').val() == 'holistic')
180181
//allowEditAnnotations: true,
181182
}
182183

‎v3/visualize.html‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@
5050
<script type="text/javascript" src="js/pytutor.js"></script>
5151
<link rel="stylesheet" href="css/pytutor.css"/>
5252

53+
<script type="text/javascript" src="js/holistic.js"></script>
54+
<link rel="stylesheet" href="css/holistic.css"/>
5355

5456
<!-- requirements for opt-frontend.js -->
5557

@@ -83,6 +85,7 @@
8385
<select id="cumulativeModeSelector">
8486
<option value="false">hide frames of exited functions</option>
8587
<option value="true">show frames of exited functions</option>
88+
<option value="holistic">holistic mode (experimental)</option>
8689
</select>,
8790
<select id="heapPrimitivesSelector">
8891
<option value="false">inline primitives and nested objects</option>

0 commit comments

Comments
 (0)