예제 #1
0
class CECPopup:
    def __init__(self, parent, label, values, init, rate, name, colour, tooltip, output=True):
        self.type = "popup"
        self.name = name
        self.output = output
        self.rate = rate
        self.label = Label(parent, label, colour=colour[0])
        self.popup = CustomMenu(parent, values, init, size=(100,20), outFunction=self.onPopup, colour=colour[1])
        self.label.SetToolTip(CECTooltip(TT_POPUP))
        if tooltip != '':
            self.popup.SetToolTip(CECTooltip(tooltip))
        
    def getName(self):
        return self.name

    def getValue(self):
        return self.popup.getIndex()

    def getFullValue(self):
        return self.popup.getIndex(), self.popup.getLabel()

    def getLabel(self):
        return self.popup.getLabel()

    def setValue(self, value, out=False):
        self.popup.setByIndex(value, out)

    def onPopup(self, value, label):
        if CeciliaLib.getVar("currentModule") != None and self.output and self.rate == "k":
            getattr(CeciliaLib.getVar("currentModule"), self.name)(value, label)
예제 #2
0
class CECPopup:
    def __init__(self, parent, label, values, init, name, colour, rate, tooltip):
        self.name = name
        self.label = Label(parent, label, colour=colour[0])
        self.rate = rate
        self.popup = CustomMenu(parent, values, init, size=(100,20), outFunction=self.onPopup, colour=colour[1])
        if tooltip != '':
            self.popup.SetToolTip(CECTooltip(tooltip))
        
    def getName(self):
        return self.name

    def getValue(self):
        return self.popup.getIndex()
        
    def setValue(self, value, out=False):
        self.popup.setByIndex(value, out)

    def getRate(self):
        return self.rate

    def onPopup(self, value, label):
        if self.getRate() == 'k':
            CeciliaLib.getCsound().setChannel("%s_value" % self.name, value)

    def getCeciliaText(self):
        orchtext = ''
        scotext = ''
        if self.rate == 'k':    
            orchtext += 'instr Cecilia_%s\n' % self.name
            orchtext += 'gk%s chnget "%s_value"\n' % (self.name, self.name)
            orchtext += 'endin\n\n'
            
            scotext += 'i "Cecilia_%s" 0 %f\n' % (self.name, CeciliaLib.getTotalTime())
        return orchtext, scotext