示例#1
0
        def _show_sub1(sub1_args, error=None):
            nodes, self.sub1_total = sub1_args
            if not nodes or self.sub1_total == 0:
                return
            i = len(self.liststore_sub1)
            for node in nodes:
                _id = 'id' if self.use_sub2 else 'sourceid'
                if 'tips' in node and len(node['tips']) > 5:
                    _tooltip = Widgets.set_tooltip_with_song_tips(
                        node['name'], node['tips'])
                else:
                    _tooltip = Widgets.set_tooltip(node['name'], node['info'])
                self.liststore_sub1.append([
                    self.app.theme['anonymous'],
                    Widgets.unescape(node['name']),
                    int(node[_id]),
                    Widgets.unescape(node['info']),
                    _tooltip,
                ])
                Net.update_liststore_image(self.liststore_sub1, i, 0,
                                           node['pic'])
                i += 1

            self.sub1_page += 1
            if self.sub1_page < self.sub1_total - 1:
                self.show_sub1()
示例#2
0
 def _append_artist_similar(similar_args, error=None):
     artists, self.artist_similar_total = similar_args
     if error or not self.artist_similar_total:
         return
     urls = []
     tree_iters = []
     for artist in artists:
         _info = ''.join([
             artist['songnum'],
             _(' songs'),
         ])
         tree_iter = self.artist_similar_liststore.append([
             self.app.theme['anonymous'],
             Widgets.unescape(artist['name']),
             int(artist['id']),
             _info,
             Widgets.set_tooltip(artist['name'], _info),
         ])
         urls.append(artist['pic'])
         tree_iters.append(tree_iter)
     Net.update_artist_logos(self.artist_similar_liststore, 0,
                             tree_iters, urls)
     self.artist_similar_page += 1
     if self.artist_similar_page < self.artist_similar_total - 1:
         self.append_artist_similar()
示例#3
0
    def append_artists(self, init=False):
        if init:
            self.artists_liststore.clear()
            self.artists_page = 0
            self.artists_win.get_vadjustment().set_value(0)
        selection = self.cate_treeview.get_selection()
        result = selection.get_selected()
        if result is None or len(result) != 2:
            return
        model, _iter = result
        pref_index = self.pref_combo.get_active()
        catid = model[_iter][1]
        prefix = self.pref_liststore[pref_index][1]
        # TODO: use async_call()
        artists, self.artists_total = Net.get_artists(
                catid, self.artists_page, prefix)
        if self.artists_total == 0:
            return

        i = len(self.artists_liststore)
        for artist in artists:
            _info = ' '.join([artist['music_num'], _(' songs'), ])
            self.artists_liststore.append([
                self.app.theme['anonymous'],
                Widgets.unescape(artist['name']),
                int(artist['id']), 
                _info,
                Widgets.set_tooltip(artist['name'], _info),
                ])
            Net.update_artist_logo(
                    self.artists_liststore, i, 0, artist['pic'])
            i += 1
示例#4
0
        def _show_sub1(sub1_args, error=None):
            nodes, self.sub1_total = sub1_args
            if error or not nodes or not self.sub1_total:
                return
            urls = []
            tree_iters = []
            for node in nodes:
                _id = 'id' if self.use_sub2 else 'sourceid'
                if 'tips' in node and len(node['tips']) > 5:
                    tooltip = Widgets.set_tooltip_with_song_tips(
                        node['name'], node['tips'])
                else:
                    tooltip = Widgets.set_tooltip(node['name'], node['info'])
                tree_iter = self.liststore_sub1.append([
                    self.app.theme['anonymous'],
                    Widgets.unescape(node['name']),
                    int(node[_id]),
                    Widgets.unescape(node['info']),
                    tooltip,
                ])
                urls.append(node['pic'])
                tree_iters.append(tree_iter)
            Net.update_liststore_images(self.liststore_sub1, 0, tree_iters,
                                        urls)

            self.sub1_page += 1
            if self.sub1_page < self.sub1_total - 1:
                self.show_sub1()
示例#5
0
        def _show_sub1(sub1_args, error=None):
            nodes, self.sub1_total = sub1_args
            if not nodes or self.sub1_total == 0:
                return
            for i, node in enumerate(nodes):
                _id = 'id' if self.use_sub2 else 'sourceid'
                if 'tips' in node and len(node['tips']) > 5:
                    _tooltip = Widgets.set_tooltip_with_song_tips(
                            node['name'], node['tips'])
                else:
                    _tooltip = Widgets.set_tooltip(
                            node['name'], node['info'])
                self.liststore_sub1.append([
                    self.app.theme['anonymous'],
                    Widgets.unescape(node['name']),
                    int(node[_id]),
                    Widgets.unescape(node['info']),
                    _tooltip,
                    ])
                Net.update_liststore_image(
                        self.liststore_sub1, i, 0, node['pic'])

            self.sub1_page += 1
            if self.sub1_page < self.sub1_total - 1:
                self.show_sub1()
示例#6
0
        def _show_sub1(sub1_args, error=None):
            nodes, self.sub1_total = sub1_args
            if error or not nodes or not self.sub1_total:
                return
            urls = []
            tree_iters = []
            for node in nodes:
                _id = 'id' if self.use_sub2 else 'sourceid'
                if 'tips' in node and len(node['tips']) > 5:
                    tooltip = Widgets.set_tooltip_with_song_tips(
                            node['name'], node['tips'])
                else:
                    tooltip = Widgets.set_tooltip(node['name'], node['info'])
                tree_iter = self.liststore_sub1.append([
                    self.app.theme['anonymous'],
                    Widgets.unescape(node['name']),
                    int(node[_id]),
                    Widgets.unescape(node['info']),
                    tooltip,
                    ])
                urls.append(node['pic'])
                tree_iters.append(tree_iter)
            Net.update_liststore_images(
                    self.liststore_sub1, 0, tree_iters, urls)

            self.sub1_page += 1
            if self.sub1_page < self.sub1_total - 1:
                self.show_sub1()
示例#7
0
文件: MV.py 项目: 958887233/kwplayer
 def _on_append_songs(info, error=None):
     if error or not info or not info[0] or not info[1]:
         logger.error('append_songs():  %s, %s' % (info, error))
         return
     songs, self.songs_total = info
     urls = []
     tree_iters = []
     for song in songs:
         tree_iter = self.liststore_songs.append([
             Config.ANONYMOUS_PIXBUF,
             Widgets.unescape(song['name']),
             Widgets.unescape(song['artist']),
             Widgets.unescape(song['album']),
             int(song['id']),
             int(song['artistid']), 
             int(song['albumid']),
             Widgets.set_tooltip(song['name'], song['artist']),
         ])
         tree_iters.append(tree_iter)
         urls.append(song['mvpic'])
     Net.async_call(Net.update_mv_images, self.liststore_songs, 0,
                    tree_iters, urls)
     self.songs_page += 1
     if self.songs_page < self.songs_total - 1:
         self.append_songs()
示例#8
0
    def first(self):
        app = self.app
        self.buttonbox = Gtk.Box(spacing=5)
        self.pack_start(self.buttonbox, False, False, 0)
        button_home = Gtk.Button(_('MV'))
        button_home.connect('clicked', self.on_button_home_clicked)
        self.buttonbox.pack_start(button_home, False, False, 0)
        self.label = Gtk.Label('')
        self.buttonbox.pack_start(self.label, False, False, 0)

        # pic, name, artist, album, rid, artistid, albumid, tooltip
        self.liststore_songs = Gtk.ListStore(GdkPixbuf.Pixbuf, str, str, str,
                                             int, int, int, str)
        self.mv_control_box = Widgets.MVControlBox(self.liststore_songs,
                                                   self.app)
        self.buttonbox.pack_end(self.mv_control_box, False, False, 0)

        self.scrolled_nodes = Gtk.ScrolledWindow()
        self.pack_start(self.scrolled_nodes, True, True, 0)
        # logo, name, nid, info, tooltip
        self.liststore_nodes = Gtk.ListStore(GdkPixbuf.Pixbuf, str, int, str,
                                             str)
        iconview_nodes = Widgets.IconView(self.liststore_nodes, tooltip=4)
        iconview_nodes.connect('item_activated',
                               self.on_iconview_nodes_item_activated)
        self.scrolled_nodes.add(iconview_nodes)

        self.scrolled_songs = Gtk.ScrolledWindow()
        self.pack_start(self.scrolled_songs, True, True, 0)
        iconview_songs = Widgets.IconView(self.liststore_songs,
                                          info_pos=2,
                                          tooltip=7)
        iconview_songs.connect('item_activated',
                               self.on_iconview_songs_item_activated)
        self.scrolled_songs.add(iconview_songs)

        self.show_all()
        self.buttonbox.hide()
        self.scrolled_songs.hide()

        nid = 3
        nodes_wrap = Net.get_index_nodes(nid)
        if not nodes_wrap:
            return
        nodes = nodes_wrap['child']
        self.liststore_nodes.clear()
        urls = []
        tree_iters = []
        for node in nodes:
            tree_iter = self.liststore_nodes.append([
                self.app.theme['anonymous'],
                Widgets.unescape(node['disname']),
                int(node['sourceid']),
                Widgets.unescape(node['info']),
                Widgets.set_tooltip(node['disname'], node['info']),
            ])
            tree_iters.append(tree_iter)
            urls.append(node['pic'])
        self.liststore_nodes.timestamp = time.time()
        Net.update_liststore_images(self.liststore_nodes, 0, tree_iters, urls)
示例#9
0
 def _append_artist_mv(mv_args, error=None):
     mvs, self.artist_mv_total = mv_args
     if error or self.artist_mv_total == 0:
         logger.error('append_artist_mv(): %s, %s' %
                      (self.artist_mv_total, error))
         return
     urls = []
     tree_iters = []
     for mv in mvs:
         tree_iter = self.artist_mv_liststore.append([
             Config.ANONYMOUS_PIXBUF,
             Widgets.unescape(mv['name']),
             Widgets.unescape(mv['artist']),
             '',
             int(mv['musicid']),
             int(mv['artistid']),
             0,
             Widgets.set_tooltip(mv['name'], mv['artist']),
         ])
         tree_iters.append(tree_iter)
         urls.append(mv['pic'])
     Net.async_call(Net.update_mv_images, self.artist_mv_liststore, 0,
                    tree_iters, urls)
     self.artist_mv_page += 1
     if self.artist_mv_page < self.artist_mv_total - 1:
         self.append_artist_mv()
示例#10
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 'info' in album and album['info']:
             tooltip = Widgets.set_tooltip(album['name'], album['info'])
         else:
             tooltip = Widgets.escape(album['name'])
         self.liststore_albums.append([
             self.app.theme['anonymous'],
             Widgets.unescape(album['name']),
             int(album['albumid']), 
             Widgets.unescape(album['artist']),
             int(album['artistid']),
             tooltip,
             ])
         Net.update_album_covers(
                 self.liststore_albums, i, 0, album['pic'])
         i += 1
示例#11
0
文件: Artists.py 项目: zihua/kwplayer
 def _append_artist_mv(mv_args, error=None):
     mvs, self.artist_mv_total = mv_args
     if error or self.artist_mv_total == 0:
         logger.error('append_artist_mv(): %s, %s' %
                      (self.artist_mv_total, error))
         return
     urls = []
     tree_iters = []
     for mv in mvs:
         tree_iter = self.artist_mv_liststore.append([
             Config.ANONYMOUS_PIXBUF,
             Widgets.unescape(mv['name']),
             Widgets.unescape(mv['artist']),
             '',
             int(mv['musicid']),
             int(mv['artistid']),
             0,
             Widgets.set_tooltip(mv['name'], mv['artist']),
         ])
         tree_iters.append(tree_iter)
         urls.append(mv['pic'])
     Net.async_call(Net.update_mv_images, self.artist_mv_liststore, 0,
                    tree_iters, urls)
     self.artist_mv_page += 1
     if self.artist_mv_page < self.artist_mv_total - 1:
         self.append_artist_mv()
示例#12
0
文件: MV.py 项目: anchowee/kwplayer
    def first(self):
        if self.first_show:
            return
        self.first_show = True
        app = self.app
        self.buttonbox = Gtk.Box(spacing=5)
        self.pack_start(self.buttonbox, False, False, 0)
        button_home = Gtk.Button(_('MV'))
        button_home.connect('clicked', self.on_button_home_clicked)
        self.buttonbox.pack_start(button_home, False, False, 0)
        self.label = Gtk.Label('')
        self.buttonbox.pack_start(self.label, False, False, 0)

        # pic, name, artist, album, rid, artistid, albumid, tooltip
        self.liststore_songs = Gtk.ListStore(GdkPixbuf.Pixbuf,
                str, str, str, int, int, int, str)
        self.mv_control_box = Widgets.MVControlBox(self.liststore_songs,
                self.app)
        self.buttonbox.pack_end(self.mv_control_box, False, False, 0)

        self.scrolled_nodes = Gtk.ScrolledWindow()
        self.pack_start(self.scrolled_nodes, True, True, 0)
        # logo, name, nid, info, tooltip
        self.liststore_nodes = Gtk.ListStore(GdkPixbuf.Pixbuf,
                str, int, str, str)
        iconview_nodes = Widgets.IconView(self.liststore_nodes, tooltip=4)
        iconview_nodes.connect('item_activated', 
                self.on_iconview_nodes_item_activated)
        self.scrolled_nodes.add(iconview_nodes)

        self.scrolled_songs = Gtk.ScrolledWindow()
        self.pack_start(self.scrolled_songs, True, True, 0)
        iconview_songs = Widgets.IconView(self.liststore_songs,
                info_pos=2, tooltip=7)
        iconview_songs.connect('item_activated', 
                self.on_iconview_songs_item_activated)
        self.scrolled_songs.add(iconview_songs)

        self.show_all()
        self.buttonbox.hide()
        self.scrolled_songs.hide()

        nid = 3
        nodes_wrap = Net.get_index_nodes(nid)
        if not nodes_wrap:
            return
        nodes = nodes_wrap['child']
        self.liststore_nodes.clear()
        i = 0
        for node in nodes:
            self.liststore_nodes.append([
                self.app.theme['anonymous'],
                Widgets.unescape_html(node['disname']),
                int(node['sourceid']),
                Widgets.unescape_html(node['info']),
                Widgets.set_tooltip(node['disname'], node['info']),
                ])
            Net.update_liststore_image(self.liststore_nodes, i, 0,
                    node['pic'])
            i += 1
示例#13
0
文件: Artists.py 项目: zihua/kwplayer
 def _append_artist_similar(similar_args, error=None):
     artists, self.artist_similar_total = similar_args
     if error or not self.artist_similar_total:
         logger.error('append_artist_similar(): %s, %s' %
                      (self.artist_similar_total, error))
         return
     urls = []
     tree_iters = []
     for artist in artists:
         _info = ''.join([
             artist['songnum'],
             _(' songs'),
         ])
         tree_iter = self.artist_similar_liststore.append([
             Config.ANONYMOUS_PIXBUF,
             Widgets.unescape(artist['name']),
             int(artist['id']),
             _info,
             Widgets.set_tooltip(artist['name'], _info),
         ])
         urls.append(artist['pic'])
         tree_iters.append(tree_iter)
     Net.async_call(Net.update_artist_logos,
                    self.artist_similar_liststore, 0, tree_iters, urls)
     self.artist_similar_page += 1
     if self.artist_similar_page < self.artist_similar_total - 1:
         self.append_artist_similar()
示例#14
0
        def _on_show_sub1(info, error=None):
            if not info or not info[0] or not info[1] or error:
                logger.error('show_sub1(): %s, %s' % (info, error))
                return
            nodes, self.sub1_total = info
            urls = []
            tree_iters = []
            for node in nodes:
                id_ = 'id' if self.use_sub2 else 'sourceid'
                if 'tips' in node and len(node['tips']) > 5:
                    tooltip = Widgets.set_tooltip_with_song_tips(
                        node['name'], node['tips'])
                else:
                    tooltip = Widgets.set_tooltip(node['name'], node['info'])
                tree_iter = self.liststore_sub1.append([
                    Config.ANONYMOUS_PIXBUF,
                    Widgets.unescape(node['name']),
                    int(node[id_]),
                    Widgets.unescape(node['info']),
                    tooltip,
                ])
                urls.append(node['pic'])
                tree_iters.append(tree_iter)
            Net.async_call(Net.update_liststore_images, self.liststore_sub1, 0,
                           tree_iters, urls)

            self.sub1_page += 1
            if self.sub1_page < self.sub1_total - 1:
                self.show_sub1()
示例#15
0
        def _on_show_sub1(info, error=None):
            if not info or not info[0] or not info[1] or error:
                logger.error('show_sub1(): %s, %s' % (info, error))
                return
            nodes, self.sub1_total = info
            urls = []
            tree_iters = []
            for node in nodes:
                id_ = 'id' if self.use_sub2 else 'sourceid'
                if 'tips' in node and len(node['tips']) > 5:
                    tooltip = Widgets.set_tooltip_with_song_tips(node['name'],
                                                                 node['tips'])
                else:
                    tooltip = Widgets.set_tooltip(node['name'], node['info'])
                tree_iter = self.liststore_sub1.append([
                    self.app.theme['anonymous'],
                    Widgets.unescape(node['name']),
                    int(node[id_]),
                    Widgets.unescape(node['info']),
                    tooltip,
                ])
                urls.append(node['pic'])
                tree_iters.append(tree_iter)
            Net.async_call(Net.update_liststore_images, self.liststore_sub1, 0,
                           tree_iters, urls)

            self.sub1_page += 1
            if self.sub1_page < self.sub1_total - 1:
                self.show_sub1()
示例#16
0
文件: MV.py 项目: zihua/kwplayer
 def _on_append_songs(info, error=None):
     if error or not info or not info[0] or not info[1]:
         logger.error('append_songs():  %s, %s' % (info, error))
         return
     songs, self.songs_total = info
     urls = []
     tree_iters = []
     for song in songs:
         tree_iter = self.liststore_songs.append([
             Config.ANONYMOUS_PIXBUF,
             Widgets.unescape(song['name']),
             Widgets.unescape(song['artist']),
             Widgets.unescape(song['album']),
             int(song['id']),
             int(song['artistid']),
             int(song['albumid']),
             Widgets.set_tooltip(song['name'], song['artist']),
         ])
         tree_iters.append(tree_iter)
         urls.append(song['mvpic'])
     Net.async_call(Net.update_mv_images, self.liststore_songs, 0,
                    tree_iters, urls)
     self.songs_page += 1
     if self.songs_page < self.songs_total - 1:
         self.append_songs()
示例#17
0
    def append_artists(self, init=False):
        if init:
            self.artists_liststore.clear()
            self.artists_page = 0
            self.artists_win.get_vadjustment().set_value(0)
        selection = self.cate_treeview.get_selection()
        result = selection.get_selected()
        if result is None or len(result) != 2:
            return
        model, _iter = result
        pref_index = self.pref_combo.get_active()
        catid = model[_iter][1]
        prefix = self.pref_liststore[pref_index][1]
        # TODO: use async_call()
        artists, self.artists_total = Net.get_artists(catid, self.artists_page,
                                                      prefix)
        if self.artists_total == 0:
            return

        i = len(self.artists_liststore)
        for artist in artists:
            _info = ' '.join([
                artist['music_num'],
                _(' songs'),
            ])
            self.artists_liststore.append([
                self.app.theme['anonymous'],
                Widgets.unescape(artist['name']),
                int(artist['id']),
                _info,
                Widgets.set_tooltip(artist['name'], _info),
            ])
            Net.update_artist_logo(self.artists_liststore, i, 0, artist['pic'])
            i += 1
示例#18
0
文件: Radio.py 项目: Taliens/kwplayer
    def first(self):
        app = self.app

        # left side panel
        scrolled_myradio = Gtk.ScrolledWindow()
        scrolled_myradio.props.hscrollbar_policy = Gtk.PolicyType.NEVER
        self.pack_start(scrolled_myradio, False, False, 0)

        # radios selected by user.
        self.box_myradio = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
        self.box_myradio.props.margin_left = 10
        scrolled_myradio.add(self.box_myradio)

        self.scrolled_radios = Gtk.ScrolledWindow()
        self.pack_start(self.scrolled_radios, True, True, 0)

        # pic, name, id, num of listeners, pic_url, tooltip
        self.liststore_radios = Gtk.ListStore(
                GdkPixbuf.Pixbuf, str, int, str, str, str)
        iconview_radios = Widgets.IconView(
                self.liststore_radios, tooltip=5)
        iconview_radios.connect(
                'item_activated', self.on_iconview_radios_item_activated)
        self.scrolled_radios.add(iconview_radios)

        self.show_all()

        nid = 8
        page = 0
        radios, total_page = Net.get_nodes(nid, page)
        if total_page == 0:
            return
        urls = []
        tree_iters = []
        for radio in radios:
            tree_iter = self.liststore_radios.append([
                self.app.theme['anonymous'],
                Widgets.unescape(radio['disname']), 
                int(radio['sourceid'].split(',')[0]),
                Widgets.unescape(radio['info']),
                radio['pic'],
                Widgets.set_tooltip(radio['disname'], radio['info']),
                ])
            tree_iters.append(tree_iter)
            urls.append(radio['pic'])
        self.liststore_radios.timestamp = time.time()
        Net.update_liststore_images(
                self.liststore_radios, 0, tree_iters, urls)

        for radio in self.playlists:
            radio_item = RadioItem(radio, self.app)
            self.box_myradio.pack_start(radio_item, False, False, 0)

        GLib.timeout_add(300000, self.dump_playlists)
示例#19
0
文件: Radio.py 项目: zihua/kwplayer
    def first(self):
        app = self.app

        # left side panel
        scrolled_myradio = Gtk.ScrolledWindow()
        scrolled_myradio.props.hscrollbar_policy = Gtk.PolicyType.NEVER
        self.pack_start(scrolled_myradio, False, False, 0)

        # radios selected by user.
        self.box_myradio = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
        self.box_myradio.props.margin_left = 10
        scrolled_myradio.add(self.box_myradio)

        self.scrolled_radios = Gtk.ScrolledWindow()
        self.pack_start(self.scrolled_radios, True, True, 0)

        # pic, name, id, num of listeners, pic_url, tooltip
        self.liststore_radios = Gtk.ListStore(GdkPixbuf.Pixbuf, str, int,
                                              str, str, str)
        iconview_radios = Widgets.IconView(self.liststore_radios, tooltip=5)
        iconview_radios.connect('item_activated',
                                self.on_iconview_radios_item_activated)
        self.scrolled_radios.add(iconview_radios)

        self.show_all()

        nid = 8
        page = 0
        radios, total_page = Net.get_nodes(nid, page)
        if total_page == 0:
            return
        urls = []
        tree_iters = []
        for radio in radios:
            tree_iter = self.liststore_radios.append([
                Config.ANONYMOUS_PIXBUF,
                Widgets.unescape(radio['disname']), 
                int(radio['sourceid'].split(',')[0]),
                Widgets.unescape(radio['info']),
                radio['pic'],
                Widgets.set_tooltip(radio['disname'], radio['info']),
            ])
            tree_iters.append(tree_iter)
            urls.append(radio['pic'])
        self.liststore_radios.timestamp = time.time()
        Net.async_call(Net.update_liststore_images, self.liststore_radios, 0,
                       tree_iters, urls)

        for radio_rid in self.playlists:
            radio_item = RadioItem(radio_rid, self.app)
            self.box_myradio.pack_start(radio_item, False, False, 0)

        GLib.timeout_add(300000, self.dump_playlists)
示例#20
0
 def on_append_artists(info, error=None):
     artists, self.artists_total = info
     if error or not self.artists_total or not artists:
         return
     for i, artist in enumerate(artists):
         _info = ' '.join([artist['music_num'], _(' songs'), ])
         self.artists_liststore.append([
             self.app.theme['anonymous'],
             Widgets.unescape(artist['name']),
             int(artist['id']),
             _info,
             Widgets.set_tooltip(artist['name'], _info),
             ])
         Net.update_artist_logo(
                 self.artists_liststore, i, 0, artist['pic'])
示例#21
0
 def _append_artist_similar(similar_args, error=None):
     artists, self.artist_similar_total = similar_args
     if self.artist_similar_total == 0:
         return
     for i, artist in enumerate(artists):
         _info = ''.join([artist['songnum'], _(' songs'), ])
         self.artist_similar_liststore.append([
             self.app.theme['anonymous'],
             Widgets.unescape(artist['name']),
             int(artist['id']),
             _info,
             Widgets.set_tooltip(artist['name'], _info),
             ])
         Net.update_artist_logo(
                 self.artist_similar_liststore, i, 0, artist['pic'])
     self.artist_similar_page += 1
     if self.artist_similar_page < self.artist_similar_total - 1:
         self.append_artist_similar()
示例#22
0
 def _append_artist_albums(albums_args, error=None):
     albums, self.artist_albums_total = albums_args
     if self.artist_albums_total == 0:
         return
     for i, album in enumerate(albums):
         self.artist_albums_liststore.append([
             self.app.theme['anonymous'],
             Widgets.unescape(album['name']),
             int(album['albumid']),
             Widgets.unescape(album['artist']),
             int(album['artistid']),
             Widgets.set_tooltip(album['name'], album['info']),
             ])
         Net.update_album_covers(
                 self.artist_albums_liststore, i, 0, album['pic'])
     self.artist_albums_page += 1
     if self.artist_albums_page < self.artist_albums_total - 1:
         self.append_artist_albums()
示例#23
0
 def _on_get_themes(nodes, error):
     if not nodes:
         logger.warn('_on_get_themes(): %s, %s' % (nodes, error))
         return
     urls = []
     tree_iters = []
     for node in nodes:
         tree_iter = self.liststore_main.append([
             self.app.theme['anonymous'],
             Widgets.unescape(node['name']),
             int(node['nid']),
             Widgets.unescape(node['info']),
             Widgets.set_tooltip(node['name'], node['info']),
             ])
         urls.append(node['pic'])
         tree_iters.append(tree_iter)
     self.liststore_main.timestamp = time.time()
     Net.async_call(Net.update_liststore_images, self.liststore_main, 0,
                    tree_iters, urls)
示例#24
0
 def _on_get_themes(nodes, error):
     if not nodes:
         logger.warn('_on_get_themes(): %s, %s' % (nodes, error))
         return
     urls = []
     tree_iters = []
     for node in nodes:
         tree_iter = self.liststore_main.append([
             Config.ANONYMOUS_PIXBUF,
             Widgets.unescape(node['name']),
             int(node['nid']),
             Widgets.unescape(node['info']),
             Widgets.set_tooltip(node['name'], node['info']),
         ])
         urls.append(node['pic'])
         tree_iters.append(tree_iter)
     self.liststore_main.timestamp = time.time()
     Net.async_call(Net.update_liststore_images, self.liststore_main, 0,
                    tree_iters, urls)
示例#25
0
 def on_append_artists(info, error=None):
     artists, self.artists_total = info
     if error or not self.artists_total or not artists:
         return
     urls = []
     tree_iters = []
     for artist in artists:
         _info = ' '.join([artist['music_num'], _(' songs'), ])
         tree_iter = self.artists_liststore.append([
             self.app.theme['anonymous'],
             Widgets.unescape(artist['name']),
             int(artist['id']),
             _info,
             Widgets.set_tooltip(artist['name'], _info),
             ])
         urls.append(artist['pic'])
         tree_iters.append(tree_iter)
     Net.update_artist_logos(
             self.artists_liststore, 0, tree_iters, urls)
示例#26
0
 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:
         self.artist_albums_liststore.append([
             self.app.theme['anonymous'],
             Widgets.unescape(album['name']),
             int(album['albumid']),
             Widgets.unescape(album['artist']),
             int(album['artistid']),
             Widgets.set_tooltip(album['name'], album['info']),
         ])
         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()
示例#27
0
 def _append_artist_mv(mv_args, error=None):
     mvs, self.artist_mv_total = mv_args
     if self.artist_mv_total == 0:
         return
     for i, mv in enumerate(mvs):
         self.artist_mv_liststore.append([
             self.app.theme['anonymous'],
             Widgets.unescape(mv['name']),
             Widgets.unescape(mv['artist']),
             '',
             int(mv['musicid']),
             int(mv['artistid']),
             0,
             Widgets.set_tooltip(mv['name'], mv['artist']),
             ])
         Net.update_mv_image(
                 self.artist_mv_liststore, i, 0, mv['pic'])
     self.artist_mv_page += 1
     if self.artist_mv_page < self.artist_mv_total - 1:
         self.append_artist_mv()
示例#28
0
 def _append_artist_mv(mv_args, error=None):
     mvs, self.artist_mv_total = mv_args
     if self.artist_mv_total == 0:
         return
     i = len(self.artist_mv_liststore)
     for mv in mvs:
         self.artist_mv_liststore.append([
             self.app.theme['anonymous'],
             Widgets.unescape(mv['name']),
             Widgets.unescape(mv['artist']),
             '',
             int(mv['musicid']),
             int(mv['artistid']),
             0,
             Widgets.set_tooltip(mv['name'], mv['artist']),
         ])
         Net.update_mv_image(self.artist_mv_liststore, i, 0, mv['pic'])
         i += 1
     self.artist_mv_page += 1
     if self.artist_mv_page < self.artist_mv_total - 1:
         self.append_artist_mv()
示例#29
0
 def on_append_artists(info, error=None):
     artists, self.artists_total = info
     if error or not self.artists_total or not artists:
         logger.error('append_artists(), %s, %s, %s' %
                      (self.artists_total, artists, error))
         return
     urls = []
     tree_iters = []
     for artist in artists:
         _info = ' '.join([artist['music_num'], _(' songs'), ])
         tree_iter = self.artists_liststore.append([
             Config.ANONYMOUS_PIXBUF,
             Widgets.unescape(artist['name']),
             int(artist['id']),
             _info,
             Widgets.set_tooltip(artist['name'], _info),
         ])
         urls.append(artist['pic'])
         tree_iters.append(tree_iter)
     Net.async_call(Net.update_artist_logos, self.artists_liststore, 0,
                    tree_iters, urls)
示例#30
0
 def _append_artist_mv(mv_args, error=None):
     mvs, self.artist_mv_total = mv_args
     if self.artist_mv_total == 0:
         return
     i = len(self.artist_mv_liststore)
     for mv in mvs:
         self.artist_mv_liststore.append([
             self.app.theme['anonymous'],
             mv['name'],
             mv['artist'],
             '',
             int(mv['musicid']),
             int(mv['artistid']),
             0,
             Widgets.set_tooltip(mv['name'], mv['artist']),
             ])
         Net.update_mv_image(self.artist_mv_liststore, i, 0,
                 mv['pic'])
         i += 1
     self.artist_mv_page += 1
     if self.artist_mv_page < self.artist_mv_total - 1:
         self.append_artist_mv()
示例#31
0
文件: MV.py 项目: 958887233/kwplayer
 def _on_get_index_nodes(nodes_wrap, error=None):
     if not nodes_wrap or error:
         logger.error('MV._on_get_inex_nodes(): %s, %s' %
                      (nodes_wrap, error))
         return
     nodes = nodes_wrap['child']
     self.liststore_nodes.clear()
     urls = []
     tree_iters = []
     for node in nodes:
         tree_iter = self.liststore_nodes.append([
             Config.ANONYMOUS_PIXBUF,
             Widgets.unescape(node['disname']),
             int(node['sourceid']),
             Widgets.unescape(node['info']),
             Widgets.set_tooltip(node['disname'], node['info']),
         ])
         tree_iters.append(tree_iter)
         urls.append(node['pic'])
     self.liststore_nodes.timestamp = time.time()
     Net.async_call(Net.update_liststore_images, self.liststore_nodes, 0,
                    tree_iters, urls)
示例#32
0
文件: MV.py 项目: zihua/kwplayer
 def _on_get_index_nodes(nodes_wrap, error=None):
     if not nodes_wrap or error:
         logger.error('MV._on_get_inex_nodes(): %s, %s' %
                      (nodes_wrap, error))
         return
     nodes = nodes_wrap['child']
     self.liststore_nodes.clear()
     urls = []
     tree_iters = []
     for node in nodes:
         tree_iter = self.liststore_nodes.append([
             Config.ANONYMOUS_PIXBUF,
             Widgets.unescape(node['disname']),
             int(node['sourceid']),
             Widgets.unescape(node['info']),
             Widgets.set_tooltip(node['disname'], node['info']),
         ])
         tree_iters.append(tree_iter)
         urls.append(node['pic'])
     self.liststore_nodes.timestamp = time.time()
     Net.async_call(Net.update_liststore_images, self.liststore_nodes,
                    0, tree_iters, urls)
示例#33
0
 def _append_artist_similar(similar_args, error=None):
     artists, self.artist_similar_total = similar_args
     if error or not self.artist_similar_total:
         return
     urls = []
     tree_iters = []
     for artist in artists:
         _info = ''.join([artist['songnum'], _(' songs'), ])
         tree_iter = self.artist_similar_liststore.append([
             self.app.theme['anonymous'],
             Widgets.unescape(artist['name']),
             int(artist['id']),
             _info,
             Widgets.set_tooltip(artist['name'], _info),
             ])
         urls.append(artist['pic'])
         tree_iters.append(tree_iter)
     Net.update_artist_logos(
             self.artist_similar_liststore, 0, tree_iters, urls)
     self.artist_similar_page += 1
     if self.artist_similar_page < self.artist_similar_total - 1:
         self.append_artist_similar()
示例#34
0
 def _append_artist_albums(albums_args, error=None):
     albums, self.artist_albums_total = albums_args
     if error or self.artist_albums_total == 0:
         return
     urls = []
     tree_iters = []
     for album in albums:
         tree_iter = self.artist_albums_liststore.append([
             self.app.theme['anonymous'],
             Widgets.unescape(album['name']),
             int(album['albumid']),
             Widgets.unescape(album['artist']),
             int(album['artistid']),
             Widgets.set_tooltip(album['name'], album['info']),
             ])
         urls.append(album['pic'])
         tree_iters.append(tree_iter)
     Net.update_album_covers(
             self.artist_albums_liststore, 0, tree_iters, urls)
     self.artist_albums_page += 1
     if self.artist_albums_page < self.artist_albums_total - 1:
         self.append_artist_albums()
示例#35
0
 def _append_songs(songs_args, error=None):
     songs, self.songs_total = songs_args
     if self.songs_total == 0:
         return
     i = len(self.liststore_songs)
     for song in songs:
         self.liststore_songs.append([
             self.app.theme['anonymous'],
             Widgets.unescape(song['name']),
             Widgets.unescape(song['artist']),
             Widgets.unescape(song['album']),
             int(song['id']),
             int(song['artistid']), 
             int(song['albumid']),
             Widgets.set_tooltip(song['name'], song['artist']),
             ])
         Net.update_mv_image(
                 self.liststore_songs, i, 0, song['mvpic'])
         i += 1
     self.songs_page += 1
     if self.songs_page < self.songs_total - 1:
         self.append_songs()
示例#36
0
文件: MV.py 项目: anchowee/kwplayer
 def _append_songs(songs_args, error=None):
     songs, self.songs_total = songs_args
     if self.songs_total == 0:
         return
     i = len(self.liststore_songs)
     for song in songs:
         self.liststore_songs.append([
             self.app.theme['anonymous'],
             song['name'],
             song['artist'],
             song['album'],
             int(song['id']),
             int(song['artistid']), 
             int(song['albumid']),
             Widgets.set_tooltip(song['name'], song['artist']),
             ])
         Net.update_mv_image(self.liststore_songs, i, 0,
                 song['mvpic'])
         i += 1
     self.songs_page += 1
     if self.songs_page < self.songs_total - 1:
         self.append_songs()
示例#37
0
 def on_append_artists(info, error=None):
     artists, self.artists_total = info
     if error or not self.artists_total or not artists:
         return
     urls = []
     tree_iters = []
     for artist in artists:
         _info = ' '.join([
             artist['music_num'],
             _(' songs'),
         ])
         tree_iter = self.artists_liststore.append([
             self.app.theme['anonymous'],
             Widgets.unescape(artist['name']),
             int(artist['id']),
             _info,
             Widgets.set_tooltip(artist['name'], _info),
         ])
         urls.append(artist['pic'])
         tree_iters.append(tree_iter)
     Net.update_artist_logos(self.artists_liststore, 0, tree_iters,
                             urls)
示例#38
0
 def _append_artist_albums(albums_args, error=None):
     albums, self.artist_albums_total = albums_args
     if error or self.artist_albums_total == 0:
         return
     urls = []
     tree_iters = []
     for album in albums:
         tree_iter = self.artist_albums_liststore.append([
             self.app.theme['anonymous'],
             Widgets.unescape(album['name']),
             int(album['albumid']),
             Widgets.unescape(album['artist']),
             int(album['artistid']),
             Widgets.set_tooltip(album['name'], album['info']),
         ])
         urls.append(album['pic'])
         tree_iters.append(tree_iter)
     Net.update_album_covers(self.artist_albums_liststore, 0,
                             tree_iters, urls)
     self.artist_albums_page += 1
     if self.artist_albums_page < self.artist_albums_total - 1:
         self.append_artist_albums()
示例#39
0
 def _append_songs(songs_args, error=None):
     songs, self.songs_total = songs_args
     if error or not self.songs_total:
         return
     urls = []
     tree_iters = []
     for song in songs:
         tree_iter = self.liststore_songs.append([
             self.app.theme['anonymous'],
             Widgets.unescape(song['name']),
             Widgets.unescape(song['artist']),
             Widgets.unescape(song['album']),
             int(song['id']),
             int(song['artistid']),
             int(song['albumid']),
             Widgets.set_tooltip(song['name'], song['artist']),
         ])
         tree_iters.append(tree_iter)
         urls.append(song['mvpic'])
     Net.update_mv_images(self.liststore_songs, 0, tree_iters, urls)
     self.songs_page += 1
     if self.songs_page < self.songs_total - 1:
         self.append_songs()
示例#40
0
 def _append_artist_similar(similar_args, error=None):
     artists, self.artist_similar_total = similar_args
     if self.artist_similar_total == 0:
         return
     i = len(self.artist_similar_liststore)
     for artist in artists:
         _info = ''.join([
             artist['songnum'],
             _(' songs'),
         ])
         self.artist_similar_liststore.append([
             self.app.theme['anonymous'],
             Widgets.unescape(artist['name']),
             int(artist['id']),
             _info,
             Widgets.set_tooltip(artist['name'], _info),
         ])
         Net.update_artist_logo(self.artist_similar_liststore, i, 0,
                                artist['pic'])
         i += 1
     self.artist_similar_page += 1
     if self.artist_similar_page < self.artist_similar_total - 1:
         self.append_artist_similar()
示例#41
0
 def _append_artist_mv(mv_args, error=None):
     mvs, self.artist_mv_total = mv_args
     if error or self.artist_mv_total == 0:
         return
     urls = []
     tree_iters = []
     for mv in mvs:
         tree_iter = self.artist_mv_liststore.append([
             self.app.theme['anonymous'],
             Widgets.unescape(mv['name']),
             Widgets.unescape(mv['artist']),
             '',
             int(mv['musicid']),
             int(mv['artistid']),
             0,
             Widgets.set_tooltip(mv['name'], mv['artist']),
         ])
         tree_iters.append(tree_iter)
         urls.append(mv['pic'])
     Net.update_mv_images(self.artist_mv_liststore, 0, tree_iters, urls)
     self.artist_mv_page += 1
     if self.artist_mv_page < self.artist_mv_total - 1:
         self.append_artist_mv()
示例#42
0
 def _on_get_nodes(info, error):
     if not info or not info[0] or not info[1] or error:
         logger.error('TopCategories._on_get_nodes(): %s, %s' %
                      (info, error))
         return
     nodes, total_pages = info
     urls = []
     tree_iters = []
     for node in nodes:
         # skip 'xx专区'
         if node['disname'].endswith('专区'):
             continue
         tree_iter = self.liststore_main.append([
             Config.ANONYMOUS_PIXBUF,
             Widgets.unescape(node['disname']),
             int(node['id']),
             Widgets.unescape(node['info']),
             Widgets.set_tooltip(node['disname'], node['info']),
         ])
         tree_iters.append(tree_iter)
         urls.append(node['pic'])
     self.liststore_main.timestamp = time.time()
     Net.async_call(Net.update_liststore_images, self.liststore_main, 0,
                    tree_iters, urls)
示例#43
0
文件: Artists.py 项目: zihua/kwplayer
 def _append_artist_albums(albums_args, error=None):
     albums, self.artist_albums_total = albums_args
     if error or self.artist_albums_total == 0:
         logger.error('append_arttist_albums(): %s, %s' %
                      (self.artist_albums_total, error))
         return
     urls = []
     tree_iters = []
     for album in albums:
         tree_iter = self.artist_albums_liststore.append([
             Config.ANONYMOUS_PIXBUF,
             Widgets.unescape(album['name']),
             int(album['albumid']),
             Widgets.unescape(album['artist']),
             int(album['artistid']),
             Widgets.set_tooltip(album['name'], album['info']),
         ])
         urls.append(album['pic'])
         tree_iters.append(tree_iter)
     Net.async_call(Net.update_album_covers,
                    self.artist_albums_liststore, 0, tree_iters, urls)
     self.artist_albums_page += 1
     if self.artist_albums_page < self.artist_albums_total - 1:
         self.append_artist_albums()
示例#44
0
文件: Artists.py 项目: zihua/kwplayer
 def on_append_artists(info, error=None):
     artists, self.artists_total = info
     if error or not self.artists_total or not artists:
         logger.error('append_artists(), %s, %s, %s' %
                      (self.artists_total, artists, error))
         return
     urls = []
     tree_iters = []
     for artist in artists:
         _info = ' '.join([
             artist['music_num'],
             _(' songs'),
         ])
         tree_iter = self.artists_liststore.append([
             Config.ANONYMOUS_PIXBUF,
             Widgets.unescape(artist['name']),
             int(artist['id']),
             _info,
             Widgets.set_tooltip(artist['name'], _info),
         ])
         urls.append(artist['pic'])
         tree_iters.append(tree_iter)
     Net.async_call(Net.update_artist_logos, self.artists_liststore, 0,
                    tree_iters, urls)
示例#45
0
文件: MV.py 项目: Taliens/kwplayer
 def _append_songs(songs_args, error=None):
     songs, self.songs_total = songs_args
     if error or not self.songs_total:
         return
     urls = []
     tree_iters = []
     for song in songs:
         tree_iter = self.liststore_songs.append([
             self.app.theme['anonymous'],
             Widgets.unescape(song['name']),
             Widgets.unescape(song['artist']),
             Widgets.unescape(song['album']),
             int(song['id']),
             int(song['artistid']), 
             int(song['albumid']),
             Widgets.set_tooltip(song['name'], song['artist']),
             ])
         tree_iters.append(tree_iter)
         urls.append(song['mvpic'])
     Net.update_mv_images(
             self.liststore_songs, 0, tree_iters, urls)
     self.songs_page += 1
     if self.songs_page < self.songs_total - 1:
         self.append_songs()
示例#46
0
 def _append_artist_albums(albums_args, error=None):
     albums, self.artist_albums_total = albums_args
     if error or self.artist_albums_total == 0:
         logger.error('append_arttist_albums(): %s, %s' %
                      (self.artist_albums_taotal, error))
         return
     urls = []
     tree_iters = []
     for album in albums:
         tree_iter = self.artist_albums_liststore.append([
             Config.ANONYMOUS_PIXBUF,
             Widgets.unescape(album['name']),
             int(album['albumid']),
             Widgets.unescape(album['artist']),
             int(album['artistid']),
             Widgets.set_tooltip(album['name'], album['info']),
         ])
         urls.append(album['pic'])
         tree_iters.append(tree_iter)
     Net.async_call(Net.update_album_covers,
                    self.artist_albums_liststore, 0, tree_iters, urls)
     self.artist_albums_page += 1
     if self.artist_albums_page < self.artist_albums_total - 1:
         self.append_artist_albums()
示例#47
0
 def _on_get_nodes(info, error):
     if not info or not info[0] or not info[1] or error:
         logger.error('TopCategories._on_get_nodes(): %s, %s' %
                      (info, error))
         return
     nodes, total_pages = info
     urls = []
     tree_iters = []
     for node in nodes:
         # skip 'xx专区'
         if node['disname'].endswith('专区'):
             continue
         tree_iter = self.liststore_main.append([
             self.app.theme['anonymous'],
             Widgets.unescape(node['disname']),
             int(node['id']),
             Widgets.unescape(node['info']),
             Widgets.set_tooltip(node['disname'], node['info']),
         ])
         tree_iters.append(tree_iter)
         urls.append(node['pic'])
     self.liststore_main.timestamp = time.time()
     Net.async_call(Net.update_liststore_images, self.liststore_main, 0,
                    tree_iters, urls)
示例#48
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))
     for i, album in enumerate(albums):
         if 'info' in album and album['info']:
             tooltip = Widgets.set_tooltip(album['name'], album['info'])
         else:
             tooltip = Widgets.escape(album['name'])
         self.liststore_albums.append([
             self.app.theme['anonymous'],
             Widgets.unescape(album['name']),
             int(album['albumid']), 
             Widgets.unescape(album['artist']),
             int(album['artistid']),
             tooltip,
             ])
         Net.update_album_covers(
                 self.liststore_albums, i, 0, album['pic'])
示例#49
0
 def _append_artist_mv(mv_args, error=None):
     mvs, self.artist_mv_total = mv_args
     if error or self.artist_mv_total == 0:
         return
     urls = []
     tree_iters = []
     for mv in mvs:
         tree_iter = self.artist_mv_liststore.append([
             self.app.theme['anonymous'],
             Widgets.unescape(mv['name']),
             Widgets.unescape(mv['artist']),
             '',
             int(mv['musicid']),
             int(mv['artistid']),
             0,
             Widgets.set_tooltip(mv['name'], mv['artist']),
             ])
         tree_iters.append(tree_iter)
         urls.append(mv['pic'])
     Net.update_mv_images(
             self.artist_mv_liststore, 0, tree_iters, urls)
     self.artist_mv_page += 1
     if self.artist_mv_page < self.artist_mv_total - 1:
         self.append_artist_mv()
示例#50
0
 def _append_artist_similar(similar_args, error=None):
     artists, self.artist_similar_total = similar_args
     if error or not self.artist_similar_total:
         logger.error('append_artist_similar(): %s, %s' %
                      (self.artist_similar_total, error))
         return
     urls = []
     tree_iters = []
     for artist in artists:
         _info = ''.join([artist['songnum'], _(' songs'), ])
         tree_iter = self.artist_similar_liststore.append([
             Config.ANONYMOUS_PIXBUF,
             Widgets.unescape(artist['name']),
             int(artist['id']),
             _info,
             Widgets.set_tooltip(artist['name'], _info),
         ])
         urls.append(artist['pic'])
         tree_iters.append(tree_iter)
     Net.async_call(Net.update_artist_logos,
                    self.artist_similar_liststore, 0, tree_iters, urls)
     self.artist_similar_page += 1
     if self.artist_similar_page < self.artist_similar_total - 1:
         self.append_artist_similar()
示例#51
0
    def first(self):
        app = self.app

        self.buttonbox = Gtk.Box(spacing=5)
        self.pack_start(self.buttonbox, False, False, 0)

        self.button_main = Gtk.Button(_('Themes'))
        self.button_main.connect('clicked', self.on_button_main_clicked)
        self.buttonbox.pack_start(self.button_main, False, False, 0)

        self.button_sub = Gtk.Button('')
        self.button_sub.connect('clicked', self.on_button_sub_clicked)
        self.buttonbox.pack_start(self.button_sub, False, False, 0)

        self.label = Gtk.Label('')
        self.buttonbox.pack_start(self.label, False, False, 0)

        # checked, name, artist, album, rid, artistid, albumid
        self.liststore_songs = Gtk.ListStore(bool, str, str, str, int, int,
                                             int)
        self.control_box = Widgets.ControlBox(self.liststore_songs, app)
        self.buttonbox.pack_end(self.control_box, False, False, 0)

        self.scrolled_main = Gtk.ScrolledWindow()
        self.pack_start(self.scrolled_main, True, True, 0)
        # pic, name, id, info(num of lists), tooltip
        self.liststore_main = Gtk.ListStore(GdkPixbuf.Pixbuf, str, int, str,
                                            str)
        iconview_main = Widgets.IconView(self.liststore_main, tooltip=4)
        iconview_main.connect('item_activated',
                              self.on_iconview_main_item_activated)
        self.scrolled_main.add(iconview_main)

        self.scrolled_sub = Gtk.ScrolledWindow()
        self.scrolled_sub.get_vadjustment().connect(
            'value-changed', self.on_scrolled_sub_scrolled)
        self.pack_start(self.scrolled_sub, True, True, 0)
        # pic, name, sourceid, info(num of lists), tooltip
        self.liststore_sub = Gtk.ListStore(GdkPixbuf.Pixbuf, str, int, str,
                                           str)
        iconview_sub = Widgets.IconView(self.liststore_sub, tooltip=4)
        iconview_sub.connect('item_activated',
                             self.on_iconview_sub_item_activated)
        self.scrolled_sub.add(iconview_sub)

        self.scrolled_songs = Gtk.ScrolledWindow()
        self.scrolled_songs.get_vadjustment().connect(
            'value-changed', self.on_scrolled_songs_scrolled)
        self.pack_start(self.scrolled_songs, True, True, 0)
        treeview_songs = Widgets.TreeViewSongs(self.liststore_songs, app)
        self.scrolled_songs.add(treeview_songs)

        self.show_all()
        self.buttonbox.hide()
        self.scrolled_sub.hide()
        self.scrolled_songs.hide()

        nodes = Net.get_themes_main()
        if not nodes:
            print('Failed to get nodes, do something!')
            return
        for i, node in enumerate(nodes):
            self.liststore_main.append([
                self.app.theme['anonymous'],
                Widgets.unescape(node['name']),
                int(node['nid']),
                Widgets.unescape(node['info']),
                Widgets.set_tooltip(node['name'], node['info']),
            ])
            Net.update_liststore_image(self.liststore_main, i, 0, node['pic'])
示例#52
0
    def first(self):
        app = self.app

        self.buttonbox = Gtk.Box(spacing=5)
        self.pack_start(self.buttonbox, False, False, 0)

        self.button_main = Gtk.Button(_('Top Categories'))
        self.button_main.connect('clicked', self.on_button_main_clicked)
        self.buttonbox.pack_start(self.button_main, False, False, 0)

        self.button_sub1 = Gtk.Button('')
        self.button_sub1.connect('clicked', self.on_button_sub1_clicked)
        self.buttonbox.pack_start(self.button_sub1, False, False, 0)

        self.button_sub2 = Gtk.Button('')
        self.button_sub2.connect('clicked', self.on_button_sub2_clicked)
        self.buttonbox.pack_start(self.button_sub2, False, False, 0)

        self.label = Gtk.Label('')
        self.buttonbox.pack_start(self.label, False, False, 0)

        # checked, name, artist, album, rid, artistid, albumid
        self.liststore_songs = Gtk.ListStore(
                bool, str, str, str, int, int, int)
        self.control_box = Widgets.ControlBox(self.liststore_songs, app)
        self.buttonbox.pack_end(self.control_box, False, False, 0)

        self.scrolled_main = Gtk.ScrolledWindow()
        self.pack_start(self.scrolled_main, True, True, 0)
        # logo, name, nid, num of lists(info), tooltip
        self.liststore_main = Gtk.ListStore(
                GdkPixbuf.Pixbuf, str, int, str, str)
        iconview_main = Widgets.IconView(self.liststore_main, tooltip=4)
        iconview_main.connect(
                'item_activated', self.on_iconview_main_item_activated)
        self.scrolled_main.add(iconview_main)

        self.scrolled_sub1 = Gtk.ScrolledWindow()
        self.pack_start(self.scrolled_sub1, True, True, 0)
        # logo, name, nid, num of lists(info), tooltip
        self.liststore_sub1 = Gtk.ListStore(
                GdkPixbuf.Pixbuf, str, int, str, str)
        iconview_sub1 = Widgets.IconView(self.liststore_sub1, tooltip=4)
        iconview_sub1.connect(
                'item_activated', self.on_iconview_sub1_item_activated)
        self.scrolled_sub1.add(iconview_sub1)

        self.scrolled_sub2 = Gtk.ScrolledWindow()
        self.pack_start(self.scrolled_sub2, True, True, 0)
        # logo, name, nid, info, tooltip
        self.liststore_sub2 = Gtk.ListStore(
                GdkPixbuf.Pixbuf, str, int, str, str)
        iconview_sub2 = Widgets.IconView(self.liststore_sub2, tooltip=4)
        iconview_sub2.connect(
                'item_activated', self.on_iconview_sub2_item_activated)
        self.scrolled_sub2.add(iconview_sub2)

        self.scrolled_songs = Gtk.ScrolledWindow()
        self.pack_start(self.scrolled_songs, True, True, 0)
        treeview_songs = Widgets.TreeViewSongs(self.liststore_songs, app)
        self.scrolled_songs.add(treeview_songs)

        self.show_all()
        self.buttonbox.hide()
        self.scrolled_sub1.hide()
        self.scrolled_sub2.hide()
        self.scrolled_songs.hide()

        nid = 5
        page = 0
        nodes, total_page = Net.get_nodes(nid, page)
        if not nodes:
            print('Failed to get nodes, do something!')
            return
        urls = []
        tree_iters = []
        for node in nodes:
            # skip 'xx专区' categories
            if node['disname'].endswith('专区'):
                continue
            tree_iter = self.liststore_main.append([
                self.app.theme['anonymous'],
                Widgets.unescape(node['disname']),
                int(node['id']),
                Widgets.unescape(node['info']),
                Widgets.set_tooltip(node['disname'], node['info']),
                ])
            tree_iters.append(tree_iter)
            urls.append(node['pic'])
        self.liststore_main.timestamp = time.time()
        Net.update_liststore_images(
                self.liststore_main, 0, tree_iters, urls)
示例#53
0
    def first(self):
        app = self.app

        self.buttonbox = Gtk.Box(spacing=5)
        self.pack_start(self.buttonbox, False, False, 0)

        self.button_main = Gtk.Button(_('Top Categories'))
        self.button_main.connect('clicked', self.on_button_main_clicked)
        self.buttonbox.pack_start(self.button_main, False, False, 0)

        self.button_sub1 = Gtk.Button('')
        self.button_sub1.connect('clicked', self.on_button_sub1_clicked)
        self.buttonbox.pack_start(self.button_sub1, False, False, 0)

        self.button_sub2 = Gtk.Button('')
        self.button_sub2.connect('clicked', self.on_button_sub2_clicked)
        self.buttonbox.pack_start(self.button_sub2, False, False, 0)

        self.label = Gtk.Label('')
        self.buttonbox.pack_start(self.label, False, False, 0)

        # checked, name, artist, album, rid, artistid, albumid
        self.liststore_songs = Gtk.ListStore(bool, str, str, str, int, int,
                                             int)
        self.control_box = Widgets.ControlBox(self.liststore_songs, app)
        self.buttonbox.pack_end(self.control_box, False, False, 0)

        self.scrolled_main = Gtk.ScrolledWindow()
        self.pack_start(self.scrolled_main, True, True, 0)
        # logo, name, nid, num of lists(info), tooltip
        self.liststore_main = Gtk.ListStore(GdkPixbuf.Pixbuf, str, int, str,
                                            str)
        iconview_main = Widgets.IconView(self.liststore_main, tooltip=4)
        iconview_main.connect('item_activated',
                              self.on_iconview_main_item_activated)
        self.scrolled_main.add(iconview_main)

        self.scrolled_sub1 = Gtk.ScrolledWindow()
        self.pack_start(self.scrolled_sub1, True, True, 0)
        # logo, name, nid, num of lists(info), tooltip
        self.liststore_sub1 = Gtk.ListStore(GdkPixbuf.Pixbuf, str, int, str,
                                            str)
        iconview_sub1 = Widgets.IconView(self.liststore_sub1, tooltip=4)
        iconview_sub1.connect('item_activated',
                              self.on_iconview_sub1_item_activated)
        self.scrolled_sub1.add(iconview_sub1)

        self.scrolled_sub2 = Gtk.ScrolledWindow()
        self.pack_start(self.scrolled_sub2, True, True, 0)
        # logo, name, nid, info, tooltip
        self.liststore_sub2 = Gtk.ListStore(GdkPixbuf.Pixbuf, str, int, str,
                                            str)
        iconview_sub2 = Widgets.IconView(self.liststore_sub2, tooltip=4)
        iconview_sub2.connect('item_activated',
                              self.on_iconview_sub2_item_activated)
        self.scrolled_sub2.add(iconview_sub2)

        self.scrolled_songs = Gtk.ScrolledWindow()
        self.pack_start(self.scrolled_songs, True, True, 0)
        treeview_songs = Widgets.TreeViewSongs(self.liststore_songs, app)
        self.scrolled_songs.add(treeview_songs)

        self.show_all()
        self.buttonbox.hide()
        self.scrolled_sub1.hide()
        self.scrolled_sub2.hide()
        self.scrolled_songs.hide()

        nid = 5
        page = 0
        nodes, total_page = Net.get_nodes(nid, page)
        if not nodes:
            print('Failed to get nodes, do something!')
            return
        for i, node in enumerate(nodes):
            self.liststore_main.append([
                self.app.theme['anonymous'],
                Widgets.unescape(node['disname']),
                int(node['id']),
                Widgets.unescape(node['info']),
                Widgets.set_tooltip(node['disname'], node['info']),
            ])
            Net.update_liststore_image(self.liststore_main, i, 0, node['pic'])
示例#54
0
    def first(self):
        app = self.app

        self.buttonbox = Gtk.Box(spacing=5)
        self.pack_start(self.buttonbox, False, False, 0)

        self.button_main = Gtk.Button(_('Themes'))
        self.button_main.connect('clicked', self.on_button_main_clicked)
        self.buttonbox.pack_start(self.button_main, False, False, 0)

        self.button_sub = Gtk.Button('')
        self.button_sub.connect('clicked', self.on_button_sub_clicked)
        self.buttonbox.pack_start(self.button_sub, False, False, 0)

        self.label = Gtk.Label('')
        self.buttonbox.pack_start(self.label, False, False, 0)

        # checked, name, artist, album, rid, artistid, albumid
        self.liststore_songs = Gtk.ListStore(
                bool, str, str, str, int, int, int)
        self.control_box = Widgets.ControlBox(self.liststore_songs, app)
        self.buttonbox.pack_end(self.control_box, False, False, 0)

        self.scrolled_main = Gtk.ScrolledWindow()
        self.pack_start(self.scrolled_main, True, True, 0)
        # pic, name, id, info(num of lists), tooltip
        self.liststore_main = Gtk.ListStore(
                GdkPixbuf.Pixbuf, str, int, str, str)
        iconview_main = Widgets.IconView(self.liststore_main, tooltip=4)
        iconview_main.connect(
                'item_activated', self.on_iconview_main_item_activated)
        self.scrolled_main.add(iconview_main)

        self.scrolled_sub = Gtk.ScrolledWindow()
        self.scrolled_sub.get_vadjustment().connect(
                'value-changed', self.on_scrolled_sub_scrolled)
        self.pack_start(self.scrolled_sub, True, True, 0)
        # pic, name, sourceid, info(num of lists), tooltip
        self.liststore_sub = Gtk.ListStore(
                GdkPixbuf.Pixbuf, str, int, str, str)
        iconview_sub = Widgets.IconView(self.liststore_sub, tooltip=4)
        iconview_sub.connect(
                'item_activated', self.on_iconview_sub_item_activated)
        self.scrolled_sub.add(iconview_sub)

        self.scrolled_songs = Gtk.ScrolledWindow()
        self.scrolled_songs.get_vadjustment().connect(
                'value-changed', self.on_scrolled_songs_scrolled)
        self.pack_start(self.scrolled_songs, True, True, 0)
        treeview_songs = Widgets.TreeViewSongs(self.liststore_songs, app)
        self.scrolled_songs.add(treeview_songs)

        self.show_all()
        self.buttonbox.hide()
        self.scrolled_sub.hide()
        self.scrolled_songs.hide()

        nodes = Net.get_themes_main()
        if not nodes:
            print('Failed to get nodes, do something!')
            return
        for i, node in enumerate(nodes):
            self.liststore_main.append([
                self.app.theme['anonymous'],
                Widgets.unescape(node['name']),
                int(node['nid']),
                Widgets.unescape(node['info']),
                Widgets.set_tooltip(node['name'], node['info']),
                ])
            Net.update_liststore_image(
                    self.liststore_main, i, 0, node['pic'])