示例#1
0
    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)
示例#2
0
 def set_card_mixer(self, mixer = None, cid = 0):
     if( not mixer ):
         mixers = CardInfo.get_mixers(self.getint(self.get_default_section(), "card_index"))
         if (mixers):
             (mixer, cid) = mixers[0]
         else:
             mixer = "Master"
     c = self.get_card_section()
     self.set(c, "control", mixer)
     self.set(c, "cid", cid)
示例#3
0
 def set_liststore(self, card_index, liststore):
     card_index_cmp = self.config.getint(self.config.get_default_section(), "card_index")
     default_mixer = self.config.get(self.config.get_card_section(), "control")
     default_cid = self.config.getint(self.config.get_card_section(), "cid")
     mixers = CardInfo.get_mixers(card_index)
     liststore.clear()
     log.Notice("default_mixer = %s, default_cid = %i" % (default_mixer, default_cid))
     for mixer, cid in mixers:
         active = (card_index == card_index_cmp and mixer == default_mixer and cid == default_cid )
         weight = pango.WEIGHT_NORMAL
         if active:
             weight = pango.WEIGHT_BOLD
         liststore.append([active, weight, mixer, cid])
示例#4
0
 def init(self):
     for card_index, card_name in enumerate(CardInfo.get_cards()):
         self.add_mixer(Mixer(self.config, card_index, card_name))
示例#5
0
 def init(self):
     for control_name, cid in CardInfo.get_mixers(self.card_index):
         self.add_control(MixerControlFrame(self.config, self.card_index, control_name, cid))