def init_card_combobox(self): """ Initialize combobox with list of audio cards """ icon_theme = gtk.icon_theme_get_default() if icon_theme.has_icon("audio-card"): icon = icon_theme.load_icon( "audio-card", 22, flags=gtk.ICON_LOOKUP_FORCE_SVG) else: file = os.path.join( self.config.res_dir, "icons", "audio-card.svg") pixbuf = gtk.gdk.pixbuf_new_from_file(file) icon = pixbuf.scale_simple(22, 22, gtk.gdk.INTERP_BILINEAR) self.combo_model = gtk.ListStore(int, gtk.gdk.Pixbuf, str) for index, card in enumerate(CardInfo.get_cards()): if card is not None: self.combo_model.append([index, icon, card]) default = self.config.get_default_section() card_combobox = self.tree.get_object("card_combobox") card_combobox.set_model(self.combo_model) card_combobox.set_active(self.config.getint(default, "card_index")) cell1 = gtk.CellRendererPixbuf() cell1.set_property("xalign", 0) cell1.set_property("xpad", 3) card_combobox.pack_start(cell1, False) card_combobox.add_attribute(cell1, "pixbuf", 1) cell2 = gtk.CellRendererText() cell2.set_property("xpad", 10) card_combobox.pack_start(cell2, True) card_combobox.set_attributes(cell2, text=2) card_combobox.connect("changed", self.on_card_combobox_changed)
def init(self): for card_index, card_name in enumerate(CardInfo.get_cards()): self.add_mixer(Mixer(self.config, card_index, card_name))