def search_finished(self, results, error): """ Populate song list with search results. """ if error: notification_area.notify('Failed to search: {}'.format(str(error))) else: self.songlist.populate(results.get_tracks()) self.app.redraw()
def on_station_loaded(self, station, error): """ Called when station tracks fetch completes. Populates songlist with tracks from the selected station. """ if error: notification_area.notify('Failed to get station tracks: {}'.format( str(error))) self.songlist.populate(station.get_tracks()) self.app.redraw()
def populate(self, values, error=None): if error: notification_area.notify("Failed to fetch {}: {}".format( str(error), self.__class__.__name__)) self._items = [] for item in values: item = AbstractListItem(item, self._icon) urwid.connect_signal(item, 'activate', self.item_activated) self._items.append(item) self.walker[:] = self._items self.app.redraw()