def _setup_tree(self): """ Sets up the tree that displays the radio panel """ box = self.builder.get_object('RadioPanel') self.tree = playlistpanel.PlaylistDragTreeView(self, True, True) self.tree.set_headers_visible(False) self.targets = [Gtk.TargetEntry.new('text/uri-list', 0, 0)] # columns text = Gtk.CellRendererText() if settings.get_option('gui/ellipsize_text_in_panels', False): from gi.repository import Pango text.set_property('ellipsize-set', True) text.set_property('ellipsize', Pango.EllipsizeMode.END) icon = Gtk.CellRendererPixbuf() col = Gtk.TreeViewColumn('radio') col.pack_start(icon, False) col.pack_start(text, True) col.set_attributes(icon, pixbuf=0) col.set_cell_data_func(text, self.cell_data_func) self.tree.append_column(col) self.model = Gtk.TreeStore(GdkPixbuf.Pixbuf, str, object) self.tree.set_model(self.model) self.track = icons.MANAGER.pixbuf_from_icon_name( 'audio-x-generic', Gtk.IconSize.SMALL_TOOLBAR) self.folder = icons.MANAGER.pixbuf_from_icon_name( 'folder', Gtk.IconSize.SMALL_TOOLBAR) self.refresh_image = icons.MANAGER.pixbuf_from_icon_name( 'view-refresh') self.custom = self.model.append( None, [self.folder, _("Saved Stations"), None]) self.radio_root = self.model.append( None, [self.folder, _("Radio " "Streams"), None]) scroll = Gtk.ScrolledWindow() scroll.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC) scroll.add(self.tree) scroll.set_shadow_type(Gtk.ShadowType.IN) box.pack_start(scroll, True, True, 0)
def _setup_tree(self): """ Sets up the tree that displays the radio panel """ box = self.builder.get_object('RadioPanel') self.tree = playlistpanel.PlaylistDragTreeView(self, True, True) self.tree.set_headers_visible(False) self.targets = [('text/uri-list', 0, 0)] # columns text = gtk.CellRendererText() if settings.get_option('gui/ellipsize_text_in_panels', False): import pango text.set_property('ellipsize-set', True) text.set_property('ellipsize', pango.ELLIPSIZE_END) icon = gtk.CellRendererPixbuf() col = gtk.TreeViewColumn('radio') col.pack_start(icon, False) col.pack_start(text, True) col.set_attributes(icon, pixbuf=0) col.set_cell_data_func(text, self.cell_data_func) self.tree.append_column(col) self.model = gtk.TreeStore(gtk.gdk.Pixbuf, str, object) self.tree.set_model(self.model) self.track = icons.MANAGER.pixbuf_from_icon_name( 'audio-x-generic', gtk.ICON_SIZE_SMALL_TOOLBAR) self.folder = self.tree.render_icon(gtk.STOCK_DIRECTORY, gtk.ICON_SIZE_SMALL_TOOLBAR) self.refresh_image = icons.MANAGER.pixbuf_from_stock(gtk.STOCK_REFRESH) self.custom = self.model.append( None, [self.folder, _("Saved Stations"), None]) self.radio_root = self.model.append( None, [self.folder, _("Radio " "Streams"), None]) scroll = gtk.ScrolledWindow() scroll.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) scroll.add(self.tree) scroll.set_shadow_type(gtk.SHADOW_IN) box.pack_start(scroll, True, True)