Added LUT UI chagnes.

This commit is contained in:
jupfi 2023-12-07 16:15:34 +01:00
parent 891bd8fbeb
commit 84c1afa3e6
4 changed files with 74 additions and 16 deletions

View file

@ -34,11 +34,19 @@ class BroadbandController(ModuleController):
self.set_averages_failure.emit() self.set_averages_failure.emit()
# receive LUT data # receive LUT data
elif key == "LUT_finished": elif key == "LUT_finished":
logger.debug("Received LUT data.") self.received_LUT(value)
self.module.model.LUT = value
self.change_start_frequency(self.module.model.LUT.start_frequency) def received_LUT(self, LUT : Measurement) -> None:
self.change_stop_frequency(self.module.model.LUT.stop_frequency) """This slot is called when the LUT data is received from the nqrduck module.
self.change_frequency_step(self.module.model.LUT.frequency_step)
Args:
LUT (Measurement): LUT data.
"""
logger.debug("Received LUT data.")
self.module.model.LUT = LUT
self.change_start_frequency(self.module.model.LUT.start_frequency)
self.change_stop_frequency(self.module.model.LUT.stop_frequency)
self.change_frequency_step(self.module.model.LUT.frequency_step)
@pyqtSlot(str) @pyqtSlot(str)
def set_frequency(self, value : str) -> None: def set_frequency(self, value : str) -> None:
@ -131,6 +139,11 @@ class BroadbandController(ModuleController):
else: else:
self.module.view.add_info_text("Broadband measurement finished.") self.module.view.add_info_text("Broadband measurement finished.")
@pyqtSlot()
def delete_LUT(self) -> None:
"""This slot is called when the LUT is deleted."""
self.module.model.LUT = None
def start_single_measurement(self, frequency : float) -> None: def start_single_measurement(self, frequency : float) -> None:
"""Starts a single measurement. """Starts a single measurement.
@ -139,5 +152,8 @@ class BroadbandController(ModuleController):
""" """
logger.debug("Starting single measurement.") logger.debug("Starting single measurement.")
self.module.view.add_info_text("Starting measurement at frequency: " + str(frequency)) self.module.view.add_info_text("Starting measurement at frequency: " + str(frequency))
# First set the frequency of the spectrometer
self.module.nqrduck_signal.emit("set_frequency", str(frequency)) self.module.nqrduck_signal.emit("set_frequency", str(frequency))
# If there is a LUT available, send the tune and match values as signal
self.module.nqrduck_signal.emit("start_measurement", None) self.module.nqrduck_signal.emit("start_measurement", None)

View file

@ -157,7 +157,7 @@
</layout> </layout>
</item> </item>
<item> <item>
<layout class="QVBoxLayout" name="verticalLayout_3" stretch="0,0,1"> <layout class="QVBoxLayout" name="verticalLayout_3" stretch="0,0,0,1">
<item> <item>
<widget class="QLabel" name="label_10"> <widget class="QLabel" name="label_10">
<property name="font"> <property name="font">
@ -177,9 +177,27 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QLabel" name="file_pathLabel"> <layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="label_11">
<property name="text">
<string>Active LUT:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="activeLUTLabel">
<property name="text">
<string>None</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QPushButton" name="deleteLUTButton">
<property name="text"> <property name="text">
<string/> <string>Delete LUT</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -218,7 +236,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>271</width> <width>271</width>
<height>719</height> <height>677</height>
</rect> </rect>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">

View file

@ -65,6 +65,9 @@ class BroadbandView(ModuleView):
# LUT data # LUT data
self.module.model.LUT_changed.connect(self.on_LUT_changed) self.module.model.LUT_changed.connect(self.on_LUT_changed)
# On deleteLUTButton clicked
self._ui_form.deleteLUTButton.clicked.connect(self.module.controller.delete_LUT)
@pyqtSlot() @pyqtSlot()
def start_measurement_clicked(self) -> None: def start_measurement_clicked(self) -> None:
"""This method is called when the start measurement button is clicked. """This method is called when the start measurement button is clicked.
@ -229,7 +232,17 @@ class BroadbandView(ModuleView):
def on_LUT_changed(self) -> None: def on_LUT_changed(self) -> None:
"""This method is called when the LUT data is changed.""" """This method is called when the LUT data is changed."""
logger.debug("Updating LUT fields.") logger.debug("Updating LUT fields.")
# LUT type here # If lut is not None disable the start- stop step frequency fields and update the LUT type label
if self.module.model.LUT is not None:
self._ui_form.start_frequencyField.setEnabled(False)
self._ui_form.stop_frequencyField.setEnabled(False)
self._ui_form.frequencystepEdit.setEnabled(False)
self._ui_form.activeLUTLabel.setText("Test")
else:
self._ui_form.start_frequencyField.setEnabled(True)
self._ui_form.stop_frequencyField.setEnabled(True)
self._ui_form.frequencystepEdit.setEnabled(True)
self._ui_form.activeLUTLabel.setText("None")
def add_info_text(self, text : str) -> None: def add_info_text(self, text : str) -> None:
"""Add a text to the info box with a timestamp. """Add a text to the info box with a timestamp.

View file

@ -101,10 +101,18 @@ class Ui_Form(object):
self.label_10.setAlignment(QtCore.Qt.AlignmentFlag.AlignCenter) self.label_10.setAlignment(QtCore.Qt.AlignmentFlag.AlignCenter)
self.label_10.setObjectName("label_10") self.label_10.setObjectName("label_10")
self.verticalLayout_3.addWidget(self.label_10) self.verticalLayout_3.addWidget(self.label_10)
self.file_pathLabel = QtWidgets.QLabel(parent=Form) self.gridLayout = QtWidgets.QGridLayout()
self.file_pathLabel.setText("") self.gridLayout.setObjectName("gridLayout")
self.file_pathLabel.setObjectName("file_pathLabel") self.label_11 = QtWidgets.QLabel(parent=Form)
self.verticalLayout_3.addWidget(self.file_pathLabel) self.label_11.setObjectName("label_11")
self.gridLayout.addWidget(self.label_11, 0, 0, 1, 1)
self.activeLUTLabel = QtWidgets.QLabel(parent=Form)
self.activeLUTLabel.setObjectName("activeLUTLabel")
self.gridLayout.addWidget(self.activeLUTLabel, 0, 1, 1, 1)
self.verticalLayout_3.addLayout(self.gridLayout)
self.deleteLUTButton = QtWidgets.QPushButton(parent=Form)
self.deleteLUTButton.setObjectName("deleteLUTButton")
self.verticalLayout_3.addWidget(self.deleteLUTButton)
self.verticalLayout_2 = QtWidgets.QVBoxLayout() self.verticalLayout_2 = QtWidgets.QVBoxLayout()
self.verticalLayout_2.setObjectName("verticalLayout_2") self.verticalLayout_2.setObjectName("verticalLayout_2")
self.label_9 = QtWidgets.QLabel(parent=Form) self.label_9 = QtWidgets.QLabel(parent=Form)
@ -122,7 +130,7 @@ class Ui_Form(object):
self.infoBox.setWidgetResizable(True) self.infoBox.setWidgetResizable(True)
self.infoBox.setObjectName("infoBox") self.infoBox.setObjectName("infoBox")
self.scrollAreaWidgetContents = QtWidgets.QWidget() self.scrollAreaWidgetContents = QtWidgets.QWidget()
self.scrollAreaWidgetContents.setGeometry(QtCore.QRect(0, 0, 271, 719)) self.scrollAreaWidgetContents.setGeometry(QtCore.QRect(0, 0, 271, 677))
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Expanding) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Expanding)
sizePolicy.setHorizontalStretch(0) sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0) sizePolicy.setVerticalStretch(0)
@ -133,7 +141,7 @@ class Ui_Form(object):
self.verticalLayout_2.addWidget(self.infoBox) self.verticalLayout_2.addWidget(self.infoBox)
self.verticalLayout_2.setStretch(2, 1) self.verticalLayout_2.setStretch(2, 1)
self.verticalLayout_3.addLayout(self.verticalLayout_2) self.verticalLayout_3.addLayout(self.verticalLayout_2)
self.verticalLayout_3.setStretch(2, 1) self.verticalLayout_3.setStretch(3, 1)
self.verticalLayout_4.addLayout(self.verticalLayout_3) self.verticalLayout_4.addLayout(self.verticalLayout_3)
self.verticalLayout_4.setStretch(1, 1) self.verticalLayout_4.setStretch(1, 1)
self.horizontalLayout_6.addLayout(self.verticalLayout_4) self.horizontalLayout_6.addLayout(self.verticalLayout_4)
@ -186,5 +194,8 @@ class Ui_Form(object):
self.label_7.setText(_translate("Form", "Averages:")) self.label_7.setText(_translate("Form", "Averages:"))
self.start_measurementButton.setText(_translate("Form", "Start Measurement")) self.start_measurementButton.setText(_translate("Form", "Start Measurement"))
self.label_10.setText(_translate("Form", "Sequence Settings:")) self.label_10.setText(_translate("Form", "Sequence Settings:"))
self.label_11.setText(_translate("Form", "Active LUT:"))
self.activeLUTLabel.setText(_translate("Form", "None"))
self.deleteLUTButton.setText(_translate("Form", "Delete LUT"))
self.label_9.setText(_translate("Form", "Info Box:")) self.label_9.setText(_translate("Form", "Info Box:"))
from nqrduck.contrib.mplwidget import MplWidget from nqrduck.contrib.mplwidget import MplWidget