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:
ao_range = ULRange.BIP10VOLTS
except ModuleNotFoundError:
except:
print('import error: mcculw not installed. In linux this might not be available. ')
#%%
......@@ -81,4 +81,4 @@ class daq_AO(object):
except ValueError:
return 0
######################################################################################
\ No newline at end of file
######################################################################################
......@@ -6,11 +6,11 @@ Created on Thu May 31 14:22:48 2018
"""
import sys
sys.setrecursionlimit(50000)
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
import pyqtgraph as pg
......@@ -50,11 +50,11 @@ layout397_scan = pg.LayoutWidget()
layout866_scan = pg.LayoutWidget()
layout423_scan = pg.LayoutWidget()
layout_trap_electrodes = pg.LayoutWidget()
layout_activate = pg.LayoutWidget()
# Here I create the docks
s1 = 1
s2 = 1
s1 = 100
s2 = 100
d397 = dockarea.Dock("Dock397", size=(s1, s2))
d866 = dockarea.Dock("Dock866", size=(s1, s2))
dPI = dockarea.Dock("DockPI", 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))
d423_scan = dockarea.Dock("Dock 423 scan", 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
area.addDock( dtrap_electrodes)
......@@ -73,7 +75,7 @@ area.addDock(dWM, 'bottom', dPI)
area.addDock(d397_scan, 'right', d397)
area.addDock(d423_scan, 'right', dPI)
area.addDock(d866_scan, 'right', d866)
area.addDock(dactivate, 'right', dtrap_electrodes)
# Here I add the layouts to the corresponding dock
......@@ -85,6 +87,8 @@ d397_scan.addWidget(layout397_scan)
d866_scan.addWidget(layout866_scan)
d423_scan.addWidget(layout423_scan)
dtrap_electrodes.addWidget(layout_trap_electrodes)
dactivate.addWidget(layout_activate)
############ creating the controls ########################
......@@ -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:
sh.DO.set_out(True)
except:
pass
###########################################################
#read wavemeter
wavemeter_ok = False
try:
tn = telnetlib.Telnet(host = "wannanosaurus", port = 1234)
tn = telnetlib.Telnet(host = "wannanosaurus", port = 1234, timeout = 1)
wavemeter_ok = True
except:
print('wm not connected')
print('wannanosaurus not connected')
if wavemeter_ok:
tn.write(b'++eos 1\n')
......@@ -240,6 +220,13 @@ if wavemeter_ok:
###############################################################################
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'):
QtGui.QApplication.instance().exec_()
\ No newline at end of file
QtGui.QApplication.instance().exec_()
......@@ -7,9 +7,9 @@ This is a temporary script file.
import pyqtgraph as pg
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.QtWidgets import (QPushButton, QWidget)
from PyQt5.QtWidgets import (QPushButton, QWidget, QVBoxLayout)
#An example of a class
......@@ -109,6 +109,8 @@ class anal_control_signal(QWidget):
class digital_control_signal(QWidget):
def __init__(self, name, channel):
super().__init__()
self.name = name
self.ch = channel
......@@ -119,9 +121,28 @@ class digital_control_signal(QWidget):
print('Digital output %i not found. Daq might not be connected' % self.ch)
self.cb = QtGui.QCheckBox()
self.cb.stateChanged.connect(self.whenChangeDigital)
def set_name(self, name):
self.name = name
def set_initial_value(self, value):
self.initial_value = value
\ No newline at end of file
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