Esempio n. 1
0
 def show_sub(self, init=False):
     if init:
         self.scrolled_main.hide()
         self.scrolled_songs.hide()
         self.buttonbox.show_all()
         self.button_sub.hide()
         self.control_box.hide()
         self.scrolled_sub.get_vadjustment().set_value(0)
         self.scrolled_sub.show_all()
         self.nodes_page = 0
         self.liststore_sub.clear()
     nodes, self.nodes_total = Net.get_nodes(
             self.curr_sub_id, self.nodes_page)
     if not nodes:
         return
     for i, node in enumerate(nodes):
         self.liststore_sub.append([
             self.app.theme['anonymous'],
             Widgets.unescape(node['name']),
             int(node['sourceid']),
             Widgets.unescape(node['info']),
             Widgets.set_tooltip_with_song_tips(
                 node['name'], node['tips']),
             ])
         Net.update_liststore_image(
                 self.liststore_sub, i, 0, node['pic'])
Esempio n. 2
0
        def _on_show_sub2(sub2_args, error=None):
            nodes, self.sub2_total = sub2_args
            if error or not nodes or not self.sub2_total:
                logger.error('nodes: %s, self.sub2_total: %s, error: %s' %
                        (nodes, self.sub2_total, error))
                return
            urls = []
            tree_iters = []
            for node in nodes:
                tree_iter = self.liststore_sub2.append([
                    self.app.theme['anonymous'],
                    Widgets.unescape(node['name']),
                    int(node['sourceid']),
                    Widgets.unescape(node['info']),
                    Widgets.set_tooltip_with_song_tips(node['name'],
                                                       node['tips'])
                ])
                urls.append(node['pic'])
                tree_iters.append(tree_iter)
            Net.async_call(Net.update_liststore_images, self.liststore_sub2, 0,
                           tree_iters, urls)

            self.sub2_page += 1
            if self.sub2_page < self.sub2_total - 1:
                self.show_sub2()
Esempio n. 3
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()
Esempio n. 4
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()
Esempio n. 5
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()
Esempio n. 6
0
 def show_sub(self, init=False):
     if init:
         self.scrolled_main.hide()
         self.scrolled_songs.hide()
         self.buttonbox.show_all()
         self.button_sub.hide()
         self.control_box.hide()
         self.scrolled_sub.get_vadjustment().set_value(0)
         self.scrolled_sub.show_all()
         self.nodes_page = 0
         self.liststore_sub.clear()
     nodes, self.nodes_total = Net.get_nodes(self.curr_sub_id,
                                             self.nodes_page)
     if not nodes:
         return
     i = len(self.liststore_sub)
     for node in nodes:
         self.liststore_sub.append([
             self.app.theme['anonymous'],
             Widgets.unescape(node['name']),
             int(node['sourceid']),
             Widgets.unescape(node['info']),
             Widgets.set_tooltip_with_song_tips(node['name'], node['tips']),
         ])
         Net.update_liststore_image(self.liststore_sub, i, 0, node['pic'])
         i += 1
Esempio n. 7
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()
Esempio n. 8
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()
Esempio n. 9
0
        def _on_show_sub2(sub2_args, error=None):
            nodes, self.sub2_total = sub2_args
            if error or not nodes or not self.sub2_total:
                logger.error('nodes: %s, self.sub2_total: %s, error: %s' %
                             (nodes, self.sub2_total, error))
                return
            urls = []
            tree_iters = []
            for node in nodes:
                tree_iter = self.liststore_sub2.append([
                    Config.ANONYMOUS_PIXBUF,
                    Widgets.unescape(node['name']),
                    int(node['sourceid']),
                    Widgets.unescape(node['info']),
                    Widgets.set_tooltip_with_song_tips(node['name'],
                                                       node['tips'])
                ])
                urls.append(node['pic'])
                tree_iters.append(tree_iter)
            Net.async_call(Net.update_liststore_images, self.liststore_sub2, 0,
                           tree_iters, urls)

            self.sub2_page += 1
            if self.sub2_page < self.sub2_total - 1:
                self.show_sub2()
Esempio n. 10
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()
Esempio n. 11
0
    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(_('TopList'))
        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)

        # checked, name, artist, album, rid, artistid, albumid
        self.liststore_songs = Gtk.ListStore(bool, str, str, str, int, int,
                int)
        control_box = Widgets.ControlBox(self.liststore_songs, app)
        self.buttonbox.pack_end(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)
        treeview_songs = Widgets.TreeViewSongs(self.liststore_songs, app)
        self.scrolled_songs.add(treeview_songs)

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

        nid = 2
        page = 0
        nodes, total_pages = Net.get_nodes(nid, page)
        if total_pages == 0:
            return
        i = 0
        for node in nodes:
            self.liststore_nodes.append([
                self.app.theme['anonymous'],
                Widgets.unescape_html(node['name']),
                int(node['sourceid']),
                Widgets.unescape_html(node['info']),
                Widgets.set_tooltip_with_song_tips(node['name'],
                    node['tips']),
                ])
            Net.update_toplist_node_logo(self.liststore_nodes, i, 0, 
                    node['pic'])
            i += 1
Esempio n. 12
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(_('TopList'))
        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)

        # checked, name, artist, album, rid, artistid, albumid
        self.liststore_songs = Gtk.ListStore(bool, str, str, str, int, int,
                                             int)
        control_box = Widgets.ControlBox(self.liststore_songs, app)
        self.buttonbox.pack_end(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)
        treeview_songs = Widgets.TreeViewSongs(self.liststore_songs, app)
        self.scrolled_songs.add(treeview_songs)

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

        nid = 2
        page = 0
        nodes, total_pages = Net.get_nodes(nid, page)
        if total_pages == 0:
            return
        urls = []
        tree_iters = []
        for node in nodes:
            tree_iter = self.liststore_nodes.append([
                self.app.theme['anonymous'],
                Widgets.unescape(node['name']),
                int(node['sourceid']),
                Widgets.unescape(node['info']),
                Widgets.set_tooltip_with_song_tips(node['name'], node['tips']),
            ])
            urls.append(node['pic'])
            tree_iters.append(tree_iter)
        self.liststore_nodes.timestamp = time.time()
        Net.update_liststore_images(self.liststore_nodes, 0, tree_iters, urls)
Esempio n. 13
0
        def _show_sub2(sub2_args, error=None):
            nodes, self.sub2_total = sub2_args
            if not nodes or self.sub2_total == 0:
                return
            for i, node in enumerate(nodes):
                self.liststore_sub2.append([
                    self.app.theme['anonymous'],
                    Widgets.unescape(node['name']),
                    int(node['sourceid']),
                    Widgets.unescape(node['info']),
                    Widgets.set_tooltip_with_song_tips(
                        node['name'], node['tips']),
                    ])
                Net.update_liststore_image(
                        self.liststore_sub2, i, 0, node['pic'])

            self.sub2_page += 1
            if self.sub2_page < self.sub2_total - 1:
                self.show_sub2()
Esempio n. 14
0
 def on_show_sub(info, error=None):
     if error or not info or not info[0] or not info[1]:
         logger.error('show_sub(): %s, %s' % (info, error))
         return
     nodes, self.nodes_total = info
     urls = []
     tree_iters = []
     for node in nodes:
         tree_iter = self.liststore_sub.append([
             self.app.theme['anonymous'],
             Widgets.unescape(node['name']),
             int(node['sourceid']),
             Widgets.unescape(node['info']),
             Widgets.set_tooltip_with_song_tips(node['name'],
                                                node['tips']),
         ])
         tree_iters.append(tree_iter)
         urls.append(node['pic'])
     Net.async_call(Net.update_liststore_images, self.liststore_sub, 0,
                    tree_iters, urls)
Esempio n. 15
0
 def on_show_sub(info, error=None):
     if error or not info or not info[0] or not info[1]:
         logger.error('show_sub(): %s, %s' % (info, error))
         return
     nodes, self.nodes_total = info
     urls = []
     tree_iters = []
     for node in nodes:
         tree_iter = self.liststore_sub.append([
             Config.ANONYMOUS_PIXBUF,
             Widgets.unescape(node['name']),
             int(node['sourceid']),
             Widgets.unescape(node['info']),
             Widgets.set_tooltip_with_song_tips(node['name'],
                                                node['tips']),
         ])
         tree_iters.append(tree_iter)
         urls.append(node['pic'])
     Net.async_call(Net.update_liststore_images, self.liststore_sub, 0,
                    tree_iters, urls)
Esempio n. 16
0
 def on_show_sub(info, error=None):
     if error or not info:
         return
     nodes, self.nodes_total = info
     if not nodes:
         return
     urls = []
     tree_iters = []
     for node in nodes:
         tree_iter = self.liststore_sub.append([
             self.app.theme['anonymous'],
             Widgets.unescape(node['name']),
             int(node['sourceid']),
             Widgets.unescape(node['info']),
             Widgets.set_tooltip_with_song_tips(
                 node['name'], node['tips']),
             ])
         tree_iters.append(tree_iter)
         urls.append(node['pic'])
     Net.update_liststore_images(
             self.liststore_sub, 0, tree_iters, urls)
Esempio n. 17
0
        def _show_sub2(sub2_args, error=None):
            nodes, self.sub2_total = sub2_args
            if not nodes or self.sub2_total == 0:
                return
            i = len(self.liststore_sub2)
            for node in nodes:
                self.liststore_sub2.append([
                    self.app.theme['anonymous'],
                    Widgets.unescape(node['name']),
                    int(node['sourceid']),
                    Widgets.unescape(node['info']),
                    Widgets.set_tooltip_with_song_tips(node['name'],
                                                       node['tips']),
                ])
                Net.update_liststore_image(self.liststore_sub2, i, 0,
                                           node['pic'])
                i += 1

            self.sub2_page += 1
            if self.sub2_page < self.sub2_total - 1:
                self.show_sub2()
Esempio n. 18
0
 def on_show_sub(info, error=None):
     if error or not info:
         return
     nodes, self.nodes_total = info
     if not nodes:
         return
     urls = []
     tree_iters = []
     for node in nodes:
         tree_iter = self.liststore_sub.append([
             self.app.theme['anonymous'],
             Widgets.unescape(node['name']),
             int(node['sourceid']),
             Widgets.unescape(node['info']),
             Widgets.set_tooltip_with_song_tips(node['name'],
                                                node['tips']),
         ])
         tree_iters.append(tree_iter)
         urls.append(node['pic'])
     Net.update_liststore_images(self.liststore_sub, 0, tree_iters,
                                 urls)
Esempio n. 19
0
 def _on_get_nodes(info, error):
     if error or not info or not info[0] or not info[1]:
         logger.errror('_on_get_nodes(), info: %s, error: %s' %
                       (info, error))
         return
     nodes, total_pages = info
     urls = []
     tree_iters = []
     for node in nodes:
         tree_iter = self.liststore_nodes.append([
             Config.ANONYMOUS_PIXBUF,
             Widgets.unescape(node['name']),
             int(node['sourceid']),
             Widgets.unescape(node['info']),
             Widgets.set_tooltip_with_song_tips(node['name'],
                                                node['tips']),
         ])
         urls.append(node['pic'])
         tree_iters.append(tree_iter)
     self.liststore_nodes.timestamp = time.time()
     Net.async_call(Net.update_liststore_images, self.liststore_nodes, 0,
                    tree_iters, urls)
Esempio n. 20
0
 def _on_get_nodes(info, error):
     if error or not info or not info[0] or not info[1]:
         logger.errror('_on_get_nodes(), info: %s, error: %s' %
                       (info, error))
         return
     nodes, total_pages = info
     urls = []
     tree_iters = []
     for node in nodes:
         tree_iter = self.liststore_nodes.append([
             self.app.theme['anonymous'],
             Widgets.unescape(node['name']),
             int(node['sourceid']),
             Widgets.unescape(node['info']),
             Widgets.set_tooltip_with_song_tips(node['name'],
                                                node['tips']),
         ])
         urls.append(node['pic'])
         tree_iters.append(tree_iter)
     self.liststore_nodes.timestamp = time.time()
     Net.async_call(Net.update_liststore_images, self.liststore_nodes, 0,
                    tree_iters, urls)
Esempio n. 21
0
        def _show_sub2(sub2_args, error=None):
            nodes, self.sub2_total = sub2_args
            if error or not nodes or not self.sub2_total:
                return
            urls = []
            tree_iters = []
            for node in nodes:
                tree_iter = self.liststore_sub2.append([
                    self.app.theme['anonymous'],
                    Widgets.unescape(node['name']),
                    int(node['sourceid']),
                    Widgets.unescape(node['info']),
                    Widgets.set_tooltip_with_song_tips(node['name'],
                                                       node['tips']),
                ])
                urls.append(node['pic'])
                tree_iters.append(tree_iter)
            Net.update_liststore_images(self.liststore_sub2, 0, tree_iter,
                                        urls)

            self.sub2_page += 1
            if self.sub2_page < self.sub2_total - 1:
                self.show_sub2()