def show(self): """ Displays the screen. """ self.components['screen_nav'].radio_mode_set(mpd.radio_mode_get()) self.components['lbl_time_current'].text_set( mpd.now_playing.time_current) self.components['lbl_time_total'].text_set(mpd.now_playing.time_total) if mpd.player_control_get() == 'play': self.components['btn_play'].set_image_file(theme.icon.pause) else: self.components['btn_play'].set_image_file(theme.icon.play) self.components['btn_play'].draw() self.components['lbl_track_title'].text_set(mpd.now_playing.title) self.components['lbl_track_artist'].text_set(mpd.now_playing.artist) self.components['lbl_track_album'].text_set(mpd.now_playing.album) if mpd.radio_mode_get(): self.components['lbl_track_artist'].visible = False self.components['lbl_track_album'].position_set( ICO_WIDTH + 6, 3, SCREEN_WIDTH - 105, 39) self.components['pic_cover_art'].picture_set( theme.icon.cover_radio) else: self.components['lbl_track_artist'].visible = True self.components['lbl_track_artist'].text_set( mpd.now_playing.artist) self.components['lbl_track_album'].position_set( ICO_WIDTH + 6, 19, SCREEN_WIDTH - 105, 18) self.components['pic_cover_art'].picture_set( mpd.now_playing.cover_art_get()) super(ScreenPlaying, self).show() # Draw screen
def update(self): now_playing = mpd.now_playing self.components['screen_nav'].radio_mode_set(mpd.radio_mode_get()) while True: try: event = mpd.events.popleft() if event == 'volume': self.components['lbl_volume'].text_set( _('Vol: {0}%').format(mpd.volume)) elif event == 'playing_index': self.components['list_playing'].show_playlist() elif event == 'time_elapsed' or event == 'playing_time_total': self.components['lbl_time'].text_set('{0}/{1}'.format( now_playing.time_current, now_playing.time_total)) elif event == 'playing_file': self.components['lbl_track_title'].text_set( now_playing.title) self.components['lbl_track_artist'].text_set( now_playing.artist) elif event == 'state': state = mpd.player_control_get() if self.components[ 'btn_play'].image_file != theme.icon.pause and state == 'play': self.components['btn_play'].draw(theme.icon_pause) elif self.components[ 'btn_play'].image_file == theme.icon.pause and state != 'play': self.components['btn_play'].draw(theme.icon.play) except IndexError: break
def update(self): while True: try: event = mpd.events.popleft() self.components['screen_nav'].radio_mode_set( mpd.radio_mode_get()) playing = mpd.now_playing if event == 'time_elapsed': self.components['lbl_time_current'].text_set( playing.time_current) self.components['slide_time'].draw(playing.time_percentage) elif event == 'playing_file': self.components['lbl_track_title'].text_set(playing.title) if mpd.radio_mode_get(): self.components['lbl_track_artist'].visible = False self.components['lbl_track_album'].position_set( ICO_WIDTH + 6, 3, SCREEN_WIDTH - 105, 39) self.components['pic_cover_art'].picture_set( theme.icon.cover_radio) else: self.components['lbl_track_artist'].visible = True self.components['lbl_track_artist'].text_set( playing.artist) self.components['lbl_track_album'].position_set( ICO_WIDTH + 6, 19, SCREEN_WIDTH - 105, 18) self.components['pic_cover_art'].picture_set( mpd.now_playing.cover_art_get()) self.components['lbl_track_album'].text_set(playing.album) self.components['lbl_time_total'].text_set( playing.time_total) elif event == 'state': if self.components[ 'btn_play'].image_file != theme.icon.pause and mpd.player_control_get( ) == 'play': self.components['btn_play'].draw(theme.icon.pause) elif self.components[ 'btn_play'].image_file == theme.icon.pause and mpd.player_control_get( ) != 'play': self.components['btn_play'].draw(theme.icon.play) except IndexError: break
def on_click(self, x, y): """ :param x: The horizontal click position. :param y: The vertical click position. :return: Possibly returns a screen index number to switch to. """ tag_name = super(ScreenPlaylist, self).on_click(x, y) if tag_name == 'btn_player': return 0 elif tag_name == 'btn_playlist': return 1 elif tag_name == 'btn_library': return 2 elif tag_name == 'btn_directory': return 3 elif tag_name == 'btn_radio': return 4 elif tag_name == 'btn_settings': setting_screen = ScreenSettings(self.screen) setting_screen.show() self.show() elif tag_name == 'btn_play': if mpd.player_control_get() == 'play': mpd.player_control_set('pause') self.components['btn_play'].set_image_file(theme.icon.play) else: mpd.player_control_set('play') self.components['btn_play'].set_image_file(theme.icon.pause) self.components['btn_play'].draw() elif tag_name == 'btn_stop': self.components['btn_play'].set_image_file(theme.icon.play) mpd.player_control_set('stop') elif tag_name == 'btn_prev': mpd.player_control_set('previous') elif tag_name == 'btn_next': mpd.player_control_set('next') elif tag_name == 'btn_volume': screen_volume = ScreenVolume(self.screen) screen_volume.show() self.show() elif tag_name == 'list_playing': selected_index = self.components[ 'list_playing'].item_selected_index if selected_index >= 0: mpd.play_playlist_item(selected_index + 1) self.components[ 'list_playing'].active_item_index = selected_index self.components['list_playing'].draw()
def show(self): """ Displays the screen. """ self.components['screen_nav'].radio_mode_set(mpd.radio_mode_get()) now_playing = mpd.now_playing self.components['lbl_time'].text_set(now_playing.time_current + '/' + now_playing.time_total) self.components['lbl_volume'].text_set(_('Vol: {0}%').format(mpd.volume)) if mpd.player_control_get() == 'play': self.components['btn_play'].set_image_file(theme.icon.pause) else: self.components['btn_play'].set_image_file(theme.icon.play) self.components['btn_play'].draw() self.components['lbl_track_title'].text_set(now_playing.title) self.components['lbl_track_artist'].text_set(now_playing.artist) super(ScreenPlaylist, self).show() # Draw screen self.components['list_playing'].show_playlist() self.components['list_playing'].show_item_active() # Makes sure currently playing playlist item is on screen
def on_click(self, x, y): """ :param x: The horizontal click position. :param y: The vertical click position. :return: Possibly returns a screen index number to switch to. """ tag_name = super(ScreenPlaylist, self).on_click(x, y) if tag_name == 'btn_player': return 0 elif tag_name == 'btn_playlist': return 1 elif tag_name == 'btn_library': return 2 elif tag_name == 'btn_directory': return 3 elif tag_name == 'btn_radio': return 4 elif tag_name == 'btn_settings': setting_screen = ScreenSettings(self.screen) setting_screen.show() self.show() elif tag_name == 'btn_play': if mpd.player_control_get() == 'play': mpd.player_control_set('pause') self.components['btn_play'].set_image_file(theme.icon.play) else: mpd.player_control_set('play') self.components['btn_play'].set_image_file(theme.icon.pause) self.components['btn_play'].draw() elif tag_name == 'btn_stop': self.components['btn_play'].set_image_file(theme.icon.play) mpd.player_control_set('stop') elif tag_name == 'btn_prev': mpd.player_control_set('previous') elif tag_name == 'btn_next': mpd.player_control_set('next') elif tag_name == 'btn_volume': screen_volume = ScreenVolume(self.screen) screen_volume.show() self.show() elif tag_name == 'list_playing': selected_index = self.components['list_playing'].item_selected_index if selected_index >= 0: mpd.play_playlist_item(selected_index + 1) self.components['list_playing'].active_item_index = selected_index self.components['list_playing'].draw()
def show(self): """ Displays the screen. """ self.components['screen_nav'].radio_mode_set(mpd.radio_mode_get()) now_playing = mpd.now_playing self.components['lbl_time'].text_set(now_playing.time_current + '/' + now_playing.time_total) self.components['lbl_volume'].text_set( _('Vol: {0}%').format(mpd.volume)) if mpd.player_control_get() == 'play': self.components['btn_play'].set_image_file(theme.icon.pause) else: self.components['btn_play'].set_image_file(theme.icon.play) self.components['btn_play'].draw() self.components['lbl_track_title'].text_set(now_playing.title) self.components['lbl_track_artist'].text_set(now_playing.artist) super(ScreenPlaylist, self).show() # Draw screen self.components['list_playing'].show_playlist() self.components['list_playing'].show_item_active( ) # Makes sure currently playing playlist item is on screen
def show(self): """ Displays the screen. """ self.components['screen_nav'].radio_mode_set(mpd.radio_mode_get()) self.components['lbl_time_current'].text_set(mpd.now_playing.time_current) self.components['lbl_time_total'].text_set(mpd.now_playing.time_total) if mpd.player_control_get() == 'play': self.components['btn_play'].set_image_file(theme.icon.pause) else: self.components['btn_play'].set_image_file(theme.icon.play) self.components['btn_play'].draw() self.components['lbl_track_title'].text_set(mpd.now_playing.title) self.components['lbl_track_artist'].text_set(mpd.now_playing.artist) self.components['lbl_track_album'].text_set(mpd.now_playing.album) if mpd.radio_mode_get(): self.components['lbl_track_artist'].visible = False self.components['lbl_track_album'].position_set(ICO_WIDTH + 6, 3, SCREEN_WIDTH - 105, 39) self.components['pic_cover_art'].picture_set(theme.icon.cover_radio) else: self.components['lbl_track_artist'].visible = True self.components['lbl_track_artist'].text_set(mpd.now_playing.artist) self.components['lbl_track_album'].position_set(ICO_WIDTH + 6, 19, SCREEN_WIDTH - 105, 18) self.components['pic_cover_art'].picture_set(mpd.now_playing.cover_art_get()) super(ScreenPlaying, self).show() # Draw screen
def update(self): now_playing = mpd.now_playing self.components['screen_nav'].radio_mode_set(mpd.radio_mode_get()) while True: try: event = mpd.events.popleft() if event == 'volume': self.components['lbl_volume'].text_set(_('Vol: {0}%').format(mpd.volume)) elif event == 'playing_index': self.components['list_playing'].show_playlist() elif event == 'time_elapsed' or event == 'playing_time_total': self.components['lbl_time'].text_set('{0}/{1}'.format(now_playing.time_current, now_playing.time_total)) elif event == 'playing_file': self.components['lbl_track_title'].text_set(now_playing.title) self.components['lbl_track_artist'].text_set(now_playing.artist) elif event == 'state': state = mpd.player_control_get() if self.components['btn_play'].image_file != theme.icon.pause and state == 'play': self.components['btn_play'].draw(theme.icon_pause) elif self.components['btn_play'].image_file == theme.icon.pause and state != 'play': self.components['btn_play'].draw(theme.icon.play) except IndexError: break
def on_click(self, x, y): tag_name = super(ScreenPlaying, self).on_click(x, y) if tag_name == 'btn_player': return 0 elif tag_name == 'btn_playlist': return 1 elif tag_name == 'btn_library': return 2 elif tag_name == 'btn_directory': return 3 elif tag_name == 'btn_radio': return 4 elif tag_name == 'btn_settings': setting_screen = ScreenSettings(self.screen) setting_screen.show() self.show() elif tag_name == 'btn_play': print "Play pressed" if mpd.player_control_get() == 'play': mpd.player_control_set('pause') self.components['btn_play'].set_image_file(theme.icon.play) else: mpd.player_control_set('play') self.components['btn_play'].set_image_file(theme.icon.pause) self.components['btn_play'].draw() elif tag_name == 'btn_stop': self.components['btn_play'].set_image_file(theme.icon.play) mpd.player_control_set('stop') elif tag_name == 'btn_prev': mpd.player_control_set('previous') elif tag_name == 'btn_next': mpd.player_control_set('next') elif tag_name == 'btn_volume': screen_volume = ScreenVolume(self.screen) screen_volume.show() self.show()
def update(self): while True: try: event = mpd.events.popleft() self.components['screen_nav'].radio_mode_set(mpd.radio_mode_get()) playing = mpd.now_playing if event == 'time_elapsed': self.components['lbl_time_current'].text_set(playing.time_current) self.components['slide_time'].draw(playing.time_percentage) elif event == 'playing_file': self.components['lbl_track_title'].text_set(playing.title) if mpd.radio_mode_get(): self.components['lbl_track_artist'].visible = False self.components['lbl_track_album'].position_set(ICO_WIDTH + 6, 3, SCREEN_WIDTH - 105, 39) self.components['pic_cover_art'].picture_set(theme.icon.cover_radio) else: self.components['lbl_track_artist'].visible = True self.components['lbl_track_artist'].text_set(playing.artist) self.components['lbl_track_album'].position_set(ICO_WIDTH + 6, 19, SCREEN_WIDTH - 105, 18) self.components['pic_cover_art'].picture_set(mpd.now_playing.cover_art_get()) self.components['lbl_track_album'].text_set(playing.album) self.components['lbl_time_total'].text_set(playing.time_total) elif event == 'state': if self.components['btn_play'].image_file != theme.icon.pause and mpd.player_control_get() == 'play': self.components['btn_play'].draw(theme.icon.pause) elif self.components['btn_play'].image_file == theme.icon.pause and mpd.player_control_get() != 'play': self.components['btn_play'].draw(theme.icon.play) except IndexError: break