diff --git a/wobuzz/gui_communication/track_control.py b/wobuzz/gui_communication/track_control.py index b5d5b57..887f4bf 100644 --- a/wobuzz/gui_communication/track_control.py +++ b/wobuzz/gui_communication/track_control.py @@ -1,6 +1,7 @@ #!/usr/bin/python3 from PyQt6.QtCore import QTimer +from PyQt6.QtGui import QIcon PROGRESS_UPDATE_RATE = 60 PROGRESS_UPDATE_INTERVAL = 1000 // PROGRESS_UPDATE_RATE @@ -16,6 +17,9 @@ class TrackControl: self.track_control = self.app.gui.window.track_control self.track_progress_slider = self.track_control.track_progress_slider + self.play_icon = QIcon.fromTheme(QIcon.ThemeIcon.MediaPlaybackStart) + self.pause_icon = QIcon.fromTheme(QIcon.ThemeIcon.MediaPlaybackPause) + self.progress_update_timer = QTimer() self.progress_update_timer.timeout.connect(self.update_progress) self.progress_update_timer.start(PROGRESS_UPDATE_INTERVAL) @@ -83,12 +87,15 @@ class TrackControl: self.track_control.track_progress_slider.setValue(0) def toggle_playing(self): - if self.app.player.playing and self.app.player.paused: + if self.app.player.playing and self.app.player.paused: # paused self.app.player.unpause() + self.track_control.toggle_play_button.setIcon(self.pause_icon) - elif self.app.player.playing: + elif self.app.player.playing: # playing self.app.player.pause() + self.track_control.toggle_play_button.setIcon(self.play_icon) - elif len(self.app.player.current_playlist) > 0: + elif len(self.app.player.current_playlist) > 0: # stopped but tracks in the current playlist self.app.player.start_playing() + self.track_control.toggle_play_button.setIcon(self.pause_icon)