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

checkboxes and scan spinboxes now saved and loaded

parent ec809ed4
......@@ -116,6 +116,7 @@ class digital_control_signal(QtCore.QObject):
self.ch = channel
self.initial_value = 0
self.DO = daq_DO(self.ch)
self.inverse = inverse
def make_connections(self, frontend):
......@@ -126,8 +127,12 @@ class digital_control_signal(QtCore.QObject):
@QtCore.pyqtSlot(int)
def when_change_digital(self, state):
if state == QtCore.Qt.Checked:
self.DO.set_out(True)
if self.inverse:
self.DO.set_out(True)
else:
self.DO.set_out(False)
else:
self.DO.set_out(False)
\ No newline at end of file
if self.inverse:
self.DO.set_out(False)
else:
self.DO.set_out(True)
\ No newline at end of file
from PyQt5 import QtGui, QtCore
from drivers.andorzyla import AndorZyla
#from drivers.dummyAndor import AndorZyla
#from drivers.andorzyla import AndorZyla
from drivers.dummyAndor import AndorZyla
from cameraGui import CameraGuiMainWindow
from zylaCameraWorker import CameraWorker
......@@ -33,10 +33,10 @@ if __name__ == "__main__":
trapExYb = anal_control_signal('compExYb', channel = 6, ao_type='electrode')
shutter866 = digital_control_signal('shutter866', channel = 2, inverse=True)
shutter397 = digital_control_signal('shutter397', channel = 0, inverse=True)
shutter423 = digital_control_signal('shutter423', channel = 1, inverse=True)
shutter866WM = digital_control_signal('shutter866WM', channel = 3, inverse=True)
shutter866 = digital_control_signal('shutter866', channel = 2, inverse=False)
shutter397 = digital_control_signal('shutter397', channel = 0, inverse=False)
shutter423 = digital_control_signal('shutter423', channel = 1, inverse=False)
shutter866WM = digital_control_signal('shutter866WM', channel = 3, inverse=False)
controlGui = ControlGui()
mcDAQthread = QtCore.QThread()
......
......@@ -7,10 +7,9 @@ Created on Thu Jul 5 12:17:30 2018
from PyQt5.QtCore import QSettings
from PyQt5 import QtGui
from PyQt5.QtWidgets import QAction, QFileDialog, QInputDialog, QWidget
from PyQt5.QtWidgets import QAction, QFileDialog, QWidget
from threading import Thread
from subclasses.controllayouts import LaserControlLayout
from subclasses.controllayouts import LaserControlLayout, LaserScanLayout
#%%
class myToolbarMenu(QWidget):
......@@ -23,14 +22,29 @@ class myToolbarMenu(QWidget):
self.MainGuiWindow = win
self.sbsDicc = dict()
self.cbsDicc = dict()
self.incorporate_toolbar(self.MainGuiWindow)
self.fillSpinBoxesDict()
self.fillCheckBoxesDict()
def fillSpinBoxesDict(self):
for l in LaserControlLayout._registry:
for sb_name in l.spinboxes:
self.sbsDicc[sb_name] = l.spinboxes[sb_name]
for l in LaserScanLayout._registry:
for sb_name in l.spinboxes:
self.sbsDicc['_'.join([l.name, sb_name])] = l.spinboxes[sb_name]
def fillCheckBoxesDict(self):
for l in LaserControlLayout._registry:
for cb_name in l.checkboxes:
self.cbsDicc[cb_name] = l.checkboxes[cb_name]
def createElectrodesDict(self):
d = dict()
......@@ -83,6 +97,9 @@ class myToolbarMenu(QWidget):
for text, spinb in self.sbsDicc.items():
settings.setValue(text, spinb.value())
for text, checkb in self.cbsDicc.items():
settings.setValue(text, checkb.isChecked())
settings.endGroup()
......@@ -98,6 +115,14 @@ class myToolbarMenu(QWidget):
spinb.setValue( float(spinbox_saved_value) )
except TypeError:
spinb.setValue( float(spinb.value()) )
for text, checkb in self.cbsDicc.items():
checkbox_saved_value = settings.value(text)
if checkbox_saved_value in ['true', 'True', True]:
checkb.setChecked(True)
else:
checkb.setChecked(False)
settings.endGroup()
def save_as(self, window):
......
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