Commit ff6e770d authored by Martin Drechsler's avatar Martin Drechsler

scale for some spinboxes added

parent c5d39b95
......@@ -111,15 +111,16 @@ class GuiMainWindow(QMainWindow):
self.piezoA397 = anal_control_signal('piezoA397', 13, out_minimum=0, out_maximum=4, out_step=0.01)
self.piezoB397 = anal_control_signal('piezoB397', 7, out_step = 0.01)
self.piezoA866 = anal_control_signal('piezoA866', 14, out_minimum=0, out_maximum=4, out_step=0.01)
self.piezoB866 = anal_control_signal('piezoB866', 6, out_step = 0.01)
self.piezoA423 = anal_control_signal('piezoA423', 1, out_step = 0.01)
self.piezoB866 = anal_control_signal('piezoB866', 9, out_step = 0.01, out_minimum= -2, out_maximum= 10)
self.piezoA423 = anal_control_signal('piezoA423', 8, out_step = 0.01)
self.trapDCA = anal_control_signal('DC A', 2)
self.trapDCB = anal_control_signal('DC B', 3)
self.trapDCB = anal_control_signal('DC B', 1)
self.trapCompC = anal_control_signal('Comp C', 4)
self.trapCompD = anal_control_signal('Comp D', 5)
self.trapCompOven = anal_control_signal('Comp Oven', 0)
self.trapCompExYb = anal_control_signal('Comp Ex Yb', 6)
......@@ -215,6 +216,8 @@ class GuiMainWindow(QMainWindow):
self.layout_trap_electrodes.addWidget(QtGui.QLabel(self.trapCompC.name), 1, 3), self.layout_trap_electrodes.addWidget(self.trapCompC.sb, 1, 4)
self.layout_trap_electrodes.addWidget(QtGui.QLabel(self.trapCompD.name), 2, 3), self.layout_trap_electrodes.addWidget(self.trapCompD.sb, 2, 4)
self.layout_trap_electrodes.addWidget(QtGui.QLabel(self.trapCompOven.name), 1, 5), self.layout_trap_electrodes.addWidget(self.trapCompOven.sb, 1, 6)
self.layout_trap_electrodes.addWidget(QtGui.QLabel(self.trapCompExYb.name), 2, 5), self.layout_trap_electrodes.addWidget(self.trapCompExYb.sb, 2, 6)
###########################################################
......
......@@ -40,6 +40,33 @@ class anal_control_signal(QWidget):
self.suffix = 'V'
self.sb = pg.SpinBox(value = self.initial_value, bounds=[self.min, self.max], step = self.step, siPrefix = self.siPrefix, suffix = self.suffix)
# set button context menu policy
self.sb.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
self.sb.customContextMenuRequested.connect(self.on_context_menu)
# create context menu
self.popMenu = QtGui.QMenu(self)
self.act_2_step = QtGui.QAction('2 mV steo', self)
self.act_5_step = QtGui.QAction('5 mV step', self)
self.act_10_step = QtGui.QAction('10 mV step', self)
self.act_100_step = QtGui.QAction('100 mV step', self)
self.popMenu.addAction(self.act_2_step)
self.popMenu.addAction(self.act_5_step)
self.popMenu.addAction(self.act_10_step)
self.popMenu.addAction(self.act_100_step)
self.act_2_step.triggered.connect(lambda: self.sb.setSingleStep(0.002))
self.act_5_step.triggered.connect(lambda: self.sb.setSingleStep(0.005))
self.act_10_step.triggered.connect(lambda: self.sb.setSingleStep(0.01))
self.act_100_step.triggered.connect(lambda: self.sb.setSingleStep(0.1))
try:
self.AO = daq_AO(self.ch)
except:
......@@ -79,6 +106,13 @@ class anal_control_signal(QWidget):
self.scan_feedfoward_step = 0
self.scan_feedfoward_analogOut = None
def on_context_menu(self, point):
# show context menu
self.popMenu.exec_(self.sb.mapToGlobal(point))
def sb_analog_change(self):
self.AO.set_out(self.sb.val)
......
......@@ -77,10 +77,6 @@ if __name__ == '__main__':
print(read_measurement(wavCoh))
while(1):
print(read_measurement(wavCoh))
time.sleep(0.5)
read_measurement_forever(wavCoh)
# print(a[12:20])
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment