class HSliderClass(VerticalPanel): """ example of control which pairs up two other controls. should really be made into a control itself. """ def __init__(self, p2): VerticalPanel.__init__(self) self.setSpacing(10) if p2: self.b = HorizontalDemoSlider2(0, 100) else: self.b = HorizontalDemoSlider(0, 100) self.add(self.b) self.b.setHeight("20px") self.b.setWidth("100px") self.b.addControlValueListener(self) self.label = InputControl(0, 100) self.add(self.label) self.label.addControlValueListener(self) def onControlValueChanged(self, sender, old_value, new_value): if sender == self.label: self.b.setControlPos(new_value) self.b.setValue(new_value, 0) if sender == self.b: self.label.setControlPos(new_value) self.label.setValue(new_value, 0)
class HorizontalSliderClass(VerticalPanel): def __init__(self, p2): VerticalPanel.__init__(self) self.setSpacing(10) if p2: self.b = HorizontalDemoSlider2(0, 100) else: self.b = HorizontalDemoSlider(0, 100) self.add(self.b) self.b.setHeight("20px") self.b.setWidth("100px") self.b.addControlValueListener(self) self.label = InputControl(0, 100) self.add(self.label) self.label.addControlValueListener(self) def onControlValueChanged(self, sender, old_value, new_value): if sender == self.label: self.b.setControlPos(new_value) self.b.setValue(new_value, 0) if sender == self.b: self.label.setControlPos(new_value) self.label.setValue(new_value, 0)
class HSliderClass(VerticalPanel): def __init__(self, p2): VerticalPanel.__init__(self) self.setSpacing(10) if p2: self.b = HorizontalDemoSlider2(0, 100) else: self.b = HorizontalDemoSlider(0, 100) self.add(self.b) self.b.setHeight("20px") self.b.setWidth("100px") self.b.addControlValueListener(self) self.label = InputControl(0, 100) self.add(self.label) self.label.addControlValueListener(self) def onControlValueChanged(self, sender, old_value, new_value): if sender == self.label: self.b.setControlPos(new_value) self.b.setValue(new_value, 0) if sender == self.b: self.label.setControlPos(new_value) self.label.setValue(new_value, 0)
def __init__(self, p2): VerticalPanel.__init__(self) self.setSpacing(10) if p2: self.b = HorizontalDemoSlider2(0, 100) else: self.b = HorizontalDemoSlider(0, 100) self.add(self.b) self.b.setHeight("20px") self.b.setWidth("100px") self.b.addControlValueListener(self) self.label = InputControl(0, 100) self.add(self.label) self.label.addControlValueListener(self)