From 2f13099bda51bc5295000ab8db1ebd8c179a9dc6 Mon Sep 17 00:00:00 2001 From: Keith Edmunds Date: Tue, 25 Oct 2022 07:46:14 +0100 Subject: [PATCH] Don't allow cart click while that cart is playing. --- app/musicmuster.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/musicmuster.py b/app/musicmuster.py index 75a5a9f..588ef6e 100755 --- a/app/musicmuster.py +++ b/app/musicmuster.py @@ -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)