Ejemplo n.º 1
0
 def __init__(self,
              parent,
              label,
              init,
              rate,
              name,
              colour,
              tooltip,
              stack=False,
              output=True):
     self.type = "toggle"
     self.name = name
     self.rate = rate
     self.output = output
     if label != '':
         if stack:
             self.label = Label(parent,
                                label,
                                colour=colour[0],
                                size=(210, 20))
         else:
             self.label = Label(parent,
                                label,
                                colour=colour[0],
                                size=(100, 20))
         self.label.SetToolTip(CECTooltip(TT_TOGGLE))
     self.toggle = Toggle(parent,
                          init,
                          outFunction=self.onToggle,
                          colour=colour[1])
     if tooltip != '':
         self.toggle.SetToolTip(CECTooltip(tooltip))
Ejemplo n.º 2
0
 def __init__(self, parent, label, name, colour, tooltip):
     self.type = "button"
     self.name = name
     self.label = Label(parent, label, colour=colour[0])
     self.button = Button(parent, outFunction=self.onButton, colour=(colour[1],colour[0]))
     self.label.SetToolTip(CECTooltip(TT_BUTTON))
     if tooltip != '':
         self.button.SetToolTip(CECTooltip(tooltip))
Ejemplo n.º 3
0
 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))
Ejemplo n.º 4
0
 def __init__(self, parent, label, init, rate, name, popup, colour, tooltip):
     self.type = "gen"
     self.name = name
     self.rate = rate
     self.popup = popup
     self.oldLength = -1
     self.label = Label(parent, label, colour=colour[0])
     self.entry = ListEntry(parent, ", ".join([str(x) for x in init]), colour=colour[1], outFunction=self.onEntry)
     self.label.SetToolTip(CECTooltip(TT_GEN))
     if tooltip != '':
         self.label.SetToolTip(CECTooltip(tooltip))
Ejemplo n.º 5
0
class CECToggle:
    def __init__(self, parent, label, init, rate, name, colour, tooltip, stack=False, output=True):
        self.type = "toggle"
        self.name = name
        self.rate = rate
        self.output = output
        if label != '':
            if stack:
                self.label = Label(parent, label, colour=colour[0], size=(210, 20))
            else:
                self.label = Label(parent, label, colour=colour[0], size=(100, 20))
            self.label.SetToolTip(CECTooltip(TT_TOGGLE))
        self.toggle = Toggle(parent, init, outFunction=self.onToggle, colour=colour[1])
        if tooltip != '':
            self.toggle.SetToolTip(CECTooltip(tooltip))

    def getName(self):
        return self.name

    def getValue(self):
        return self.toggle.getValue()
    
    def setValue(self, state, dump=None):
        self.toggle.setValue(state)

    def onToggle(self, value):
        if CeciliaLib.getVar("currentModule") != None and self.output:
            getattr(CeciliaLib.getVar("currentModule"), self.name)(value)
Ejemplo n.º 6
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)
Ejemplo n.º 7
0
 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))
Ejemplo n.º 8
0
 def __init__(self, parent, name, label, mouseUpFunction, colour):
     ControlSlider.__init__(self, parent, 0.0001, 0.5, .001, log=True, 
                            size=(100, 15), backColour=BACKGROUND_COLOUR)
     self.name = name + 'spread'
     self.rate = "k"
     self.label = Label(parent, label, colour=colour[0])
     self.mouseUpFunction = mouseUpFunction
Ejemplo n.º 9
0
 def __init__(self, parent, label, init, name, colour, rate, tooltip):
     self.name = name
     self.label = Label(parent, label, colour=colour[0])
     self.rate = rate
     self.toggle = Toggle(parent, init, outFunction=self.onToggle, colour=colour[1])
     if tooltip != '':
         self.toggle.SetToolTip(CECTooltip(tooltip))
Ejemplo n.º 10
0
 def __init__(self, parent, label, name, trig, colour, tooltip):
     self.name = name
     self.rate = 'k'
     self.trig = trig
     self.label = Label(parent, label, colour=colour[0])
     self.button = Button(parent, outFunction=self.onButton, colour=(colour[1],colour[0]))
     if tooltip != '':
         self.button.SetToolTip(CECTooltip(tooltip))
Ejemplo n.º 11
0
 def __init__(self, parent, label, init, name, gen, size, colour, tooltip):
     self.name = name
     self.gen = gen
     self.size = size
     self.oldLength = -1
     self.label = Label(parent, label, colour=colour[0])
     self.entry = ListEntry(parent, init, colour=colour[1])
     if tooltip != '':
         self.toggle.SetToolTip(CECTooltip(tooltip))
Ejemplo n.º 12
0
class CECGen:
    def __init__(self, parent, label, init, rate, name, popup, colour,
                 tooltip):
        self.type = "gen"
        self.name = name
        self.rate = rate
        self.popup = popup
        self.oldLength = -1
        self.label = Label(parent, label, colour=colour[0])
        self.entry = ListEntry(parent,
                               ", ".join([str(x) for x in init]),
                               colour=colour[1],
                               outFunction=self.onEntry)
        self.label.SetToolTip(CECTooltip(TT_GEN))
        if tooltip != '':
            self.label.SetToolTip(CECTooltip(tooltip))

    def getName(self):
        return self.name

    def convertToList(self, value):
        if "," in value:
            value = value.split(',')
        else:
            value = value.split(" ")
        value = [eval(val) for val in value if val.strip() != ""]
        return value

    def getValue(self):
        return self.convertToList(self.entry.getValue())

    def setValue(self, value, dump=None):
        self.entry.setValue(value)

    def onEntry(self, value):
        if type(value) != ListType:
            value = self.convertToList(value)
        if CeciliaLib.getVar("currentModule") != None and self.rate == "k":
            getattr(CeciliaLib.getVar("currentModule"), self.name)(value)
        if self.popup != None:
            self.popup[0].setValue(self.popup[1], True)
Ejemplo n.º 13
0
 def __init__(self, parent, name, label, mouseUpFunction, colour):
     ControlSlider.__init__(self,
                            parent,
                            0.0001,
                            0.5,
                            .001,
                            log=True,
                            size=(100, 15))
     self.type = "polyslider"
     self.name = name + 'spread'
     self.label = Label(parent, label, colour=colour[0])
     self.mouseUpFunction = mouseUpFunction
Ejemplo n.º 14
0
class CECButton:
    def __init__(self, parent, label, name, colour, tooltip):
        self.type = "button"
        self.name = name
        self.label = Label(parent, label, colour=colour[0])
        self.button = Button(parent, outFunction=self.onButton, colour=(colour[1],colour[0]))
        self.label.SetToolTip(CECTooltip(TT_BUTTON))
        if tooltip != '':
            self.button.SetToolTip(CECTooltip(tooltip))

    def getValue(self):
        return 0
        
    def getName(self):
        return self.name

    def onButton(self, value):
        if CeciliaLib.getVar("currentModule") != None:
            getattr(CeciliaLib.getVar("currentModule"), self.name)(value)