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() )
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 )
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 QwtLinearColorMap *colorMap = QwtLinearColorMap( Qt.blue, Qt.red ) colorMap.addColorStop( 0.2, Qt.yellow ) colorMap.addColorStop( 0.3, Qt.cyan ) colorMap.addColorStop( 0.4, Qt.green ) #dcolorMap.addColorStop( 0.5, Qt.magenta ) colorMap.setMode( QwtLinearColorMap.FixedColors ) d_thermo.setColorMap( colorMap ) #endif""" self.layout = QVBoxLayout(self) #self.layout.setMargin( 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)