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
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'])
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
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)
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)
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)
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 nodes is None: return i = len(self.liststore_sub) for node in nodes: self.liststore_sub.append([self.app.theme['anonymous'], node['name'], int(node['sourceid']), node['info'], ]) Net.update_liststore_image(self.liststore_sub, i, 0, node['pic']) i += 1
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'])
def first(self): if self.first_show: return self.first_show = True app = self.app self.buttonbox = Gtk.Box() 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) self.liststore_main = Gtk.ListStore(GdkPixbuf.Pixbuf, str, int, str) iconview_main = Widgets.IconView(self.liststore_main) 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) self.liststore_sub1 = Gtk.ListStore(GdkPixbuf.Pixbuf, str, int, str) iconview_sub1 = Widgets.IconView(self.liststore_sub1, tooltip=1) 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 self.liststore_sub2 = Gtk.ListStore(GdkPixbuf.Pixbuf, str, int, str) iconview_sub2 = Widgets.IconView(self.liststore_sub2, tooltip=1) 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 nodes is None: print('Failed to get nodes, do something!') return i = 0 for node in nodes: self.liststore_main.append([self.app.theme['anonymous'], Widgets.unescape_html(node['disname']), int(node['id']), Widgets.unescape_html(node['info']), ]) Net.update_liststore_image(self.liststore_main, i, 0, node['pic']) i += 1
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)