Show on the button what a hold is doing.

A hold now turns the button blue with FIXING <what> while the fix runs, then
CHECKING for 20 s (green if it worked, back to the alarm if not), orange FIX
FAILED if the command failed, and grey NOTHING TO FIX or JUST TRIED / WAIT 1
MIN so a hold always visibly registers. The page redraws as soon as a command
arrives instead of on the next 1 s tick.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-08 11:41:44 -04:00
co-authored by Claude Opus 5.5
parent 51f09900ab
commit 10466cae80
3 changed files with 100 additions and 16 deletions
+39
View File
@@ -499,6 +499,45 @@ class TestFixes(unittest.TestCase):
time.sleep(0.2)
self.assertEqual(ran, ["ableton", "ableton"])
def test_hold_feedback_on_the_button(self):
devices = json.loads(self.snap.vars[("audinate-dantecontroller", "devices")])
devices.remove("NA-ProPresenter-Mac")
self.snap.vars[("audinate-dantecontroller", "devices")] = json.dumps(devices)
gate = threading.Event()
outcome = {"ok": True}
def slow_fix(cfg, fix_id, chk):
gate.wait(2)
return outcome["ok"]
self.engine.executor = slow_fix
_, t = run_steps(self.engine, self.snap, SUNDAY, 4)
self.engine.run_fixes("dante", self.snap, None, t)
tiles = self.engine.step(self.snap, t)
self.assertEqual((tiles["dante"]["x"], level(tiles["dante"])), ("DANTE\nFIXING\nDVS", "fixing"))
gate.set()
time.sleep(0.2)
tiles = self.engine.step(self.snap, time.time())
self.assertEqual((tiles["dante"]["x"], level(tiles["dante"])), ("DANTE\nCHECKING\nDVS", "fixing"))
tiles = self.engine.step(self.snap, time.time() + 25) # still gone: back to the alarm
self.assertEqual(tiles["dante"]["x"], "DANTE\nPROP MAC GONE")
# held again within a minute
self.engine.run_fixes("dante", self.snap, None, t + 30)
self.assertEqual(self.engine.notes["dante"]["text"], "JUST TRIED\nWAIT 1 MIN")
# a fix whose command fails says so
outcome["ok"] = False
self.engine.run_fixes("dante", self.snap, None, t + 100)
time.sleep(0.2)
tiles = self.engine.step(self.snap, time.time())
self.assertEqual((tiles["dante"]["x"], level(tiles["dante"])), ("DANTE\nFIX FAILED\nDVS", "failed"))
def test_hold_on_a_green_button_says_so(self):
_, t = run_steps(self.engine, self.snap, SUNDAY, 2)
self.engine.run_fixes("x32", self.snap, None, t)
tiles = self.engine.step(self.snap, t + 1)
self.assertEqual((tiles["x32"]["x"], level(tiles["x32"])), ("X32\nNOTHING\nTO FIX", "idle"))
tiles = self.engine.step(self.snap, t + 5)
self.assertEqual(tiles["x32"]["x"], "X32\nOK")
def test_remote_script_round_trip(self):
script = sp.remote_script(["pgrep -xq Live", "pgrep -xq 'Church Translate'"])
self.assertIn("(pgrep -xq 'Church Translate') >/dev/null 2>&1; echo SP1=$?", script)