Commit adb5eb68 authored by Martin Drechsler's avatar Martin Drechsler

new file: myToolbar and other minor changes (dc electrode added)

parent 317730db
......@@ -49,6 +49,7 @@ layoutWM = pg.LayoutWidget()
layout397_scan = pg.LayoutWidget()
layout866_scan = pg.LayoutWidget()
layout423_scan = pg.LayoutWidget()
layout_trap_electrodes = pg.LayoutWidget()
# Here I create the docks
......@@ -61,10 +62,11 @@ dWM = dockarea.Dock("DockWM", size=(s1, s2))
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))
# Here I add the docks
area.addDock(d397, 'left')
area.addDock( dtrap_electrodes)
area.addDock(d397, 'bottom', dtrap_electrodes)
area.addDock(d866, 'bottom', d397)
area.addDock(dPI, 'bottom', d866)
area.addDock(dWM, 'bottom', dPI)
......@@ -82,7 +84,7 @@ dWM.addWidget(layoutWM)
d397_scan.addWidget(layout397_scan)
d866_scan.addWidget(layout866_scan)
d423_scan.addWidget(layout423_scan)
dtrap_electrodes.addWidget(layout_trap_electrodes)
############ creating the controls ########################
......@@ -92,6 +94,11 @@ piezoA866 = anal_control_signal('piezoA866', 14, out_minimum=0, out_maximum=4, o
piezoB866 = anal_control_signal('piezoB866', 6)
piezoA423 = anal_control_signal('piezoA423', 1)
trapDCA = anal_control_signal('DC A', 2)
trapDCB = anal_control_signal('DC B', 3)
trapCompC = anal_control_signal('Comp C', 4)
trapCompD = anal_control_signal('Comp D', 5)
shutter397 = digital_control_signal('shutter397', 0)
......@@ -144,6 +151,16 @@ layout423_scan.addWidget(QtGui.QLabel('period'), 3, 1), layout423_scan.addWidget
layout423_scan.addWidget(QtGui.QLabel('Scanning'), 4, 1), layout423_scan.addWidget(piezoA423.scan_button, 4, 2)
#########################
######### trap electrodes ###########
layout_trap_electrodes.addWidget(QtGui.QLabel('Trap electrodes'), 0, 0)
layout_trap_electrodes.addWidget(QtGui.QLabel(trapDCA.name), 1, 1), layout_trap_electrodes.addWidget(trapDCA.sb, 1, 2)
layout_trap_electrodes.addWidget(QtGui.QLabel(trapDCB.name), 2, 1), layout_trap_electrodes.addWidget(trapDCB.sb, 2, 2)
layout_trap_electrodes.addWidget(QtGui.QLabel(trapCompC.name), 1, 3), layout_trap_electrodes.addWidget(trapCompC.sb, 1, 4)
layout_trap_electrodes.addWidget(QtGui.QLabel(trapCompD.name), 2, 3), layout_trap_electrodes.addWidget(trapCompD.sb, 2, 4)
#########################
######### Here I define the connect functions ###########
......@@ -182,33 +199,41 @@ for sh in shutters:
#read wavemeter
tn = telnetlib.Telnet(host = "wannanosaurus", port = 1234)
tn.write(b'++eos 1\n')
wavemeter_ok = False
lcd = QLCDNumber()
try:
tn = telnetlib.Telnet(host = "wannanosaurus", port = 1234)
wavemeter_ok = True
except:
print('wm not connected')
if wavemeter_ok:
tn.write(b'++eos 1\n')
lcd = QLCDNumber()
lcd.setDigitCount(9)
lcd.display("000000 00")
def update_label():
tn.sock_avail()
tn.write(b'++read <cr>\n')
a = tn.read_very_eager().decode("utf-8")
#print(a)
try:
lcd.display(a[3:12])
except:
lcd.display("000000 00")
lcd.setDigitCount(9)
lcd.display("000000 00")
def update_label():
tn.sock_avail()
tn.write(b'++read <cr>\n')
a = tn.read_very_eager().decode("utf-8")
#print(a)
try:
lcd.display(a[3:12])
except:
lcd.display("000000 00")
layoutWM.setGeometry(300, 300, 250, 150)
layoutWM.show()
layoutWM.setGeometry(300, 300, 250, 150)
layoutWM.show()
layoutWM.timer = QTimer()
layoutWM.timer.timeout.connect(update_label)
layoutWM.timer.start(1000) # every 10,000 milliseconds
layoutWM.addWidget(lcd)
dWM.addWidget(layoutWM)
layoutWM.timer = QTimer()
layoutWM.timer.timeout.connect(update_label)
layoutWM.timer.start(1000) # every 10,000 milliseconds
layoutWM.addWidget(lcd)
dWM.addWidget(layoutWM)
###############################################################################
myToolbar.incorporate_toolbar(win, anal_control_signal._registry)
......
# -*- coding: utf-8 -*-
"""
Created on Thu Jul 5 12:17:30 2018
@author: Usuario
"""
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)
settings.beginGroup('Ventana')
for ao in aos:
spin_boxes = ao.spin_boxes
for text, spinb in spin_boxes:
settings.setValue(str(ao.name) + '_' + text, spinb.value())
#print(spinb.value() )
settings.endGroup()
print('saving')
def load(aos):
settings = QSettings('C:\\Users\\Usuario\\Documents\\control_app\\config.ini', QSettings.IniFormat)
settings.beginGroup('Ventana')
for ao in aos:
spin_boxes = ao.spin_boxes
for text, spinb in spin_boxes:
spin = settings.value(str(ao.name) + '_' + text)
spinb.setValue( float(spin) )
settings.endGroup()
def startWebcamsThread():
exec(open('C:\\Users\\Usuario\\Documents\\control_app\\webcams.py').read())
def putWebcams(checked):
if checked:
t = Thread(target=startWebcamsThread, args=())
t.start()
else:
pass
def incorporate_toolbar(win, analog_control_signals):
menubar = win.menuBar()
saveAct = QAction('Save', win)
loadAct = QAction('Load', win)
win.statusBar()
menubar = win.menuBar()
fileMenu = menubar.addMenu('&File')
fileMenu.addAction(saveAct)
fileMenu.addAction(loadAct)
viewMenu = menubar.addMenu('Monitor')
viewWebcams = QAction('View webcams', checkable=True)
viewWebcams.setChecked(False)
viewMenu.addAction(viewWebcams)
saveAct.triggered.connect(lambda: save(analog_control_signals))
loadAct.triggered.connect(lambda: load(analog_control_signals))
viewWebcams.toggled.connect(lambda: putWebcams(viewWebcams.isChecked()) )
\ No newline at end of file
......@@ -83,7 +83,7 @@ class anal_control_signal(QWidget):
def doAction(self):
self.scan_direction = -float( (self.scan_sb_stop.val-self.scan_sb_start.val)/self.scan_sb_period.val ) * float(2 * 1e-3)
self.scan_direction = -float( (self.scan_sb_stop.val-self.scan_sb_start.val)/self.scan_sb_period.val ) * float(2 * 1e-3)
self.scan_step = float(self.scan_sb_start.val)
if self.timer.isActive():
......
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