def save_songs(self): list_path = get_playlist_path('default.xspf') pl = PlayList('default', list_path) #TODO:增加对话框提示保存路径和列表名称 songs = [] for row in self.liststore: song = row[0] songs.append(song) pl.write_xml(songs)
def on_playlist_page_button_clicked(self, widget, data=None): #TODO: 优化列表加载,更加模块化 if not hasattr(self, 'loaded_playlist') or self.loaded_playlist == False: list_path = get_playlist_path('default.xspf') if os.path.exists(list_path): pl = PlayList(None, list_path) id_list = pl.parse_xml() songset = SongSet(id_list) for song in songset.songs: song.icon = ICON_DICT['song'] self.add_to_playlist(songset.songs) self.loaded_playlist = True self.main_notebook.set_current_page(1)