Skip to content

fix(gui): rehearse the video that is loaded, not a second one - #143

Open
gbradham wants to merge 1 commit into
mainfrom
fix/rehearse-uses-loaded-video
Open

fix(gui): rehearse the video that is loaded, not a second one#143
gbradham wants to merge 1 commit into
mainfrom
fix/rehearse-uses-loaded-video

Conversation

@gbradham

Copy link
Copy Markdown
Member

Asked what video a rehearsal plays, the honest answer was "a different one, if you're not careful."

Rehearse from video… always opened its own file picker and ignored whatever the camera panel already had open. So you could load a clip, draw zones over it, scrub through it — and then rehearse something else entirely, with the scrub bar, preview and zones all describing a clip the pump wasn't playing. Nothing on screen would have shown the mismatch.

The fix

Plays the loaded video when there is one; prompts only when there isn't. A file chosen at that prompt is loaded into the panel properly rather than handed to the pump alone, so there is one open video and everything refers to it.

The button says which:

Before After
Rehearse from video… Rehearse session12.mp4

The first is a question, the second is an answer — and next to an already-loaded clip, the question was the whole problem. The label is left alone mid-run, where the button reads Stop rehearsal and is the only way to stop hardware that's being driven.

Also: the third break of the same two tests

test_behavior_input_editor.py hand-builds a CameraPanel field by field, because the real __init__ starts threads and opens cameras. Those two tests have now broken three times because _on_behavior_ready gained an attribute they didn't know to set — the vocabulary bus, then the rehearse button, now the video source.

The list of what a panel needs is consolidated into one _ready_panel() helper, so the next addition is one edit rather than one per test. That is the actual defect; patching the assertions again would have guaranteed a fourth time.

Tests — 7 new

Plays the loaded video; prompts only when nothing is loaded; a chosen file is loaded into the panel too; a file that won't load isn't rehearsed; the button names the video; it asks when nothing is loaded; and the label is left alone mid-rehearsal.

Verification

PYTHONPATH=src QT_QPA_PLATFORM=offscreen pytest tests/3655 passed, 4 skipped, ruff and black clean.

"Rehearse from video..." always opened its own file picker and ignored whatever
the camera panel already had open. Asked what video a rehearsal plays, the
honest answer was "a different one, if you are not careful" -- and nothing on
screen would have shown it. The scrub bar, the preview and any zones drawn over
them would all be describing a clip the pump was not playing.

It now plays the loaded video when there is one, and only prompts when there is
not. A file chosen at the prompt is loaded into the panel properly rather than
handed to the pump alone, so one video is open and everything refers to it.

The button says which: "Rehearse session12.mp4" rather than "Rehearse from
video...". The first is an answer, the second is a question, and next to a
loaded clip the question was the whole problem. It leaves the label alone
mid-run, where the button reads "Stop rehearsal" and is the only way to stop
hardware that is being driven.

Also consolidates the hand-built CameraPanel the behavior tests construct into
one helper. Those two tests have now broken three times because
_on_behavior_ready gained an attribute they did not know to set; the list of
what a panel needs belongs in one place.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant