Exemplo n.º 1
0
    def __init__(self, *args):
        Qt.QFrame.__init__(self, *args)

        self.frequencySlider = Qwt.QwtSlider(self, Qt.Qt.Horizontal,
                                             Qwt.QwtSlider.TopScale)
        self.frequencySlider.setScaleMaxMinor(5)
        self.frequencySlider.setScaleMaxMajor(12)
        self.frequencySlider.setThumbLength(80)
        self.frequencySlider.setBorderWidth(1)
        self.frequencySlider.setRange(87.5, 108, 0.01, 10)

        self.tuningThermo = TuningThermo(self)

        self.frequencyWheel = Qwt.QwtWheel(self)
        self.frequencyWheel.setMass(0.5)
        self.frequencyWheel.setRange(87.5, 108, 0.01)
        self.frequencyWheel.setTotalAngle(3600.0)

        self.connect(self.frequencyWheel, Qt.SIGNAL("valueChanged(double)"),
                     self.adjustFreq)
        self.connect(self.frequencySlider, Qt.SIGNAL("valueChanged(double)"),
                     self.adjustFreq)

        mainLayout = Qt.QVBoxLayout(self)
        mainLayout.setMargin(10)
        mainLayout.setSpacing(5)
        mainLayout.addWidget(self.frequencySlider)

        hLayout = Qt.QHBoxLayout()
        hLayout.setMargin(0)
        hLayout.addWidget(self.tuningThermo, 0)
        hLayout.addStretch(5)
        hLayout.addWidget(self.frequencyWheel, 2)

        mainLayout.addLayout(hLayout)
Exemplo n.º 2
0
 def __init__(self, parent=None, orientation=qt.Qt.Horizontal):
     qt.QWidget.__init__(self, parent)
     self.mainLayout = qt.QHBoxLayout(self)
     self.mainLayout.setMargin(0)
     self.wheel = Qwt5.QwtWheel(self)
     self.wheel.setOrientation(orientation)
     self.lineEdit = qt.QLineEdit(self)
     self.lineEdit.setText("")
     self.lineEdit.setReadOnly(True)
     self.mainLayout.addWidget(self.wheel)
     self.mainLayout.addWidget(self.lineEdit)
Exemplo n.º 3
0
 def __init__(self, parent=None, orientation=qt.Qt.Horizontal):
     qt.QWidget.__init__(self, parent)
     if orientation == qt.Qt.Horizontal:
         self.mainLayout = qt.QHBoxLayout(self)
         self.spacer = HorizontalSpacer(self)
     else:
         orientation = qt.Qt.Vertical
         self.mainLayout = qt.QVBoxLayout(self)
         self.spacer = VerticalSpacer(self)
     self.mainLayout.setMargin(0)
     self.wheel = Qwt5.QwtWheel(self)
     self.wheel.setOrientation(orientation)
     if orientation == qt.Qt.Horizontal:
         self.mainLayout.addWidget(self.wheel)
         self.mainLayout.addWidget(self.spacer)
     else:
         self.mainLayout.addWidget(self.spacer)
         self.mainLayout.addWidget(self.wheel)
    def __init__(self, *args):
        Qwt.QwtPlot.__init__(self, *args)

        self.setTitle("Interactive Plot")

        self.setCanvasColor(Qt.Qt.darkCyan)

        grid = Qwt.QwtPlotGrid()
        grid.attach(self)
        grid.setMajPen(Qt.QPen(Qt.Qt.white, 0, Qt.Qt.DotLine))

        self.setAxisScale(Qwt.QwtPlot.xBottom, 0.0, 100.0)
        self.setAxisScale(Qwt.QwtPlot.yLeft, 0.0, 100.0)

        # Avoid jumping when label with 3 digits
        # appear/disappear when scrolling vertically
        scaleDraw = self.axisScaleDraw(Qwt.QwtPlot.yLeft)
        scaleDraw.setMinimumExtent(
            scaleDraw.extent(Qt.QPen(),
                             self.axisWidget(Qwt.QwtPlot.yLeft).font()))

        self.plotLayout().setAlignCanvasToScales(True)

        self.__insertCurve(Qt.Qt.Vertical, Qt.Qt.blue, 30.0)
        self.__insertCurve(Qt.Qt.Vertical, Qt.Qt.magenta, 70.0)
        self.__insertCurve(Qt.Qt.Horizontal, Qt.Qt.yellow, 30.0)
        self.__insertCurve(Qt.Qt.Horizontal, Qt.Qt.white, 70.0)

        self.replot()

        scaleWidget = self.axisWidget(Qwt.QwtPlot.yLeft)
        scaleWidget.setMargin(10)

        self.__colorBar = ColorBar(Qt.Qt.Vertical, scaleWidget)
        self.__colorBar.setRange(Qt.QColor(Qt.Qt.red),
                                 Qt.QColor(Qt.Qt.darkBlue))
        self.__colorBar.setFocusPolicy(Qt.Qt.TabFocus)

        self.connect(self.__colorBar, Qt.SIGNAL('colorSelected'),
                     self.setCanvasColor)

        # we need the resize events, to lay out the color bar
        scaleWidget.installEventFilter(self)

        self.__wheel = Qwt.QwtWheel(self.canvas())
        self.__wheel.setOrientation(Qt.Qt.Vertical)
        self.__wheel.setRange(-100, 100)
        self.__wheel.setValue(0.0)
        self.__wheel.setMass(0.2)
        self.__wheel.setTotalAngle(4 * 360.0)

        self.connect(self.__wheel, Qt.SIGNAL('valueChanged(double)'),
                     self.scrollLeftAxis)

        # we need the resize events, to lay out the wheel
        self.canvas().installEventFilter(self)

        scaleWidget.setWhatsThis(
            'Selecting a value at the scale will insert a new curve.')
        self.__colorBar.setWhatsThis(
            'Selecting a color will change the background of the plot.')
        self.__wheel.setWhatsThis(
            'With the wheel you can move the visible area.')
        self.axisWidget(Qwt.QwtPlot.xBottom).setWhatsThis(
            'Selecting a value at the scale will insert a new curve.')