def emit_state_changed(self, type, player, object): """ Called from main to emit signal """ new_state = player.get_state() if self.cached_state != new_state: self.cached_state = new_state self.StateChanged()
def PlayPause(self): player = xl.player.PLAYER state = player.get_state() if state in ('playing', 'paused'): player.toggle_pause() else: assert state == 'stopped' queue = xl.player.QUEUE queue.play(queue.get_current())
def Play(self): player = xl.player.PLAYER state = player.get_state() if state == 'paused': player.unpause() elif state == 'stopped': queue = xl.player.QUEUE queue.play(queue.get_current()) else: assert state == 'playing' # Don't need to do anything
def playpause(player): if player.get_state() in ('playing', 'paused'): player.toggle_pause() else: from xlgui import main page = main.get_selected_playlist() if page: pl = page.playlist if len(pl) == 0: return try: idx = page.view.get_selected_paths()[0][0] except IndexError: idx = 0 player.queue.set_current_playlist(pl) pl.current_position = idx player.queue.play(track=pl.current)