Don't allow cart click while that cart is playing.

This commit is contained in:
Keith Edmunds 2022-10-25 07:46:14 +01:00
parent 9ccff3db20
commit 2f13099bda

View File

@ -188,7 +188,10 @@ class Window(QMainWindow, Ui_MainWindow):
"""Handle cart click"""
btn = self.sender()
if helpers.file_is_readable(btn.path):
# Don't allow clicks while we're playing
btn.setEnabled(False)
btn.player.play()
btn.is_playing = True
colour = Config.COLOUR_CART_PLAYING
@ -272,6 +275,7 @@ class Window(QMainWindow, Ui_MainWindow):
if not btn.player.is_playing():
# Cart has finished playing
btn.is_playing = False
btn.setEnabled(True)
# Setting to position 0 doesn't seem to work
btn.player = self.music.VLC.media_player_new(btn.path)
btn.player.audio_set_volume(Config.VOLUME_VLC_DEFAULT)