Commit 5d3a7e89 authored by Martin Drechsler's avatar Martin Drechsler

Already a final version. THe correct number for each channel remains to be decided.

parent 6d8a8497
......@@ -5,11 +5,8 @@ Created on Thu May 31 14:22:48 2018
@author: Usuario
"""
from ADoutputs import daq_AO, daq_DO
import pyqtgraph as pg
from pyqtgraph.Qt import QtGui
from myWidgets import anal_control_signal, digital_control_signal
#This creates the window for the gui
app = QtGui.QApplication([])
......@@ -26,49 +23,87 @@ win.show()
layout397 = QtGui.QGridLayout()
layout866 = QtGui.QGridLayout()
layoutPI = QtGui.QGridLayout()
layoutIMG = QtGui.QGridLayout()
layout.addLayout(layout397, 1, 1)
layout.addLayout(layout866, 2, 1)
layout.addLayout(layoutPI, 3, 1)
layout.addLayout(layoutIMG, 4, 1)
l1 = QtGui.QLabel()
l1.setGeometry(50, 50, 25, 25)
pixmap = QtGui.QPixmap("snuffles.png")
pixmap = pixmap.scaledToWidth(100)
l1.setPixmap(pixmap)
layoutIMG.addWidget(l1)
############ creating the controls ########################
piezoA397 = anal_control_signal('piezoA397', 0)
piezoB397 = anal_control_signal('piezoB397', 1)
piezoA866 = anal_control_signal('piezoA866', 2)
piezoB866 = anal_control_signal('piezoB866', 3)
piezoA423 = anal_control_signal('piezoA423', 4)
piezoA397 = {'sb': pg.SpinBox(value = 0.0, bounds=[-10, 10], step = .1, siPrefix = True, suffix = 'V'), 'daq': daq_AO(0)}
piezoB397 = pg.SpinBox(value = 0.0, bounds=[-10, 10], step = .1, siPrefix = True, suffix = 'V')
shutter397 = QtGui.QCheckBox(win)
shutter397 = digital_control_signal('shutter397', 0)
shutter866 = digital_control_signal('shutter866', 1)
shutter423 = digital_control_signal('shutter423', 2)
shutterLED = digital_control_signal('shutterLED', 3)
piezoA866 = pg.SpinBox(value = 0.0, bounds=[-10, 10], step = .1, siPrefix = True, suffix = 'V')
piezoB866 = pg.SpinBox(value = 0.0, bounds=[-10, 10], step = .1, siPrefix = True, suffix = 'V')
shutter866 = QtGui.QCheckBox(win)
piezoA423 = pg.SpinBox(value = 0.0, bounds=[-10, 10], step = .1, siPrefix = True, suffix = 'V')
shutter423 = QtGui.QCheckBox(win)
shutterLED = QtGui.QCheckBox(win)
######### 397 ###########
layout397.addWidget(QtGui.QLabel('397'), 0, 0)
layout397.addWidget(QtGui.QLabel('piezoA'), 1, 1), layout397.addWidget(piezoA397['sb'], 1, 2)
layout397.addWidget(QtGui.QLabel('piezoB'), 2, 1), layout397.addWidget(piezoB397, 2, 2)
layout397.addWidget(QtGui.QLabel('shutter'), 3, 1), layout397.addWidget(shutter397, 3, 2)
layout397.addWidget(QtGui.QLabel(piezoA397.name), 1, 1), layout397.addWidget(piezoA397.sb, 1, 2)
layout397.addWidget(QtGui.QLabel(piezoB397.name), 2, 1), layout397.addWidget(piezoB397.sb, 2, 2)
layout397.addWidget(QtGui.QLabel(shutter397.name), 3, 1), layout397.addWidget(shutter397.cb, 3, 2)
#layout397.addWidget(QtGui.QLabel('shutter'), 3, 1), layout397.addWidget(shutter397, 3, 2)
#########################
######### 866 ###########
layout866.addWidget(QtGui.QLabel('866'), 0, 0)
layout866.addWidget(QtGui.QLabel('piezoA'), 1, 1), layout866.addWidget(piezoA866, 1, 2)
layout866.addWidget(QtGui.QLabel('piezoB'), 2, 1), layout866.addWidget(piezoB866, 2, 2)
layout866.addWidget(QtGui.QLabel('shutter'), 3, 1), layout866.addWidget(shutter866, 3, 2)
layout866.addWidget(QtGui.QLabel(piezoA866.name), 1, 1), layout866.addWidget(piezoA866.sb, 1, 2)
layout866.addWidget(QtGui.QLabel(piezoB866.name), 2, 1), layout866.addWidget(piezoB866.sb, 2, 2)
layout866.addWidget(QtGui.QLabel(shutter866.name), 3, 1), layout866.addWidget(shutter866.cb, 3, 2)
#########################
######### PI ###########
layoutPI.addWidget(QtGui.QLabel('Photoion'), 0, 0)
layoutPI.addWidget(QtGui.QLabel('piezoA'), 1, 1), layoutPI.addWidget(piezoA423, 1, 2)
layoutPI.addWidget(QtGui.QLabel('shutter423'), 2, 1), layoutPI.addWidget(shutter423, 2, 2)
layoutPI.addWidget(QtGui.QLabel('shutterLED'), 3, 1), layoutPI.addWidget(shutterLED, 3, 2)
layoutPI.addWidget(QtGui.QLabel(piezoA423.name), 1, 1), layoutPI.addWidget(piezoA423.sb, 1, 2)
layoutPI.addWidget(QtGui.QLabel(shutter423.name), 2, 1), layoutPI.addWidget(shutter423.cb, 2, 2)
layoutPI.addWidget(QtGui.QLabel(shutterLED.name), 3, 1), layoutPI.addWidget(shutterLED.cb, 3, 2)
#########################
######### Here I define the connect functions ###########
def whenChange(sb, daq):
def whenChangeAnalog(sb, daq):
daq.set_out(sb.value())
def whenChangeDigital(cb, daq):
daq.set_out(cb.isChecked())
piezoA397['sb'].sigValueChanging.connect(lambda: whenChange(piezoA397['daq']))
piezoA397.sb.sigValueChanging.connect(lambda: whenChangeAnalog(piezoA397.sb, piezoA397.AO))
piezoB397.sb.sigValueChanging.connect(lambda: whenChangeAnalog(piezoB397.sb, piezoB397.AO))
piezoA866.sb.sigValueChanging.connect(lambda: whenChangeAnalog(piezoA866.sb, piezoA866.AO))
piezoB866.sb.sigValueChanging.connect(lambda: whenChangeAnalog(piezoB866.sb, piezoB866.AO))
piezoA423.sb.sigValueChanging.connect(lambda: whenChangeAnalog(piezoA423.sb, piezoA423.AO))
shutter397.cb.stateChanged.connect(lambda: whenChangeDigital(shutter397.cb, shutter397.DO))
shutter866.cb.stateChanged.connect(lambda: whenChangeDigital(shutter866.cb, shutter866.DO))
shutter423.cb.stateChanged.connect(lambda: whenChangeDigital(shutter423.cb, shutter423.DO))
shutterLED.cb.stateChanged.connect(lambda: whenChangeDigital(shutterLED.cb, shutterLED.DO))
###########################################################
#all shutter start in False:
shutters = [shutter397, shutter866, shutter423, shutterLED]
for sh in shutters:
sh.DO.set_out(False)
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