Commit a2d3bda1 authored by Martin Drechsler's avatar Martin Drechsler

The Gui now should run even if the daq or wavemeter are not connected.

parent adb5eb68
......@@ -8,16 +8,20 @@ Created on Wed May 30 15:27:17 2018
from __future__ import absolute_import, division, print_function
try:
from mcculw import ul
from mcculw.enums import DigitalIODirection, ULRange
from examples.props.digital import DigitalProps
from examples.props.ao import AnalogOutputProps
from mcculw import ul
from mcculw.enums import DigitalIODirection, ULRange
from examples.props.digital import DigitalProps
from examples.props.ao import AnalogOutputProps
from mcculw.ul import ULError
from mcculw.ul import ULError
ao_range = ULRange.BIP10VOLTS
ao_range = ULRange.BIP10VOLTS
except ModuleNotFoundError:
print('import error: mcculw not installed. In linux this might not be available. ')
#%%
class daq_DO(object):
def __init__(self, out_num):
......
......@@ -112,43 +112,43 @@ shutterLED = digital_control_signal('shutterLED', 3)
######### 397 ###########
layout397.addWidget(QtGui.QLabel('397'), 0, 0)
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(piezoA397.name), 1, 0), layout397.addWidget(piezoA397.sb, 1, 1)
layout397.addWidget(QtGui.QLabel(piezoB397.name), 2, 0), layout397.addWidget(piezoB397.sb, 2, 1)
layout397.addWidget(QtGui.QLabel(shutter397.name), 3, 0), layout397.addWidget(shutter397.cb, 3, 1)
layout397_scan.addWidget(QtGui.QLabel('397 Scan piezo A'), 0, 0)
layout397_scan.addWidget(QtGui.QLabel('start'), 1, 1), layout397_scan.addWidget(piezoA397.scan_sb_start, 1, 2)
layout397_scan.addWidget(QtGui.QLabel('stop'), 2, 1), layout397_scan.addWidget(piezoA397.scan_sb_stop, 2, 2)
layout397_scan.addWidget(QtGui.QLabel('period'), 3, 1), layout397_scan.addWidget(piezoA397.scan_sb_period, 3, 2)
layout397_scan.addWidget(QtGui.QLabel('Scanning'), 4, 1), layout397_scan.addWidget(piezoA397.scan_button, 4, 2)
layout397_scan.addWidget(QtGui.QLabel('start'), 1, 0), layout397_scan.addWidget(piezoA397.scan_sb_start, 1, 1)
layout397_scan.addWidget(QtGui.QLabel('stop'), 2, 0), layout397_scan.addWidget(piezoA397.scan_sb_stop, 2, 1)
layout397_scan.addWidget(QtGui.QLabel('period'), 3, 0), layout397_scan.addWidget(piezoA397.scan_sb_period, 3, 1)
layout397_scan.addWidget(QtGui.QLabel('Scanning'), 4, 0), layout397_scan.addWidget(piezoA397.scan_button, 4, 1)
#########################
######### 866 ###########
layout866.addWidget(QtGui.QLabel('866'), 0, 0)
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)
layout866.addWidget(QtGui.QLabel(piezoA866.name), 1, 0), layout866.addWidget(piezoA866.sb, 1, 1)
layout866.addWidget(QtGui.QLabel(piezoB866.name), 2, 0), layout866.addWidget(piezoB866.sb, 2, 1)
layout866.addWidget(QtGui.QLabel(shutter866.name), 3, 0), layout866.addWidget(shutter866.cb, 3, 1)
layout866_scan.addWidget(QtGui.QLabel('866 Scan piezo B'), 0, 0)
layout866_scan.addWidget(QtGui.QLabel('start'), 1, 1), layout866_scan.addWidget(piezoB866.scan_sb_start, 1, 2)
layout866_scan.addWidget(QtGui.QLabel('stop'), 2, 1), layout866_scan.addWidget(piezoB866.scan_sb_stop, 2, 2)
layout866_scan.addWidget(QtGui.QLabel('period'), 3, 1), layout866_scan.addWidget(piezoB866.scan_sb_period, 3, 2)
layout866_scan.addWidget(QtGui.QLabel('Scanning'), 4, 1), layout866_scan.addWidget(piezoB866.scan_button, 4, 2)
layout866_scan.addWidget(QtGui.QLabel('start'), 1, 0), layout866_scan.addWidget(piezoB866.scan_sb_start, 1, 1)
layout866_scan.addWidget(QtGui.QLabel('stop'), 2, 0), layout866_scan.addWidget(piezoB866.scan_sb_stop, 2, 1)
layout866_scan.addWidget(QtGui.QLabel('period'), 3, 0), layout866_scan.addWidget(piezoB866.scan_sb_period, 3, 1)
layout866_scan.addWidget(QtGui.QLabel('Scanning'), 4, 0), layout866_scan.addWidget(piezoB866.scan_button, 4, 1)
#########################
######### PI ###########
layoutPI.addWidget(QtGui.QLabel('Photoion'), 0, 0)
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)
layoutPI.addWidget(QtGui.QLabel(piezoA423.name), 1, 0), layoutPI.addWidget(piezoA423.sb, 1, 1)
layoutPI.addWidget(QtGui.QLabel(shutter423.name), 2, 0), layoutPI.addWidget(shutter423.cb, 2, 1)
layoutPI.addWidget(QtGui.QLabel(shutterLED.name), 3, 0), layoutPI.addWidget(shutterLED.cb, 3, 1)
layout423_scan.addWidget(QtGui.QLabel('423 Scan piezo A'), 0, 0)
layout423_scan.addWidget(QtGui.QLabel('start'), 1, 1), layout423_scan.addWidget(piezoA423.scan_sb_start, 1, 2)
layout423_scan.addWidget(QtGui.QLabel('stop'), 2, 1), layout423_scan.addWidget(piezoA423.scan_sb_stop, 2, 2)
layout423_scan.addWidget(QtGui.QLabel('period'), 3, 1), layout423_scan.addWidget(piezoA423.scan_sb_period, 3, 2)
layout423_scan.addWidget(QtGui.QLabel('Scanning'), 4, 1), layout423_scan.addWidget(piezoA423.scan_button, 4, 2)
layout423_scan.addWidget(QtGui.QLabel('start'), 1, 0), layout423_scan.addWidget(piezoA423.scan_sb_start, 1, 1)
layout423_scan.addWidget(QtGui.QLabel('stop'), 2, 0), layout423_scan.addWidget(piezoA423.scan_sb_stop, 2, 1)
layout423_scan.addWidget(QtGui.QLabel('period'), 3, 0), layout423_scan.addWidget(piezoA423.scan_sb_period, 3, 1)
layout423_scan.addWidget(QtGui.QLabel('Scanning'), 4, 0), layout423_scan.addWidget(piezoA423.scan_button, 4, 1)
#########################
######### trap electrodes ###########
......@@ -193,9 +193,11 @@ shutterLED.cb.stateChanged.connect(lambda: whenChangeDigital(shutterLED.cb, shut
###########################################################
#all shutter start in False:
shutters = [shutter397, shutter866, shutter423, shutterLED]
for sh in shutters:
sh.DO.set_out(True)
try:
for sh in shutters:
sh.DO.set_out(True)
except:
pass
#read wavemeter
......
......@@ -9,7 +9,7 @@ Created on Thu Jul 5 12:17:30 2018
from PyQt5.QtCore import QSettings
from PyQt5.QtWidgets import QAction
from threading import Thread
#%%
def save(aos):
settings = QSettings('C:\\Users\\Usuario\\Documents\\control_app\\config.ini', QSettings.IniFormat)
......@@ -59,7 +59,7 @@ def incorporate_toolbar(win, analog_control_signals):
fileMenu.addAction(loadAct)
viewMenu = menubar.addMenu('Monitor')
viewWebcams = QAction('View webcams', checkable=True)
viewWebcams = QAction('View webcams', win, checkable=True)
viewWebcams.setChecked(False)
viewMenu.addAction(viewWebcams)
......
......@@ -32,9 +32,12 @@ 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)
try:
self.AO = daq_AO(self.ch)
except:
print('Analog output %i not found. Daq might not be connected' % self.ch)
self.sb.sigValueChanging.connect(self.sb_analog_change)
self.AO = daq_AO(self.ch)
self.scan_button = QPushButton('Start scan')
self.timer = QBasicTimer()
......@@ -47,7 +50,6 @@ class anal_control_signal(QWidget):
self.scan_direction = 0
self.scan_button.clicked.connect(self.doAction)
self.sb.sigValueChanging.connect(self.sb_analog_change)
self.spin_boxes = [('sb', self.sb), ('scan_sb_start', self.scan_sb_start), ('scan_sb_stop', self.scan_sb_stop), ('scan_sb_period', self.scan_sb_period)]
......@@ -111,8 +113,11 @@ class digital_control_signal(QWidget):
self.ch = channel
self.initial_value = 0
self.DO = daq_DO(self.ch)
try:
self.DO = daq_DO(self.ch)
except:
print('Digital output %i not found. Daq might not be connected' % self.ch)
self.cb = QtGui.QCheckBox()
def set_name(self, name):
......
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