Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions scripts/course/course.toml
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,12 @@ label = "2.1"
slug = "the-station-screen"
title = "The station screen — one machine at arm's length"
one_line = "State, queue, booking output, issuing material, a quality check, what maintenance is owed."
outcomes = [
"Read one machine on its station screen: its state, its queue of released work, and what maintenance is owed.",
"Book good and scrap against the order at the head of its queue, issue a lot, and record a quality reading.",
"Say why only released work can be booked at a station, and why a typed count is the operator's word.",
]
scene = "scripts/scenes/course/03-01-the-station-screen.toml"

[[module.lesson]]
order = 2
Expand Down
23 changes: 23 additions & 0 deletions scripts/record-scene.py
Original file line number Diff line number Diff line change
Expand Up @@ -809,6 +809,29 @@ def scroll_to(self, selector: str, block: str, offset: int, text: str | None = N
}""",
[selector, block, offset, text],
)
# A row at the very foot of a short page cannot reach its offset, and
# can be left under the caption bar: the station screen's "Nothing owed
# on this machine" in the second take of class 2.1. Room is added below
# the page, as `clear_of_caption` adds it, and the row is lifted clear,
# but never higher than the offset the scene asked for, so a row that
# reached its offset, or a panel taller than the window, stays put.
self.page.evaluate(
"""([selector, offset, text, bar]) => {
const nodes = [...document.querySelectorAll(selector)];
const node = text ? nodes.find((n) => (n.innerText || '').includes(text)) : nodes[0];
const box = node.getBoundingClientRect();
const lift = Math.min(box.bottom - (window.innerHeight - bar), box.top - offset);
if (lift <= 0) return;
if (!document.getElementById('fs-scene-room')) {
const room = document.createElement('div');
room.id = 'fs-scene-room';
room.style.height = (2 * bar) + 'px';
document.body.appendChild(room);
}
window.scrollBy(0, lift);
}""",
[selector, offset, text, CAPTION_HEIGHT * 2],
)
self.page.wait_for_timeout(int(SCROLL_SECONDS * 1000))
to_y = self.page.evaluate("() => Math.round(window.scrollY)")
# Page pixels, the window's scroll: a box that scrolls inside the page
Expand Down
Loading
Loading