Commit 8671111e authored by Martin Drechsler's avatar Martin Drechsler

added measurement worker and gui. So far, it is mostly the skeleton

parent 46826a4e
......@@ -17,10 +17,16 @@ class anal_control_signal(QtCore.QObject):
def __init__(self, name, channel, ao_type, out_minimum = -10, out_maximum = 10, out_step = 0.1, feedfoward = False):
super().__init__()
self._registry.append(self)
if name in [ao.name for ao in self._registry]:
raise ValueError('Two analog control signals cannot share the name: %s used already' % (name))
if channel in [ao.ch for ao in self._registry]:
raise ValueError('Two analog control signals cannot share the channel: channel %s used already' % (channel))
if ao_type not in AO_TYPES:
raise ValueError("Invalid ao type. Expected one of: %s" % AO_TYPES)
self._registry.append(self)
self.name = name
self.ch = channel
self.ao_type = ao_type
......
......@@ -108,7 +108,7 @@ if __name__ == '__main__':
trapCOMPC = anal_control_signal('compC', channel = 7, ao_type='electrode')
trapCOMPD = anal_control_signal('compD', channel = 8, ao_type='electrode')
trapOven = anal_control_signal('compOven', channel = 9, ao_type='electrode')
trapExYb = anal_control_signal('CompExYb', channel = 10, ao_type='electrode')
trapExYb = anal_control_signal('compExYb', channel = 10, ao_type='electrode')
shutter866 = digital_control_signal('shutter866', channel = 0)
......
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
tip: pyuic5 -x ventana.ui -o ventana_ui.py
@author: martindrech
"""
from PyQt5 import QtCore, QtWidgets
from PyQt5.QtCore import QSettings
from PyQt5.QtWidgets import QAction, QFileDialog, QInputDialog, QWidget
from measurement_ui import Ui_Frame
class MeasurementGui(QtWidgets.QFrame, Ui_Frame):
def __init__(self):
super().__init__()
self.setupUi(self)
def make_connections(self, backend):
self.folderButton.clicked.connect(self.select_folder)
def select_folder(self):
directory = QFileDialog.getExistingDirectory(self, 'Choose directory')
self.folderBrowser.setText(directory)
class MeasurementWorker(QtCore.QObject):
"""
Backend for the measurement frame.
"""
def __init__(self, camera, analog_control_signals):
super().__init__()
def make_connections(self, frontend):
pass
def simple_scan_measurement(self):
pass
# def open_from(self, aos, window):
# name = QFileDialog.getOpenFileName(window, 'Save File')
# if not name[0]:
# print('Opening was canceled')
# return 0
# settings = QSettings(name[0], 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()
if __name__ == '__main__':
import sys
from PyQt5 import QtWidgets
from measurement_ui import Ui_Frame
app = QtWidgets.QApplication(sys.argv)
gui = MeasurementGui()
measurementWorker = MeasurementWorker(None, None)
measurementWorker.make_connections(gui)
gui.make_connections(measurementWorker)
gui.show()
sys.exit(app.exec_())
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'measurement.ui'
#
# Created by: PyQt5 UI code generator 5.9.2
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_Frame(object):
def setupUi(self, Frame):
Frame.setObjectName("Frame")
Frame.resize(578, 423)
Frame.setFrameShape(QtWidgets.QFrame.StyledPanel)
Frame.setFrameShadow(QtWidgets.QFrame.Raised)
self.gridLayoutWidget = QtWidgets.QWidget(Frame)
self.gridLayoutWidget.setGeometry(QtCore.QRect(20, 90, 231, 211))
self.gridLayoutWidget.setObjectName("gridLayoutWidget")
self.gridLayout = QtWidgets.QGridLayout(self.gridLayoutWidget)
self.gridLayout.setContentsMargins(0, 0, 0, 0)
self.gridLayout.setObjectName("gridLayout")
self.stepsNum = QtWidgets.QSpinBox(self.gridLayoutWidget)
self.stepsNum.setObjectName("stepsNum")
self.gridLayout.addWidget(self.stepsNum, 3, 1, 1, 1)
self.endValue = QtWidgets.QSpinBox(self.gridLayoutWidget)
self.endValue.setObjectName("endValue")
self.gridLayout.addWidget(self.endValue, 2, 1, 1, 1)
self.startValue = QtWidgets.QSpinBox(self.gridLayoutWidget)
self.startValue.setObjectName("startValue")
self.gridLayout.addWidget(self.startValue, 1, 1, 1, 1)
self.selectScanSignal = QtWidgets.QComboBox(self.gridLayoutWidget)
self.selectScanSignal.setObjectName("selectScanSignal")
self.gridLayout.addWidget(self.selectScanSignal, 0, 1, 1, 1)
self.comments = QtWidgets.QTextEdit(self.gridLayoutWidget)
self.comments.setObjectName("comments")
self.gridLayout.addWidget(self.comments, 4, 1, 1, 1)
self.label = QtWidgets.QLabel(self.gridLayoutWidget)
self.label.setObjectName("label")
self.gridLayout.addWidget(self.label, 0, 0, 1, 1)
self.label_2 = QtWidgets.QLabel(self.gridLayoutWidget)
self.label_2.setObjectName("label_2")
self.gridLayout.addWidget(self.label_2, 1, 0, 1, 1)
self.label_3 = QtWidgets.QLabel(self.gridLayoutWidget)
self.label_3.setObjectName("label_3")
self.gridLayout.addWidget(self.label_3, 2, 0, 1, 1)
self.label_4 = QtWidgets.QLabel(self.gridLayoutWidget)
self.label_4.setObjectName("label_4")
self.gridLayout.addWidget(self.label_4, 3, 0, 1, 1)
self.label_5 = QtWidgets.QLabel(self.gridLayoutWidget)
self.label_5.setObjectName("label_5")
self.gridLayout.addWidget(self.label_5, 4, 0, 1, 1)
self.startMeasureButton = QtWidgets.QPushButton(Frame)
self.startMeasureButton.setGeometry(QtCore.QRect(20, 320, 171, 23))
self.startMeasureButton.setObjectName("startMeasureButton")
self.measureProgressBar = QtWidgets.QProgressBar(Frame)
self.measureProgressBar.setGeometry(QtCore.QRect(20, 350, 171, 23))
self.measureProgressBar.setProperty("value", 24)
self.measureProgressBar.setObjectName("measureProgressBar")
self.listWidget = QtWidgets.QListWidget(Frame)
self.listWidget.setGeometry(QtCore.QRect(270, 110, 281, 111))
self.listWidget.setObjectName("listWidget")
self.label_6 = QtWidgets.QLabel(Frame)
self.label_6.setGeometry(QtCore.QRect(340, 80, 161, 20))
self.label_6.setObjectName("label_6")
self.folderButton = QtWidgets.QPushButton(Frame)
self.folderButton.setGeometry(QtCore.QRect(30, 20, 80, 23))
self.folderButton.setObjectName("folderButton")
self.folderBrowser = QtWidgets.QTextBrowser(Frame)
self.folderBrowser.setGeometry(QtCore.QRect(120, 20, 441, 21))
self.folderBrowser.setObjectName("folderBrowser")
self.saveMeasureButton = QtWidgets.QPushButton(Frame)
self.saveMeasureButton.setGeometry(QtCore.QRect(199, 320, 151, 23))
self.saveMeasureButton.setObjectName("saveMeasureButton")
self.dumpMeasureButton = QtWidgets.QPushButton(Frame)
self.dumpMeasureButton.setGeometry(QtCore.QRect(200, 350, 151, 23))
self.dumpMeasureButton.setObjectName("dumpMeasureButton")
self.retranslateUi(Frame)
QtCore.QMetaObject.connectSlotsByName(Frame)
def retranslateUi(self, Frame):
_translate = QtCore.QCoreApplication.translate
Frame.setWindowTitle(_translate("Frame", "Frame"))
self.label.setText(_translate("Frame", "Scan signal"))
self.label_2.setText(_translate("Frame", "Start value"))
self.label_3.setText(_translate("Frame", "End value"))
self.label_4.setText(_translate("Frame", "Steps num"))
self.label_5.setText(_translate("Frame", "Comments"))
self.startMeasureButton.setText(_translate("Frame", "Start measurement"))
self.label_6.setText(_translate("Frame", "Info about measurement"))
self.folderButton.setText(_translate("Frame", "Folder"))
self.saveMeasureButton.setText(_translate("Frame", "Save measurement"))
self.dumpMeasureButton.setText(_translate("Frame", "Dump measurement"))
if __name__ == "__main__":
import sys
app = QtWidgets.QApplication(sys.argv)
Frame = QtWidgets.QFrame()
ui = Ui_Frame()
ui.setupUi(Frame)
Frame.show()
sys.exit(app.exec_())
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Frame</class>
<widget class="QFrame" name="Frame">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>578</width>
<height>423</height>
</rect>
</property>
<property name="windowTitle">
<string>Frame</string>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<widget class="QWidget" name="gridLayoutWidget">
<property name="geometry">
<rect>
<x>20</x>
<y>90</y>
<width>231</width>
<height>211</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="3" column="1">
<widget class="QSpinBox" name="stepsNum"/>
</item>
<item row="2" column="1">
<widget class="QSpinBox" name="endValue"/>
</item>
<item row="1" column="1">
<widget class="QSpinBox" name="startValue"/>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="selectScanSignal"/>
</item>
<item row="4" column="1">
<widget class="QTextEdit" name="comments"/>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Scan signal</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Start value</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>End value</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Steps num</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Comments</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QPushButton" name="startMeasureButton">
<property name="geometry">
<rect>
<x>20</x>
<y>320</y>
<width>171</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>Start measurement</string>
</property>
</widget>
<widget class="QProgressBar" name="measureProgressBar">
<property name="geometry">
<rect>
<x>20</x>
<y>350</y>
<width>171</width>
<height>23</height>
</rect>
</property>
<property name="value">
<number>24</number>
</property>
</widget>
<widget class="QListWidget" name="listWidget">
<property name="geometry">
<rect>
<x>270</x>
<y>110</y>
<width>281</width>
<height>111</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="label_6">
<property name="geometry">
<rect>
<x>340</x>
<y>80</y>
<width>161</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>Info about measurement</string>
</property>
</widget>
<widget class="QPushButton" name="folderButton">
<property name="geometry">
<rect>
<x>30</x>
<y>20</y>
<width>80</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>Folder</string>
</property>
</widget>
<widget class="QTextBrowser" name="folderBrowser">
<property name="geometry">
<rect>
<x>120</x>
<y>20</y>
<width>441</width>
<height>21</height>
</rect>
</property>
</widget>
<widget class="QPushButton" name="saveMeasureButton">
<property name="geometry">
<rect>
<x>199</x>
<y>320</y>
<width>151</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>Save measurement</string>
</property>
</widget>
<widget class="QPushButton" name="dumpMeasureButton">
<property name="geometry">
<rect>
<x>200</x>
<y>350</y>
<width>151</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>Dump measurement</string>
</property>
</widget>
</widget>
<resources/>
<connections/>
</ui>
......@@ -157,6 +157,7 @@ class LaserScanLayout(pg.LayoutWidget):
if __name__ == '__main__':
import sys
from PyQt5.QtWidgets import QMainWindow
sys.path.append("/home/martindrech/Documents/total_control_app")
app = QtGui.QApplication([])
frame = QtGui.QFrame()
area = dockarea.DockArea()
......
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