Commit f636b3b3 authored by Martin Drechsler's avatar Martin Drechsler

More minor cahnges, timeout for the wavemeter and activation button.

parent d298911c
...@@ -18,7 +18,7 @@ try: ...@@ -18,7 +18,7 @@ try:
ao_range = ULRange.BIP10VOLTS ao_range = ULRange.BIP10VOLTS
except ModuleNotFoundError: except:
print('import error: mcculw not installed. In linux this might not be available. ') print('import error: mcculw not installed. In linux this might not be available. ')
#%% #%%
......
...@@ -6,11 +6,11 @@ Created on Thu May 31 14:22:48 2018 ...@@ -6,11 +6,11 @@ Created on Thu May 31 14:22:48 2018
""" """
import sys import sys
sys.setrecursionlimit(50000)
from pyqtgraph.Qt import QtCore, QtGui from pyqtgraph.Qt import QtCore, QtGui
from myWidgets import anal_control_signal, digital_control_signal from myWidgets import anal_control_signal, digital_control_signal, activation_button
from pyqtgraph import dockarea from pyqtgraph import dockarea
import pyqtgraph as pg import pyqtgraph as pg
...@@ -50,11 +50,11 @@ layout397_scan = pg.LayoutWidget() ...@@ -50,11 +50,11 @@ layout397_scan = pg.LayoutWidget()
layout866_scan = pg.LayoutWidget() layout866_scan = pg.LayoutWidget()
layout423_scan = pg.LayoutWidget() layout423_scan = pg.LayoutWidget()
layout_trap_electrodes = pg.LayoutWidget() layout_trap_electrodes = pg.LayoutWidget()
layout_activate = pg.LayoutWidget()
# Here I create the docks # Here I create the docks
s1 = 1 s1 = 100
s2 = 1 s2 = 100
d397 = dockarea.Dock("Dock397", size=(s1, s2)) d397 = dockarea.Dock("Dock397", size=(s1, s2))
d866 = dockarea.Dock("Dock866", size=(s1, s2)) d866 = dockarea.Dock("Dock866", size=(s1, s2))
dPI = dockarea.Dock("DockPI", size=(s1, s2)) dPI = dockarea.Dock("DockPI", size=(s1, s2))
...@@ -63,6 +63,8 @@ d397_scan = dockarea.Dock("Dock 397 scan", size=(s1, s2)) ...@@ -63,6 +63,8 @@ d397_scan = dockarea.Dock("Dock 397 scan", size=(s1, s2))
d866_scan = dockarea.Dock("Dock 866 scan", size=(s1, s2)) d866_scan = dockarea.Dock("Dock 866 scan", size=(s1, s2))
d423_scan = dockarea.Dock("Dock 423 scan", size=(s1, s2)) d423_scan = dockarea.Dock("Dock 423 scan", size=(s1, s2))
dtrap_electrodes = dockarea.Dock("Dock Trap Electrodes", size=(s1, s2)) dtrap_electrodes = dockarea.Dock("Dock Trap Electrodes", size=(s1, s2))
dactivate = dockarea.Dock(" ", hideTitle=False, size = (s1/4, s2))
dactivate.hideTitleBar()
# Here I add the docks # Here I add the docks
area.addDock( dtrap_electrodes) area.addDock( dtrap_electrodes)
...@@ -73,7 +75,7 @@ area.addDock(dWM, 'bottom', dPI) ...@@ -73,7 +75,7 @@ area.addDock(dWM, 'bottom', dPI)
area.addDock(d397_scan, 'right', d397) area.addDock(d397_scan, 'right', d397)
area.addDock(d423_scan, 'right', dPI) area.addDock(d423_scan, 'right', dPI)
area.addDock(d866_scan, 'right', d866) area.addDock(d866_scan, 'right', d866)
area.addDock(dactivate, 'right', dtrap_electrodes)
# Here I add the layouts to the corresponding dock # Here I add the layouts to the corresponding dock
...@@ -85,6 +87,8 @@ d397_scan.addWidget(layout397_scan) ...@@ -85,6 +87,8 @@ d397_scan.addWidget(layout397_scan)
d866_scan.addWidget(layout866_scan) d866_scan.addWidget(layout866_scan)
d423_scan.addWidget(layout423_scan) d423_scan.addWidget(layout423_scan)
dtrap_electrodes.addWidget(layout_trap_electrodes) dtrap_electrodes.addWidget(layout_trap_electrodes)
dactivate.addWidget(layout_activate)
############ creating the controls ######################## ############ creating the controls ########################
...@@ -162,30 +166,6 @@ layout_trap_electrodes.addWidget(QtGui.QLabel(trapCompD.name), 2, 3), layout_tra ...@@ -162,30 +166,6 @@ layout_trap_electrodes.addWidget(QtGui.QLabel(trapCompD.name), 2, 3), layout_tra
######### Here I define the connect functions ###########
def whenChangeAnalog(sb, daq):
daq.set_out(sb.value())
def whenChangeDigital(cb, daq):
daq.set_out(not cb.isChecked())
"""
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))
...@@ -198,16 +178,16 @@ try: ...@@ -198,16 +178,16 @@ try:
sh.DO.set_out(True) sh.DO.set_out(True)
except: except:
pass pass
###########################################################
#read wavemeter #read wavemeter
wavemeter_ok = False wavemeter_ok = False
try: try:
tn = telnetlib.Telnet(host = "wannanosaurus", port = 1234) tn = telnetlib.Telnet(host = "wannanosaurus", port = 1234, timeout = 1)
wavemeter_ok = True wavemeter_ok = True
except: except:
print('wm not connected') print('wannanosaurus not connected')
if wavemeter_ok: if wavemeter_ok:
tn.write(b'++eos 1\n') tn.write(b'++eos 1\n')
...@@ -240,6 +220,13 @@ if wavemeter_ok: ...@@ -240,6 +220,13 @@ if wavemeter_ok:
############################################################################### ###############################################################################
myToolbar.incorporate_toolbar(win, anal_control_signal._registry) myToolbar.incorporate_toolbar(win, anal_control_signal._registry)
############################################################################### ###############################################################################
import sys #activate button
actB = activation_button()
layout_activate.addWidget(actB.button)
###############################################################################
if (sys.flags.interactive != 1) or not hasattr(QtCore, 'PYQT_VERSION'): if (sys.flags.interactive != 1) or not hasattr(QtCore, 'PYQT_VERSION'):
QtGui.QApplication.instance().exec_() QtGui.QApplication.instance().exec_()
...@@ -7,9 +7,9 @@ This is a temporary script file. ...@@ -7,9 +7,9 @@ This is a temporary script file.
import pyqtgraph as pg import pyqtgraph as pg
from ADoutputs import daq_AO, daq_DO from ADoutputs import daq_AO, daq_DO
from pyqtgraph.Qt import QtGui from pyqtgraph.Qt import QtGui, QtCore
from PyQt5.QtCore import QBasicTimer from PyQt5.QtCore import QBasicTimer
from PyQt5.QtWidgets import (QPushButton, QWidget) from PyQt5.QtWidgets import (QPushButton, QWidget, QVBoxLayout)
#An example of a class #An example of a class
...@@ -109,6 +109,8 @@ class anal_control_signal(QWidget): ...@@ -109,6 +109,8 @@ class anal_control_signal(QWidget):
class digital_control_signal(QWidget): class digital_control_signal(QWidget):
def __init__(self, name, channel): def __init__(self, name, channel):
super().__init__()
self.name = name self.name = name
self.ch = channel self.ch = channel
...@@ -119,9 +121,28 @@ class digital_control_signal(QWidget): ...@@ -119,9 +121,28 @@ class digital_control_signal(QWidget):
print('Digital output %i not found. Daq might not be connected' % self.ch) print('Digital output %i not found. Daq might not be connected' % self.ch)
self.cb = QtGui.QCheckBox() self.cb = QtGui.QCheckBox()
self.cb.stateChanged.connect(self.whenChangeDigital)
def set_name(self, name): def set_name(self, name):
self.name = name self.name = name
def set_initial_value(self, value): def set_initial_value(self, value):
self.initial_value = value self.initial_value = value
def whenChangeDigital(self):
self.set_out(not self.cb.isChecked())
class activation_button(QWidget):
def __init__(self):
QWidget.__init__(self)
self.button = QPushButton('', self)
self.button.clicked.connect(self.handleButton)
self.button.setIcon(QtGui.QIcon('snuffles1.png'))
self.button.setIconSize(QtCore.QSize(48,48))
layout = QVBoxLayout(self)
layout.addWidget(self.button)
def handleButton(self):
self.button.setIcon(QtGui.QIcon('snuffles.png'))
\ No newline at end of file
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