Commit 01b1ca55 authored by Martin Drechsler's avatar Martin Drechsler

Initial loading from config.ini file implemented.

parent 8861f4dc
......@@ -16,18 +16,21 @@ from pyqtgraph import dockarea
import pyqtgraph as pg
from PyQt5.QtCore import QTimer
from PyQt5.QtWidgets import QLCDNumber
import myToolbar
###############################################################################
#This creates the window for the gui
app = QtGui.QApplication([])
win = QtGui.QMainWindow()
win.setWindowTitle('My GUI')
win.setWindowIcon(QtGui.QIcon('snuffles.png'))
app_icon = QtGui.QIcon()
app_icon.addFile('snuffles.png')
app.setWindowIcon(app_icon)
......@@ -110,7 +113,14 @@ shutter866 = digital_control_signal('shutter866', 2)
shutter423 = digital_control_signal('shutter423', 1)
shutterLED = digital_control_signal('shutterLED', 3)
#############Toolbar and initial loading of config ############################
myToolbar.first_load(anal_control_signal._registry)
myToolbar.incorporate_toolbar(win, anal_control_signal._registry)
###############################################################################
#activate button
actB = activation_button()
layout_activate.addWidget(actB.button)
###############################################################################
#Adding the controls:
......@@ -179,16 +189,10 @@ try:
except:
pass
###########################################################
###############################################################################
#read wavemeter
wavemeter = burleighWM(layoutWM, dWM)
###############################################################################
myToolbar.incorporate_toolbar(win, anal_control_signal._registry)
###############################################################################
#activate button
actB = activation_button()
layout_activate.addWidget(actB.button)
###############################################################################
......
......@@ -33,6 +33,22 @@ def load(aos):
spinb.setValue( float(spin) )
settings.endGroup()
def first_load(aos):
try:
settings = QSettings('C:\\Users\\Usuario\\Documents\\control_app\\config.ini', QSettings.IniFormat)
except:
print('Warning: no config.ini file in control_app folder. Pleace, be kindful and create one')
return
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 save_as(aos, window):
name = QFileDialog.getSaveFileName(window, 'Save File')
......
......@@ -26,6 +26,7 @@ class anal_control_signal(QWidget):
self.ch = channel
self.initial_value = 0
self.max = out_maximum
self.min = out_minimum
self.step = out_step
......@@ -62,15 +63,13 @@ class anal_control_signal(QWidget):
def sb_analog_change(self):
self.AO.set_out(self.sb.val)
#self.AO.set_out(self.sb.val)
print(self.sb.val)
def set_name(self, name):
self.name = name
def set_initial_value(self, value):
self.initial_value = value
def set_siPrefix(self, value):
self.siPrefix = value
......@@ -78,7 +77,6 @@ class anal_control_signal(QWidget):
def set_sufix(self, value):
self.sufix = value
def scanEvent(self):
if abs(abs(self.scan_step)-abs(float(self.scan_sb_start.val)))<1e-6 or abs(abs(self.scan_step)-abs(float(self.scan_sb_stop.val)))<1e-6:
......
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