def create_knob(self): knob = Qwt.QwtKnob(self) knob.setRange(0, 180, 0, 1) knob.setScaleMaxMajor(10) knob.setKnobWidth(50) knob.setValue(100) return knob
def create_knob(self, letter): self.knob = Qwt.QwtKnob(self) self.knob.setRange(0, 20, 0, 0.1) self.knob.setScaleMaxMajor(10) self.knob.setKnobWidth(40) self.knob.setValue(self.p_value) self.knob.setStep(self.p_step) self.knob.valueChanged.connect(lambda: self.on_slider_moved(letter)) return self.knob
def create_knob(self): """ Purpose: create a knob Return: return a the knob widget """ knob = Qwt.QwtKnob(self) knob.setRange(0, 180, 0, 1) knob.setScaleMaxMajor(10) knob.setKnobWidth(50) knob.setValue(10) return knob
def __init__(self, title, min, max, parent): Qt.QWidget.__init__(self, parent) self.knob = Qwt.QwtKnob(self) self.knob.setRange(min, max, 0, 1) self.knob.setScaleMaxMajor(10) self.knob.setKnobWidth(50) self.label = Qt.QLabel(title, self) self.label.setAlignment(Qt.Qt.AlignTop | Qt.Qt.AlignHCenter) self.setSizePolicy(Qt.QSizePolicy.MinimumExpanding, Qt.QSizePolicy.MinimumExpanding)
def __init__(self, wgt, x, y, name, logscale=0): if logscale: self.knob = LogKnob(wgt) else: self.knob = Qwt.QwtKnob(wgt) color = Qt.QColor(200, 200, 210) self.knob.palette().setColor(Qt.QPalette.Active, Qt.QPalette.Button, color) self.lbl = Qt.QLabel(name, wgt) self.knob.setGeometry(x, y, 140, 100) # oooh, eliminate this ... if name[0] == 'o': self.knob.setKnobWidth(40) self.lbl.setGeometry(x, y + 90, 140, 15) self.lbl.setAlignment(Qt.Qt.AlignCenter)
def __init__(self, parent, tracking=False, minimum=0.0, maximum=1.0, step=0.0, scale_step=0.1, total_angle=270.0, knob_width=100, border_width=1, **kwargs): #signals = ['valueChanged'] pythics.libcontrol.Control.__init__(self, parent, **kwargs) self._widget = Qwt.QwtKnob(parent) self._widget.setTracking(tracking) self._widget.setScale(float(minimum), float(maximum), float(scale_step)) self._widget.setRange(float(minimum), float(maximum), float(step)) self._widget.setTotalAngle(float(total_angle)) self._widget.setKnobWidth(knob_width) self._widget.setBorderWidth(border_width)
def __init__(self, ipcon, uid): PluginBase.__init__(self, ipcon, uid) self.rp = bricklet_rotary_poti.RotaryPoti(self.uid) self.ipcon.add_device(self.rp) self.version = '.'.join(map(str, self.rp.get_version()[1])) self.qtcb_position.connect(self.cb_position) self.rp.register_callback(self.rp.CALLBACK_POSITION, self.qtcb_position.emit) self.position_knob = Qwt.QwtKnob(self) self.position_knob.setTotalAngle(300) self.position_knob.setScale(-150, 150, 30) self.position_knob.setRange(-150, 150) self.position_knob.setReadOnly(True) self.position_knob.setFocusPolicy(Qt.NoFocus) self.position_knob.setKnobWidth(40) self.position_label = PositionLabel('Position: ') self.current_value = 0 plot_list = [['', Qt.red, self.get_current_value]] self.plot_widget = PlotWidget('Position', plot_list) layout_h1 = QHBoxLayout() layout_h1.addStretch() layout_h1.addWidget(self.position_label) layout_h1.addStretch() layout_h2 = QHBoxLayout() layout_h2.addStretch() layout_h2.addWidget(self.position_knob) layout_h2.addStretch() layout = QVBoxLayout(self) layout.addLayout(layout_h1) layout.addLayout(layout_h2) layout.addWidget(self.plot_widget)
def initUI(self): # print('initUI()') # first column: contains the radio buttons to select the mode vbox = Qt.QVBoxLayout() self.qradio_mode_off = Qt.QRadioButton('Off') self.qradio_mode_off.setChecked(True) self.qradio_mode_slow = Qt.QRadioButton('Acquisition on slow PZT only') self.qradio_mode_fast = Qt.QRadioButton('Lock on fast PZT only') self.qradio_mode_both = Qt.QRadioButton('Lock on both PZTs') # self.qradio_mode_off.setEnabled(self.bDisplayLockChkBox) # self.qradio_mode_slow.setEnabled(self.bDisplayLockChkBox) # self.qradio_mode_fast.setEnabled(self.bDisplayLockChkBox) # self.qradio_mode_both.setEnabled(self.bDisplayLockChkBox) # Two checkboxes to flip the sign self.qchk_flip1 = Qt.QCheckBox('Flip sign on acquisition') self.qchk_flip2 = Qt.QCheckBox('Flip sign on lock') self.qradio_mode_off.clicked.connect(self.updateSettings) self.qradio_mode_slow.clicked.connect(self.updateSettings) self.qradio_mode_fast.clicked.connect(self.updateSettings) self.qradio_mode_both.clicked.connect(self.updateSettings) self.qgroup_mode = Qt.QButtonGroup(self) self.qgroup_mode.addButton(self.qradio_mode_off) self.qgroup_mode.addButton(self.qradio_mode_slow) self.qgroup_mode.addButton(self.qradio_mode_fast) self.qgroup_mode.addButton(self.qradio_mode_both) self.qchk_hold = Qt.QCheckBox('Hold both') self.qchk_hold.clicked.connect(self.updateSettings) self.qlabel_int1_state = Qt.QLabel('Integrator 1 state: Off') self.qlabel_int2_state = Qt.QLabel('Integrator 2 state: Off') vbox.addWidget(self.qradio_mode_off) vbox.addWidget(self.qradio_mode_slow) vbox.addWidget(self.qradio_mode_fast) vbox.addWidget(self.qradio_mode_both) #FEATURE #vbox.addWidget(self.qchk_flip1) #vbox.addWidget(self.qchk_flip2) #vbox.addWidget(self.qchk_hold) vbox.addWidget(self.qlabel_int1_state) vbox.addWidget(self.qlabel_int2_state) vbox.addStretch(1) ## The slow PZT integrators BW controls: # The label to indicate the predicted closed-loop BW self.qlabel_int1_gain = Qt.QLabel('Acquisition BW : 10 Hz') self.qlabel_int1_gain.setAlignment(Qt.Qt.AlignHCenter) # The knob to set the open-loop gain, and thus closed-loop BW self.qwtknob_int1_gain = Qwt.QwtKnob() self.qwtknob_int1_gain.setRange(-31, 31, 1) self.qwtknob_int1_gain.setScale(-31, 31, 4) self.qwtknob_int1_gain.setValue(-9) self.qwtknob_int1_gain.valueChanged.connect(self.setIntegratorGainEvent) self.qlabel_int2_gain = Qt.QLabel('Lock BW : 1 kHz') self.qlabel_int2_gain.setAlignment(Qt.Qt.AlignHCenter) # The knob to set the open-loop gain, and thus closed-loop BW self.qwtknob_int2_gain = Qwt.QwtKnob() self.qwtknob_int2_gain.setRange(-31, 31, 1) self.qwtknob_int2_gain.setScale(-31, 31, 4) self.qwtknob_int2_gain.setValue(-17) self.qwtknob_int2_gain.valueChanged.connect(self.setIntegratorGainEvent) self.qgroupbox_integrators = Qt.QGroupBox('Slow PZT integrators (DAC2/DAC2HV)') vbox_int = Qt.QVBoxLayout() vbox_int.addWidget(self.qlabel_int1_gain) vbox_int.addWidget(self.qwtknob_int1_gain) vbox_int.addWidget(self.qlabel_int2_gain) vbox_int.addWidget(self.qwtknob_int2_gain) self.qgroupbox_integrators.setLayout(vbox_int) # The controls for the fast PZT's loop filter settings, contains only one (composite) widget: self.qgroupbox_pll = Qt.QGroupBox('Fast PZT (DAC1)', self) # self.dac1_ui.setParent(self.qgroupbox_pll) vbox3 = Qt.QVBoxLayout() vbox3.addWidget(self.dac1_ui) self.qgroupbox_pll.setLayout(vbox3) # Put all the vboxes and groupboxes into a single layout: hbox = Qt.QHBoxLayout() hbox.addLayout(vbox) # hbox.addWidget(self.qgroupbox_integrators) hbox.addWidget(self.qgroupbox_pll) # hbox.addWidget(self.dac1_ui) hbox.setStretch(2, 1) self.setLayout(hbox)