From 02db65fcc81f1c0e7386a0ce1d67163afa242603 Mon Sep 17 00:00:00 2001 From: Gavan Fantom Date: Sat, 23 Aug 2025 22:29:59 +0100 Subject: [PATCH] Unschedule any remaining scheduled items when a button is pressed This means that less confusion will reign if a button is pressed at the wrong time, and catch-up needs to happen. Randomly switching out lyrics/images for things scheduled from the previous tranche just leads to chaos. --- gig.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/gig.py b/gig.py index aedd1e7..0728862 100755 --- a/gig.py +++ b/gig.py @@ -70,6 +70,8 @@ class EventRunner: elif marker != 'select': return False self._selected = selected + else: + self.stop(full=False) now = time.time() if not self._currentitem.activate(marker, now): return False @@ -82,8 +84,11 @@ class EventRunner: self._next_button_is_prestart = self._currentitem.is_button_prestart(self._next_button) return True - def stop(self): + def stop(self, full=True): + print("Unscheduling events") pyglet.clock.unschedule(self.update) + if not full: + return self._playing = None self._selected = None for event in self._active: