Change lable to 'pause' in the play button when something is playing

This commit is contained in:
2019-04-25 08:48:19 -05:00
parent afc4c0ca1f
commit 8c03601bd2
2 changed files with 25 additions and 0 deletions

View File

@@ -55,6 +55,18 @@ class audioPlayer(object):
pub.subscribe(self.play_previous, "play-previous")
pub.subscribe(self.seek, "seek")
# Stopped has a special function here, hence the decorator
# when stopped will be set to True, it will send a pubsub event to inform other parts of the application about the status change.
# this is useful for changing labels between play and pause, and so on, in buttons.
@property
def stopped(self):
return self._stopped
@stopped.setter
def stopped(self, value):
self._stopped = value
pub.sendMessage("playback-changed", stopped=value)
def play(self, object, set_info=True, fresh=False):
""" Play an URl Stream.
@object dict: typically an audio object as returned by VK, with a "url" component which must be a valid URL to a media file.