def search(self, *kwargs): string = self.search_entry.get_text() index = self.search_combobox.get_active() if index == 2: switch_tab(self.result_box, self.song_list) self.song_list.add_items([ SearchSongItem(Song(song)) for song in nplayer.recommend_songlist() ], clear_first=True) if string: if index == 0: switch_tab(self.result_box, self.song_list) self.song_list.add_items([ SearchSongItem(Song(song)) for song in nplayer.search(string) ], clear_first=True) elif index == 1: switch_tab(self.result_box, self.playlist_list) self.playlist_list.add_items([ PlaylistItem(playlist) for playlist in nplayer.search(string, 1000) ], clear_first=True)
def search(self, *kwargs): string = self.search_entry.get_text() index = self.search_combobox.get_active() if string: if index == 0: switch_tab(self.result_box, self.song_list) self.song_list.add_items([SearchSongItem(Song(song)) for song in nplayer.search(string)], clear_first=True) else: switch_tab(self.result_box, self.playlist_list) self.playlist_list.add_items([PlaylistItem(playlist) for playlist in nplayer.search(string, 1000)], clear_first=True)
def change_search_type(self, obj): string = self.search_entry.get_text() if not string: return index = self.search_combobox.get_active() if index == 0: switch_tab(self.result_box, self.song_list) self.song_list.add_items([SearchSongItem(Song(song)) for song in nplayer.search(string)], clear_first=True) elif index == 1: switch_tab(self.result_box, self.playlist_list) self.playlist_list.add_items([PlaylistItem(playlist) for playlist in nplayer.search(string, 1000)], clear_first=True)