Ejemplo n.º 1
0
    def __init__(self, p2):
        VerticalPanel.__init__(self)

        self.setSpacing(10)
        if p2:
            self.b = AreaDemoSlider2([0, 0], [100, 100], [0.2, 0.2])
        else:
            self.b = AreaDemoSlider([0, 0], [100, 100], [0.2, 0.2])
        self.add(self.b)

        self.b.setHeight("100px")
        self.b.setWidth("100px")

        self.b.addControlValueListener(self)

        self.label_x = MouseInputControl(0, 100, 0.2)
        self.add(self.label_x)

        self.label_x.addControlValueListener(self)

        self.label_y = MouseInputControl(0, 100, 0.2)
        self.add(self.label_y)

        self.label_y.addControlValueListener(self)
Ejemplo n.º 2
0
    def __init__(self, p2):
        VerticalPanel.__init__(self)

        self.setSpacing(10)
        if p2:
            self.b = AreaDemoSlider2((0,0), (100,100))
        else:
            self.b = AreaDemoSlider((0,0), (100,100))
        self.add(self.b)

        self.b.setHeight("100px")
        self.b.setWidth("100px")

        self.b.addControlValueListener(self)

        self.label_x = InputControl(0, 100)
        self.add(self.label_x)

        self.label_x.addControlValueListener(self)

        self.label_y = InputControl(0, 100)
        self.add(self.label_y)

        self.label_y.addControlValueListener(self)
Ejemplo n.º 3
0
    def __init__(self, p2):
        VerticalPanel.__init__(self)

        self.setSpacing(10)
        if p2:
            self.b = AreaDemoSlider2([0,0], [100,100], [0.2, 0.2])
        else:
            self.b = AreaDemoSlider([0,0], [100,100], [0.2, 0.2])
        self.add(self.b)

        self.b.setHeight("100px")
        self.b.setWidth("100px")

        self.b.addControlValueListener(self)

        self.label_x = MouseInputControl(0, 100, 0.2)
        self.add(self.label_x)

        self.label_x.addControlValueListener(self)

        self.label_y = MouseInputControl(0, 100, 0.2)
        self.add(self.label_y)

        self.label_y.addControlValueListener(self)
Ejemplo n.º 4
0
class ASliderClass(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 = AreaDemoSlider2([0, 0], [100, 100], [0.2, 0.2])
        else:
            self.b = AreaDemoSlider([0, 0], [100, 100], [0.2, 0.2])
        self.add(self.b)

        self.b.setHeight("100px")
        self.b.setWidth("100px")

        self.b.addControlValueListener(self)

        self.label_x = MouseInputControl(0, 100, 0.2)
        self.add(self.label_x)

        self.label_x.addControlValueListener(self)

        self.label_y = MouseInputControl(0, 100, 0.2)
        self.add(self.label_y)

        self.label_y.addControlValueListener(self)

    def onControlValueChanged(self, sender, old_value_xy, new_value_xy):

        #no use of old_values? (old_value_x,old_value_y)

        if (sender == self.label_x):

            self.b.setControlPos([new_value_xy, self.b.value_y])
            self.b.setValue([new_value_xy, self.b.value_y], 0)

        elif (sender == self.label_y):

            self.b.setControlPos([self.b.value_x, new_value_xy])
            self.b.setValue([self.b.value_x, new_value_xy], 0)

        elif (sender == self.b):

            (new_value_x, new_value_y) = new_value_xy

            self.label_x.setControlPos(new_value_x)
            self.label_x.setValue(new_value_x, 0)

            self.label_y.setControlPos(new_value_y)
            self.label_y.setValue(new_value_y, 0)
Ejemplo n.º 5
0
class ASliderClass(VerticalPanel):
    def __init__(self, p2):
        VerticalPanel.__init__(self)

        self.setSpacing(10)
        if p2:
            self.b = AreaDemoSlider2((0,0), (100,100))
        else:
            self.b = AreaDemoSlider((0,0), (100,100))
        self.add(self.b)

        self.b.setHeight("100px")
        self.b.setWidth("100px")

        self.b.addControlValueListener(self)

        self.label_x = InputControl(0, 100)
        self.add(self.label_x)

        self.label_x.addControlValueListener(self)

        self.label_y = InputControl(0, 100)
        self.add(self.label_y)

        self.label_y.addControlValueListener(self)

    def onControlValueChanged(self, sender,old_value_xy , new_value_xy):

        #no use of old_values? (old_value_x,old_value_y)

        if (sender == self.label_x):

            self.b.setControlPos((new_value_xy,self.b.value_y))
            self.b.setValue((new_value_xy,self.b.value_y), 0)       

        elif (sender == self.label_y):

            self.b.setControlPos((self.b.value_x,new_value_xy))
            self.b.setValue((self.b.value_x,new_value_xy), 0)

        elif (sender == self.b):

            (new_value_x,new_value_y) = new_value_xy

            self.label_x.setControlPos(new_value_x)
            self.label_x.setValue(new_value_x, 0)

            self.label_y.setControlPos(new_value_y)
            self.label_y.setValue(new_value_y, 0)
Ejemplo n.º 6
0
class ASliderClass(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 = AreaDemoSlider2([0,0], [100,100], [0.2, 0.2])
        else:
            self.b = AreaDemoSlider([0,0], [100,100], [0.2, 0.2])
        self.add(self.b)

        self.b.setHeight("100px")
        self.b.setWidth("100px")

        self.b.addControlValueListener(self)

        self.label_x = MouseInputControl(0, 100, 0.2)
        self.add(self.label_x)

        self.label_x.addControlValueListener(self)

        self.label_y = MouseInputControl(0, 100, 0.2)
        self.add(self.label_y)

        self.label_y.addControlValueListener(self)

    def onControlValueChanged(self, sender, old_value_xy, new_value_xy):

        #no use of old_values? (old_value_x,old_value_y)

        if (sender == self.label_x):

            self.b.setControlPos([new_value_xy, self.b.value_y])
            self.b.setValue([new_value_xy, self.b.value_y], 0)

        elif (sender == self.label_y):

            self.b.setControlPos([self.b.value_x, new_value_xy])
            self.b.setValue([self.b.value_x, new_value_xy], 0)

        elif (sender == self.b):

            (new_value_x,new_value_y) = new_value_xy

            self.label_x.setControlPos(new_value_x)
            self.label_x.setValue(new_value_x, 0)

            self.label_y.setControlPos(new_value_y)
            self.label_y.setValue(new_value_y, 0)