diff options
Diffstat (limited to 'player_mock.py')
-rw-r--r-- | player_mock.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/player_mock.py b/player_mock.py index 5aad769..92da675 100644 --- a/player_mock.py +++ b/player_mock.py @@ -9,15 +9,25 @@ class Player(): self.position = 0.0 self.volume = 1.0 self.currentSong = None + self.playingStateChangedCallback = None def play(self): + previousState = self.state self.state = Player.PLAYING + if previousState != Player.PLAYING: + self.playingStateChangedCallback() def stop(self): + previousState = self.state self.state = Player.STOPPED + if previousState != Player.STOPPED: + self.playingStateChangedCallback() def pause(self): + previousState = self.state self.state = Player.PAUSED + if previousState != Player.PAUSED: + self.playingStateChangedCallback() def isPlaying(self): return self.state == Player.PLAYING @@ -43,3 +53,8 @@ class Player(): def setCurrentSong(self, path): self.currentSong = path + def setPlayingStateChangedCallback(self, callback): + self.playingStateChangedCallback = callback + + def simulatePlayingStateChanged(self): + self.playingStateChangedCallback() |