예제 #1
0
            self.emit(SIGNAL('moved_x(int)'), x_diff)
        if e.y() != self._last_y:
            y_diff = e.y() - self._last_y
            self._last_y = e.y()
            self.emit(SIGNAL('moved_y(int)'), y_diff)
        self._diff = x_diff + y_diff / 2
        self.update()

    def mouseReleaseEvent(self, e):
        self._last_y = None
        self._last_x = None
        self._diff = None
        self.update()
        self.emit(SIGNAL('released()'))


if __name__ == '__main__':
    import utils
    class TestWheelPad(WheelPad):
        def __init__(self):
            WheelPad.__init__(self)
            QObject.connect(self, SIGNAL('moved_y(int)'),
                            self.print_value)
            QObject.connect(self, SIGNAL('moved_x(int)'),
                            self.print_value)
            QObject.connect(self, SIGNAL('released()'),
                            self.print_value)
        def print_value(self, value=None):
            print value
    utils.run_widget(TestWheelPad)
예제 #2
0
class Button(PixmapButton):
    def __init__(self, parent=None, color='gray'):
        PixmapButton.__init__(self, parent, 'button', 17, color)
        self.palette().setColor(QPalette.Window, POV_COLOR)

class MixerSlider(PixmapSlider):
    def __init__(self, parent=None):
        PixmapSlider.__init__(self, parent, 'mixerslider', 127)
        self.setOrientation(Qt.Vertical)
        self.palette().setColor(QPalette.Window, POV_COLOR)

class VerticalWheel(CyclicSlider):
    def __init__(self, parent=None):
        CyclicSlider.__init__(self, parent, 'verticalwheel', 23)
        self.palette().setColor(QPalette.Window, POV_COLOR)

class Knob(PixmapKnob):
    def __init__(self, parent=None):
        PixmapKnob.__init__(self, parent, 'knob', 127)
        self.setValue(64)
        self.setOrientation(Qt.Vertical)
        pixmap = QPixmap(path_for('knob', 0))
        self.setMask(pixmap.createHeuristicMask())



if __name__ == '__main__':
    import utils
    utils.run_widget(Knob)
예제 #3
0
        p.drawText(3, 10, self.text())

    def isEditting(self):
        return self.input.isShown()

    def endEdit(self):
        self.input.hide()

    def edit(self):
        if self.edittable:
            self.input.setText(self.text())
            self.input.raise_()
            self.input.show()
            self.input.selectAll()
            self.input.setFocus()
        
    def mouseReleaseEvent(self, e):
        self.edit()
        
    def slotTextChanged(self, text):
        self.emit(SIGNAL('textChanged'), (text, ))

    def setText(self, text):
        self.input.setText(text)
        QLabel.setText(self, text)


if __name__ == '__main__':
    import utils
    utils.run_widget(TextLabel)