class MusicScreen(Screen): ''' Shows the popup to choose the file to play ''' '''def show_load(self): content = LoadDialog(load=self.load, cancel=self.dismiss_popup) self._popup = Popup(title="Load file", content=content, size_hint=(0.9, 0.9)) self._popup.open() def dismiss_popup(self): self._popup.dismiss()''' def __init__(self, **kwargs): super(MusicScreen, self).__init__(**kwargs) #self.library_manager = LibraryManager() self.player = MusicPlayer() # # Getting the layout to dinamically add the buttons #ml_list_view = self.ids.ml_list_view # adding files to library #songs = self.library_manager.parse_library() # for song in songs: # btn = Button(text=os.path.basename(song), font_size=14)# , on_press=self.play_station(radio) # #btn.bind(on_press=self.pressed) # #btn.bind(on_press=self.play_station) # ml_layout.add_widget(btn) # list_adapter = ListAdapter(data=songs, cls=ListItemButton, selection_mode='single') # list_adapter.bind(on_selection_change=self.selection_change) # ml_list_view.adapter = list_adapter # songs_text = '' # for song in songs: # songs_text = songs_text + song # library_text.text = songs_text#''.join('aaaa ').join('bbbb')#, 'and something else') #library_text.text = library_text.text.join('bbbb') def selection_change(self, adapter, *args): print "selection changed" def load(self, path, filename): pass #self.player.stop_audio() self.player.load_audio(filename[0]) #self.dismiss_popup() '''Playing or pausing a song. 1) If stopped play it again from the 'elapsed' value. If it's 0 play it from the beginning. 2) If it's playing store the elapsed time and stop the song. ''' def play_pause_audio(self): pass self.player.play_pause_audio() def pause_audio(self): pass self.player.pause_audio() def play_audio(self): pass self.player.play_audio() ''' Stopping the song. 1) self.elapsed set to 0 so the next song (or the same) will be played from the beginning 2) actually stop the song ''' def stop_audio(self): pass self.player.stop_audio() ''' Reloading the song if it's currently playing. Just call self.stop_song and then self.play_pause_song ''' def reload_audio(self): pass self.player.reload_audio() ''' Setting the volume. When the value of the slider is changed, this will affect the volume of the played song. ''' def set_volume(self, value): pass self.player.set_volume(value)