diff options
| author | Cliff Click <cliffc@acm.org> | 2026-10-04 13:30:41 -0700 |
|---|---|---|
| committer | Cliff Click <cliffc@acm.org> | 2026-10-04 13:30:41 -0700 |
| commit | a4994371c0b0fbea9d2802acc22d9cc3977a0de0 (patch) | |
| tree | 98fd05869028a931f5ec8cf503b5cdf6b6c52e87 /graph | |
| parent | 9149ea7a50c564856bd09633f38d980e8230c34f (diff) | |
| download | Simple-a4994371c0b0fbea9d2802acc22d9cc3977a0de0.tar.gz Simple-a4994371c0b0fbea9d2802acc22d9cc3977a0de0.zip | |
Slides for 2026 REBASEreadme
Diffstat (limited to 'graph')
| -rw-r--r-- | graph/README.md | 2 | ||||
| -rw-r--r-- | graph/test_browser.py | 3 | ||||
| -rw-r--r-- | graph/web/viewer.js | 4 |
3 files changed, 6 insertions, 3 deletions
diff --git a/graph/README.md b/graph/README.md index d52ecfeb..8577f509 100644 --- a/graph/README.md +++ b/graph/README.md @@ -28,7 +28,7 @@ python -m http.server 8000 --bind 127.0.0.1 --directory graph/web Then launch Java with `-Dsimple.graph.url=http://127.0.0.1:8000/index.html`. The compiler WebSocket still uses port 12345; run one viewer session at a time. -The initial program compiles on connection. For another program, click **Compile** +The viewer starts idle. Enter a program and click **Compile** or press **Ctrl+Enter** (**Cmd+Enter** on macOS). Use the arrows to step through frames (Left/Right arrow keys perform the same steps, including animation stages), the first/last buttons to jump to either end, or enter a frame number diff --git a/graph/test_browser.py b/graph/test_browser.py index aa1015e1..b95e4555 100644 --- a/graph/test_browser.py +++ b/graph/test_browser.py @@ -55,6 +55,9 @@ def check(chapter, browser_name): return raise AssertionError("Peephole did not reach a stable frame") page.goto(url) + page.wait_for_function('connection === "Connected" && rendererReady') + assert page.evaluate('!compiling && !done && frames.length === 0') + page.locator("#compile").click() page.wait_for_function("done && current === 0 && !rendering", timeout=15000) assert page.locator("#graph svg g.node").count() > 0 assert page.locator("#doPrev").is_disabled() diff --git a/graph/web/viewer.js b/graph/web/viewer.js index 6309deae..4412817e 100644 --- a/graph/web/viewer.js +++ b/graph/web/viewer.js @@ -71,7 +71,7 @@ function updateUI() { status.textContent = failure || (connection !== "Connected" ? connection : !rendererReady ? "Connected; initializing graph renderer..." : busy ? busy : compiling ? "Compiling... " + frames.length + " frames received" : - done ? frames.length + " frames ready" : "Connected"); + done ? frames.length + " frames ready" : "Ready. Enter a program and click Compile."); const at = wanted >= 0 ? wanted : current; if (document.activeElement !== frameNo) frameNo.value = String(at + 1); frameNo.max = scrub.max = String(Math.max(1, frames.length)); @@ -365,7 +365,7 @@ try { socket.onmessage = event => { const message = event.data; if (message === "!") { - get_program(); + updateUI(); } else if (message === "#") { done = true; compiling = false; |
