Define prestart attribute on ButtonMark to place buttons before start

This commit is contained in:
2025-08-23 00:33:54 +01:00
parent b8d8cb8fb7
commit 5a25e325f3
4 changed files with 25 additions and 5 deletions

11
gig.py
View File

@@ -52,6 +52,8 @@ class EventRunner:
if self._playing is not None:
return self.activate()
elif self._selected is not None:
if self._next_button_is_prestart:
return self.activate()
self.play()
return True
return False
@@ -77,6 +79,7 @@ class EventRunner:
print("Scheduled event {} at {} ({} from now)".format(event, event.at, event.at - now))
event.scheduled = True
self._next_button = self._currentitem.get_next_button()
self._next_button_is_prestart = self._currentitem.is_button_prestart(self._next_button)
return True
def stop(self):
@@ -127,7 +130,10 @@ class EventRunner:
button = "Select next"
elif self._selected is not None:
status = 'Selected {}'.format(self.get_item().get_title())
button = "Play"
if (self._next_button is not None) and self._next_button_is_prestart:
button = "Marker {}".format(self._next_button)
else:
button = "Play"
else:
status = 'Waiting'
button = "Select"
@@ -249,7 +255,8 @@ class MainWindow(pyglet.window.Window):
self.update_cursor(self._cursorpos + 1)
self._eventrunner.select(self._cursorpos)
elif self._selectpos == self._cursorpos:
self._eventrunner.play()
if not self._eventrunner.advance():
self._eventrunner.play()
else:
self._eventrunner.select(self._cursorpos)
self.update_objects()