def createControls(self): self.controls = [] for i in range(5): c = controls.control_factory("labelv", "field%i"%i) c.x = 0 c.y = i * 20 c.width = 100 c.height = 20 self.controls.append(c)
def test_width(self): """ Width should return the width from the origin to the right edge of the rightmost control """ for c in self.controls: self.aggregate_control.add_control(c) # all of the controls in self.controls go from origin to x=100 self.assertEqual(self.aggregate_control.width, 100) # add another control that goes to 110 c = controls.control_factory("led", "led", x=100, width=10) self.aggregate_control.add_control(c) self.assertEqual(self.aggregate_control.width, 110)
def test_allcontrols(self): l = Layout.createEmpty() tp = Tabpage() tp.name = "Demo" tp.append(controls.control_factory("led","led", color=self.randColor(), x=0, y=0)) tp.append(controls.control_factory("labelv","labelv", color=self.randColor(), x=100, y=0)) tp.append(controls.control_factory("labelh","labelh", color=self.randColor(), x=200, y=0)) tp.append(controls.control_factory("push", "push", color=self.randColor(), x=300, y=0)) tp.append(controls.control_factory("toggle", "toggle", color=self.randColor(), x=400, y=0)) tp.append(controls.control_factory("xy", "xy", color=self.randColor(), x=500, y=0, width=200, height=200)) tp.append(controls.control_factory("faderv","faderv", color=self.randColor(), x=0, y=100)) tp.append(controls.control_factory("faderh","faderh", color=self.randColor(), x=100, y=100)) tp.append(controls.control_factory("rotaryv","rotaryv", color=self.randColor(), x=200, y=100)) tp.append(controls.control_factory("rotaryh","rotaryh", color=self.randColor(), x=300, y=100)) tp.append(controls.control_factory("encoder", "encoder", color=self.randColor(), x=400, y=100)) tp.append(controls.control_factory("batteryv","batteryv", color=self.randColor(), x=0, y=200)) tp.append(controls.control_factory("batteryh","batteryh", color=self.randColor(), x=100, y=200)) tp.append(controls.control_factory("timev","timev", color=self.randColor(), x=200, y=200)) tp.append(controls.control_factory("timeh","timeh", color=self.randColor(), x=300, y=200)) tp.append(controls.control_factory("multipush", "multipush", color=self.randColor(), x=0, y=300, width=300, height=300)) tp.append(controls.control_factory("multitoggle", "multitoggle", color=self.randColor(), x=300, y=300, width=300, height=300)) tp.append(controls.control_factory("multifaderh", "multifaderh", color=self.randColor(), x=0, y=600, width=300, height=300)) tp.append(controls.control_factory("multifaderv", "multifaderv", color=self.randColor(), x=300, y=600, width=300, height=300)) tp.append(controls.control_factory("multixy", "multixy", color=self.randColor(), x=600, y=300, height=600, width=150)) l.addTabpage(tp) l.writeToFile("/home/mjcarroll", "Demo.touchosc", True)
def test_allcontrols(self): l = Layout.createEmpty() tp = Tabpage() tp.name = "Demo" tp.append( controls.control_factory("led", "led", color=self.randColor(), x=0, y=0)) tp.append( controls.control_factory("labelv", "labelv", color=self.randColor(), x=100, y=0)) tp.append( controls.control_factory("labelh", "labelh", color=self.randColor(), x=200, y=0)) tp.append( controls.control_factory("push", "push", color=self.randColor(), x=300, y=0)) tp.append( controls.control_factory("toggle", "toggle", color=self.randColor(), x=400, y=0)) tp.append( controls.control_factory("xy", "xy", color=self.randColor(), x=500, y=0, width=200, height=200)) tp.append( controls.control_factory("faderv", "faderv", color=self.randColor(), x=0, y=100)) tp.append( controls.control_factory("faderh", "faderh", color=self.randColor(), x=100, y=100)) tp.append( controls.control_factory("rotaryv", "rotaryv", color=self.randColor(), x=200, y=100)) tp.append( controls.control_factory("rotaryh", "rotaryh", color=self.randColor(), x=300, y=100)) tp.append( controls.control_factory("encoder", "encoder", color=self.randColor(), x=400, y=100)) tp.append( controls.control_factory("batteryv", "batteryv", color=self.randColor(), x=0, y=200)) tp.append( controls.control_factory("batteryh", "batteryh", color=self.randColor(), x=100, y=200)) tp.append( controls.control_factory("timev", "timev", color=self.randColor(), x=200, y=200)) tp.append( controls.control_factory("timeh", "timeh", color=self.randColor(), x=300, y=200)) tp.append( controls.control_factory("multipush", "multipush", color=self.randColor(), x=0, y=300, width=300, height=300)) tp.append( controls.control_factory("multitoggle", "multitoggle", color=self.randColor(), x=300, y=300, width=300, height=300)) tp.append( controls.control_factory("multifaderh", "multifaderh", color=self.randColor(), x=0, y=600, width=300, height=300)) tp.append( controls.control_factory("multifaderv", "multifaderv", color=self.randColor(), x=300, y=600, width=300, height=300)) tp.append( controls.control_factory("multixy", "multixy", color=self.randColor(), x=600, y=300, height=600, width=150)) l.addTabpage(tp) l.writeToFile("/home/mjcarroll", "Demo.touchosc", True)