示例#1
0
    def show_albums(self, reset_status=False):
        keyword = self.search_entry.get_text()
        if len(keyword) == 0:
            return
        if reset_status:
            self.liststore_albums.clear()

        albums, hit, self.albums_total = Net.search_albums(keyword,
                self.albums_page)
        if hit == 0:
            self.albums_button.set_label('{0} (0)'.format(_('Albums')))
            return
        self.albums_button.set_label('{0} ({1})'.format(_('Albums'), hit))
        i = len(self.liststore_albums)
        for album in albums:
            if len(album['info']) == 0:
                tooltip = Widgets.tooltip(album['name'])
            else:
                tooltip = '<b>{0}</b>\n{1}'.format(
                        Widgets.tooltip(album['name']),
                        Widgets.tooltip(album['info']))
            self.liststore_albums.append([self.app.theme['anonymous'],
                album['name'], int(album['albumid']), 
                album['artist'], int(album['artistid']),
                tooltip, ])
            Net.update_album_covers(self.liststore_albums, i, 0,
                    album['pic'])
            i += 1
示例#2
0
 def _append_albums(albums_args, error=None):
     albums, hit, self.albums_total = albums_args
     if hit == 0:
         if reset_status:
             self.albums_button.set_label(
                     '{0} (0)'.format(_('Albums')))
         return
     self.albums_button.set_label(
             '{0} ({1})'.format(_('Albums'), hit))
     i = len(self.liststore_albums)
     for album in albums:
         if len(album['info']) == 0:
             tooltip = Widgets.tooltip(album['name'])
         else:
             tooltip = '<b>{0}</b>\n{1}'.format(
                     Widgets.tooltip(album['name']),
                     Widgets.tooltip(album['info']))
         self.liststore_albums.append([self.app.theme['anonymous'],
             album['name'],
             int(album['albumid']), 
             album['artist'],
             int(album['artistid']),
             tooltip, ])
         Net.update_album_covers(self.liststore_albums,
                 i, 0, album['pic'])
         i += 1
示例#3
0
文件: Artists.py 项目: iiccn/kwplayer
 def _append_artist_albums(albums_args, error=None):
     albums, self.artist_albums_total = albums_args
     if self.artist_albums_total == 0:
         return
     i = len(self.artist_albums_liststore)
     for album in albums:
         if len(album['info']) == 0:
             tooltip = Widgets.tooltip(album['name'])
         else:
             tooltip = '<b>{0}</b>\n{1}'.format(
                     Widgets.tooltip(album['name']),
                     Widgets.tooltip(album['info']))
         self.artist_albums_liststore.append([
             self.app.theme['anonymous'],
             album['name'],
             int(album['albumid']),
             album['artist'],
             int(album['artistid']),
             tooltip, ])
         Net.update_album_covers(self.artist_albums_liststore, i,
                 0, album['pic'])
         i += 1
     self.artist_albums_page += 1
     if self.artist_albums_page < self.artist_albums_total - 1:
         self.append_artist_albums()
示例#4
0
 def _append_fav_artist(info, error=None):
     if info and info['pic'] and len(info['pic']) > 0:
         pix = GdkPixbuf.Pixbuf.new_from_file_at_size(
                 info['pic'], 100, 100)
     else:
         pix = self.app.theme['anonymous']
     if 'info' in info:
         tip = Widgets.tooltip(info['info'])
     else:
         tip = ''
     self.fav_artists_liststore.append([pix, info['name'],
         artist_id, tip])
示例#5
0
文件: Artists.py 项目: iiccn/kwplayer
 def _append_artist_info(info, error=None):
     if info and info['pic'] and len(info['pic']) > 0:
         self.artist_info_pic.set_from_file(info['pic'])
     self.artist_info_name.set(info, 'name')
     self.artist_info_birthday.set(info, 'birthday')
     self.artist_info_birthplace.set(info, 'birthplace')
     self.artist_info_height.set(info, 'tall')
     self.artist_info_weight.set(info, 'weight',)
     self.artist_info_country.set(info, 'country')
     self.artist_info_language.set(info, 'language')
     self.artist_info_gender.set(info, 'gender',)
     self.artist_info_constellation.set(info, 'constellation')
     if info and 'info' in info:
         self.artist_info_textbuffer.set_text(
                 Widgets.tooltip(info['info']))
     else:
         self.artist_info_textbuffer.set_text('')