示例#1
0
    def __init__(self, parent):
        QWidget.__init__(self, parent)
        self.d_thermo = Qwt.QwtThermo(self)
        self.d_thermo.setOrientation(Qt.Horizontal)
        self.d_thermo.setScalePosition(Qwt.QwtThermo.NoScale)
        self.d_thermo.setScale(0.0, 1.0)
        self.d_thermo.setFillBrush(Qt.green)

        self.label = QLabel("Tuning", self)
        self.label.setAlignment(Qt.AlignCenter)

        self.layout = QVBoxLayout(self)
        #self.layout.setMargin( 0 ) FIXME
        self.layout.addWidget(self.d_thermo)
        self.layout.addWidget(self.label)

        self.setFixedWidth(3 * self.label.sizeHint().width())
示例#2
0
    def __init__(self, title, parent):
        QWidget.__init__(self, parent)
        self.d_thermo = Qwt.QwtThermo(self)
        self.d_thermo.setPipeWidth(6)
        self.d_thermo.setScale(-40, 10)
        self.d_thermo.setFillBrush(Qt.green)
        self.d_thermo.setAlarmBrush(Qt.red)
        self.d_thermo.setAlarmLevel(0.0)
        self.d_thermo.setAlarmEnabled(True)

        label = QLabel(title, self)
        label.setAlignment(Qt.AlignTop | Qt.AlignLeft)

        self.layout = QVBoxLayout(self)
        #self.layout.setMargin( 0 )
        self.layout.setSpacing(0)
        self.layout.addWidget(self.d_thermo, 10)
        self.layout.addWidget(label)
示例#3
0
    def __init__(self, orientation, text, parent, value=0.0):
        QWidget.__init__(self, parent)
        self.d_label = QLabel(text, self)
        self.d_label.setFont(QFont("Helvetica", 10))

        self.d_thermo = Qwt.QwtThermo(self)
        self.d_thermo.setOrientation(orientation)
        self.d_thermo.setScale(0.0, 100.0)
        self.d_thermo.setValue(value)
        self.d_thermo.setFont(QFont("Helvetica", 8))
        self.d_thermo.setPipeWidth(6)
        self.d_thermo.setScaleMaxMajor(6)
        self.d_thermo.setScaleMaxMinor(5)
        self.d_thermo.setFillBrush(Qt.darkMagenta)

        #if 0
        colorMap = Qwt.QwtLinearColorMap(Qt.blue, Qt.red)

        colorMap.addColorStop(0.2, Qt.yellow)
        colorMap.addColorStop(0.3, Qt.cyan)
        colorMap.addColorStop(0.4, Qt.green)
        colorMap.addColorStop(0.5, Qt.magenta)
        colorMap.setMode(Qwt.QwtLinearColorMap.FixedColors)
        self.d_thermo.setColorMap(colorMap)
        #endif"""

        self.layout = QVBoxLayout(self)
        #self.layout.setCanvasMargin( 0 )
        self.layout.setSpacing(0)

        if (orientation == Qt.Horizontal):
            self.d_label.setAlignment(Qt.AlignCenter)
            self.d_thermo.setScalePosition(Qwt.QwtThermo.LeadingScale)
            self.layout.addWidget(self.d_label)
            self.layout.addWidget(self.d_thermo)
        else:
            self.d_label.setAlignment(Qt.AlignRight)
            self.d_thermo.setScalePosition(Qwt.QwtThermo.TrailingScale)
            self.layout.addWidget(self.d_thermo, 10, Qt.AlignHCenter)
            self.layout.addWidget(self.d_label, 0)
示例#4
0
    def createBox(self, orientation, typ):
        self.d_wheel = Qwt.QwtWheel()
        self.d_wheel.setValue(80)
        self.d_wheel.setWheelWidth(20)
        self.d_wheel.setMass(1.0)
        self.d_thermo = Qwt.QwtThermo()
        self.d_thermo.setOrientation(orientation)

        if (orientation == Qt.Horizontal):
            self.d_thermo.setScalePosition(Qwt.QwtThermo.LeadingScale)
            self.d_wheel.setOrientation(Qt.Vertical)
        else:
            self.d_thermo.setScalePosition(Qwt.QwtThermo.TrailingScale)
            self.d_wheel.setOrientation(Qt.Horizontal)
        if typ == 0:
            colorMap = Qwt.QwtLinearColorMap()
            colorMap.setColorInterval(Qt.blue, Qt.red)
            self.d_thermo.setColorMap(colorMap)
        elif typ == 1:
            colorMap = Qwt.QwtLinearColorMap()
            colorMap.setMode(Qwt.QwtLinearColorMap.FixedColors)
            idx = 4
            colorMap.setColorInterval(Qt.GlobalColor(idx),
                                      Qt.GlobalColor(idx + 10))
            for i in range(10):
                colorMap.addColorStop(i / 10.0, Qt.GlobalColor(idx + i))
            self.d_thermo.setColorMap(colorMap)
        elif typ == 2:
            self.d_wheel.setRange(10, 1000)
            self.d_wheel.setSingleStep(1.0)
            #self.d_thermo.setScaleEngine( Qwt.QwtLogScaleEngine )
            self.d_thermo.setScaleMaxMinor(10)
            self.d_thermo.setFillBrush(Qt.darkCyan)
            self.d_thermo.setAlarmBrush(Qt.magenta)
            self.d_thermo.setAlarmLevel(500.0)
            self.d_wheel.setValue(800)
        elif typ == 3:
            self.d_wheel.setRange(-1000, 1000)
            self.d_wheel.setSingleStep(1.0)
            #self.d_wheel.setPalette( QColor( "Tan" ) )

            #scaleEngine = Qwt.QwtLinearScaleEngine()
            #scaleEngine.setTransformation( Qwt.QwtPowerTransform( 2 ) )

            self.d_thermo.setScaleMaxMinor(5)
            #self.d_thermo.setScaleEngine( scaleEngine )

            pal = QPalette()
            pal.setColor(QPalette.Base, Qt.darkGray)
            #pal.setColor( QPalette.ButtonText, QColor( "darkKhaki" ) )

            self.d_thermo.setPalette(pal)
        elif typ == 4:
            self.d_wheel.setRange(-100, 300)
            self.d_wheel.setInverted(True)

            colorMap = Qwt.QwtLinearColorMap()
            colorMap.setColorInterval(Qt.darkCyan, Qt.yellow)
            self.d_thermo.setColorMap(colorMap)

            self.d_wheel.setValue(243)
        elif typ == 5:
            self.d_thermo.setFillBrush(Qt.darkCyan)
            self.d_thermo.setAlarmBrush(Qt.magenta)
            self.d_thermo.setAlarmLevel(60.0)
        elif typ == 6:
            self.d_thermo.setOriginMode(Qwt.QwtThermo.OriginMinimum)
            #self.d_thermo.setFillBrush( QBrush( "DarkSlateBlue" ) )
            #self.d_thermo.setAlarmBrush( QBrush( "DarkOrange" ) )
            self.d_thermo.setAlarmLevel(60.0)
        elif typ == 7:
            self.d_wheel.setRange(-100, 100)
            self.d_thermo.setOriginMode(Qwt.QwtThermo.OriginCustom)
            self.d_thermo.setOrigin(0.0)
            self.d_thermo.setFillBrush(Qt.darkBlue)

        dmin = self.d_wheel.minimum()
        dmax = self.d_wheel.maximum()

        #if ( self.d_wheel.isInverted() ):
        #    tmp = dmin
        #    dmin = dmax
        #    dmax = tmp
        #    #swap( dmin, dmax )
        self.d_thermo.setScale(dmin, dmax)
        self.d_thermo.setValue(self.d_wheel.value())
        self.d_wheel.valueChanged['double'].connect(self.d_thermo.setValue)

        box = QWidget()

        layout = None

        if (orientation == Qt.Horizontal):
            layout = QHBoxLayout(box)
        else:
            layout = QVBoxLayout(box)
        layout.addWidget(self.d_thermo, Qt.AlignCenter)
        layout.addWidget(self.d_wheel)
        return box