def play_pause(): """ Called when the Play/Pause button is pressed. Starts/stops/resumes a song. """ if not Playlist.is_playing(): play_pause_btn.setText("Pause") Playlist.play() now_playing_text.show() if not current_song_text.isVisible(): current_song_text.setText("{}".format(Playlist.get_current_song())) current_song_text.show() else: play_pause_btn.setText("Play") Playlist.pause() now_playing_text.hide()
def play_entry(label): """ Called to trigger the playing/pausing of a specific entry, given its label. This also sets specific buttons and labels to appropriate states to reflect the change. :param label: The label containing the name of the entry to be played or paused. :return: """ Playlist.play_song(label) if not Playlist.is_playing(): user_interface.GUI.play_pause_btn.setText("Pause") user_interface.GUI.now_playing_text.show() user_interface.GUI.current_song_text.setText("{}".format(label.text())) if not user_interface.GUI.current_song_text.isVisible(): user_interface.GUI.current_song_text.show() else: user_interface.GUI.play_pause_btn.setText("Play") Playlist.pause() user_interface.GUI.now_playing_text.hide()