mirror of
https://github.com/nqrduck/nqrduck-broadband.git
synced 2024-12-22 15:47:49 +00:00
Added setting of averages and frequency.
This commit is contained in:
parent
18d9af201d
commit
5e5c2da12a
4 changed files with 118 additions and 163 deletions
|
@ -11,15 +11,31 @@ class BroadbandController(ModuleController):
|
|||
|
||||
start_measurement = pyqtSignal()
|
||||
|
||||
set_averages_failure = pyqtSignal()
|
||||
|
||||
def __init__(self, module):
|
||||
super().__init__(module)
|
||||
|
||||
|
||||
@pyqtSlot(str, object)
|
||||
def process_signals(self, key: str, value: Measurement):
|
||||
if key == "measurement_data":
|
||||
logger.debug("Received single measurement.")
|
||||
self.module.model.single_measurement = value
|
||||
|
||||
elif key == "failure_set_averages" and value == self.module.view._ui_form.averagesEdit.text():
|
||||
logger.debug("Received set averages failure.")
|
||||
self.set_averages_failure.emit()
|
||||
|
||||
@pyqtSlot(str)
|
||||
def set_frequency(self, value):
|
||||
logger.debug("Setting frequency to: " + value)
|
||||
self.module.nqrduck_signal.emit("set_frequency", value)
|
||||
|
||||
@pyqtSlot(str)
|
||||
def set_averages(self, value):
|
||||
logger.debug("Setting averages to: " + value)
|
||||
self.module.nqrduck_signal.emit("set_averages", value)
|
||||
|
||||
@pyqtSlot(str)
|
||||
def change_start_frequency(self, value):
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
<enum>QLayout::SetDefaultConstraint</enum>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout" stretch="0,0,0,0,0,0">
|
||||
<layout class="QVBoxLayout" name="verticalLayout" stretch="0,0,0">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="font">
|
||||
|
@ -46,15 +46,46 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout" stretch="0,0,1">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<item row="1" column="3">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>Start Frequency:</string>
|
||||
<string>MHz</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>Frequency Step:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>MHz</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Stop Frequency:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QLineEdit" name="frequency_stepField">
|
||||
<property name="text">
|
||||
<string>0.1</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QLineEdit" name="start_frequencyField">
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::LeftToRight</enum>
|
||||
|
@ -67,25 +98,14 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>MHz</string>
|
||||
<string>Start Frequency:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2" stretch="0,0,1">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Stop Frequency:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QLineEdit" name="stop_frequencyField">
|
||||
<property name="text">
|
||||
<string>70.0</string>
|
||||
|
@ -95,67 +115,22 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<item row="2" column="3">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>MHz</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3" stretch="0,0,1">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>Frequency Step:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="frequency_stepField">
|
||||
<property name="text">
|
||||
<string>0.1</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>MHz</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4" stretch="0,0,0,1">
|
||||
<item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="text">
|
||||
<string>Averages:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>32</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="averagesField">
|
||||
<item row="3" column="2">
|
||||
<widget class="QLineEdit" name="averagesEdit">
|
||||
<property name="text">
|
||||
<string>1000</string>
|
||||
</property>
|
||||
|
@ -164,19 +139,6 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
|
@ -195,7 +157,7 @@
|
|||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3" stretch="0,0,0,1">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3" stretch="0,0,1">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_10">
|
||||
<property name="font">
|
||||
|
@ -214,19 +176,6 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="load_fileButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Load TNMR File</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="file_pathLabel">
|
||||
<property name="text">
|
||||
|
@ -268,8 +217,8 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>281</width>
|
||||
<height>673</height>
|
||||
<width>271</width>
|
||||
<height>719</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
|
|
|
@ -44,6 +44,10 @@ class BroadbandView(ModuleView):
|
|||
self._ui_form.start_measurementButton.clicked.connect(lambda: self._start_measurement_clicked())
|
||||
self.start_measurement.connect(lambda: self.module._controller.start_measurement())
|
||||
|
||||
self._ui_form.averagesEdit.editingFinished.connect(lambda: self.on_editing_finished(self._ui_form.averagesEdit.text()))
|
||||
|
||||
self.module.controller.set_averages_failure.connect(self.on_set_averages_failure)
|
||||
|
||||
def _start_measurement_clicked(self):
|
||||
# Create a QMessageBox object
|
||||
msg_box = QMessageBox()
|
||||
|
@ -94,3 +98,15 @@ class BroadbandView(ModuleView):
|
|||
self._ui_form.broadbandPlot.canvas.ax.set_xlim(right=stop_frequency)
|
||||
self._ui_form.broadbandPlot.canvas.draw()
|
||||
self._ui_form.broadbandPlot.canvas.flush_events()
|
||||
|
||||
@pyqtSlot()
|
||||
def on_editing_finished(self, value):
|
||||
logger.debug("Averages editing finished.")
|
||||
self.sender().setStyleSheet("")
|
||||
if self.sender() == self._ui_form.averagesEdit:
|
||||
self.module.controller.set_averages(value)
|
||||
|
||||
@pyqtSlot()
|
||||
def on_set_averages_failure(self):
|
||||
logger.debug("Set averages failure.")
|
||||
self._ui_form.averagesEdit.setStyleSheet("border: 1px solid red;")
|
|
@ -35,64 +35,47 @@ class Ui_Form(object):
|
|||
self.label_8.setAlignment(QtCore.Qt.AlignmentFlag.AlignCenter)
|
||||
self.label_8.setObjectName("label_8")
|
||||
self.verticalLayout.addWidget(self.label_8)
|
||||
self.horizontalLayout = QtWidgets.QHBoxLayout()
|
||||
self.horizontalLayout.setObjectName("horizontalLayout")
|
||||
self.label = QtWidgets.QLabel(parent=Form)
|
||||
self.label.setObjectName("label")
|
||||
self.horizontalLayout.addWidget(self.label)
|
||||
self.gridLayout_3 = QtWidgets.QGridLayout()
|
||||
self.gridLayout_3.setObjectName("gridLayout_3")
|
||||
self.label_6 = QtWidgets.QLabel(parent=Form)
|
||||
self.label_6.setObjectName("label_6")
|
||||
self.gridLayout_3.addWidget(self.label_6, 1, 3, 1, 1)
|
||||
self.label_5 = QtWidgets.QLabel(parent=Form)
|
||||
self.label_5.setObjectName("label_5")
|
||||
self.gridLayout_3.addWidget(self.label_5, 2, 0, 1, 1)
|
||||
self.label_2 = QtWidgets.QLabel(parent=Form)
|
||||
self.label_2.setObjectName("label_2")
|
||||
self.gridLayout_3.addWidget(self.label_2, 0, 3, 1, 1)
|
||||
self.label_3 = QtWidgets.QLabel(parent=Form)
|
||||
self.label_3.setObjectName("label_3")
|
||||
self.gridLayout_3.addWidget(self.label_3, 1, 0, 1, 1)
|
||||
self.frequency_stepField = QtWidgets.QLineEdit(parent=Form)
|
||||
self.frequency_stepField.setAlignment(QtCore.Qt.AlignmentFlag.AlignRight|QtCore.Qt.AlignmentFlag.AlignTrailing|QtCore.Qt.AlignmentFlag.AlignVCenter)
|
||||
self.frequency_stepField.setObjectName("frequency_stepField")
|
||||
self.gridLayout_3.addWidget(self.frequency_stepField, 2, 2, 1, 1)
|
||||
self.start_frequencyField = QtWidgets.QLineEdit(parent=Form)
|
||||
self.start_frequencyField.setLayoutDirection(QtCore.Qt.LayoutDirection.LeftToRight)
|
||||
self.start_frequencyField.setAlignment(QtCore.Qt.AlignmentFlag.AlignRight|QtCore.Qt.AlignmentFlag.AlignTrailing|QtCore.Qt.AlignmentFlag.AlignVCenter)
|
||||
self.start_frequencyField.setObjectName("start_frequencyField")
|
||||
self.horizontalLayout.addWidget(self.start_frequencyField)
|
||||
self.label_2 = QtWidgets.QLabel(parent=Form)
|
||||
self.label_2.setObjectName("label_2")
|
||||
self.horizontalLayout.addWidget(self.label_2)
|
||||
self.horizontalLayout.setStretch(2, 1)
|
||||
self.verticalLayout.addLayout(self.horizontalLayout)
|
||||
self.horizontalLayout_2 = QtWidgets.QHBoxLayout()
|
||||
self.horizontalLayout_2.setObjectName("horizontalLayout_2")
|
||||
self.label_3 = QtWidgets.QLabel(parent=Form)
|
||||
self.label_3.setObjectName("label_3")
|
||||
self.horizontalLayout_2.addWidget(self.label_3)
|
||||
self.gridLayout_3.addWidget(self.start_frequencyField, 0, 2, 1, 1)
|
||||
self.label = QtWidgets.QLabel(parent=Form)
|
||||
self.label.setObjectName("label")
|
||||
self.gridLayout_3.addWidget(self.label, 0, 0, 1, 1)
|
||||
self.stop_frequencyField = QtWidgets.QLineEdit(parent=Form)
|
||||
self.stop_frequencyField.setAlignment(QtCore.Qt.AlignmentFlag.AlignRight|QtCore.Qt.AlignmentFlag.AlignTrailing|QtCore.Qt.AlignmentFlag.AlignVCenter)
|
||||
self.stop_frequencyField.setObjectName("stop_frequencyField")
|
||||
self.horizontalLayout_2.addWidget(self.stop_frequencyField)
|
||||
self.gridLayout_3.addWidget(self.stop_frequencyField, 1, 2, 1, 1)
|
||||
self.label_4 = QtWidgets.QLabel(parent=Form)
|
||||
self.label_4.setObjectName("label_4")
|
||||
self.horizontalLayout_2.addWidget(self.label_4)
|
||||
self.horizontalLayout_2.setStretch(2, 1)
|
||||
self.verticalLayout.addLayout(self.horizontalLayout_2)
|
||||
self.horizontalLayout_3 = QtWidgets.QHBoxLayout()
|
||||
self.horizontalLayout_3.setObjectName("horizontalLayout_3")
|
||||
self.label_5 = QtWidgets.QLabel(parent=Form)
|
||||
self.label_5.setObjectName("label_5")
|
||||
self.horizontalLayout_3.addWidget(self.label_5)
|
||||
self.frequency_stepField = QtWidgets.QLineEdit(parent=Form)
|
||||
self.frequency_stepField.setAlignment(QtCore.Qt.AlignmentFlag.AlignRight|QtCore.Qt.AlignmentFlag.AlignTrailing|QtCore.Qt.AlignmentFlag.AlignVCenter)
|
||||
self.frequency_stepField.setObjectName("frequency_stepField")
|
||||
self.horizontalLayout_3.addWidget(self.frequency_stepField)
|
||||
self.label_6 = QtWidgets.QLabel(parent=Form)
|
||||
self.label_6.setObjectName("label_6")
|
||||
self.horizontalLayout_3.addWidget(self.label_6)
|
||||
self.horizontalLayout_3.setStretch(2, 1)
|
||||
self.verticalLayout.addLayout(self.horizontalLayout_3)
|
||||
self.horizontalLayout_4 = QtWidgets.QHBoxLayout()
|
||||
self.horizontalLayout_4.setObjectName("horizontalLayout_4")
|
||||
self.gridLayout_3.addWidget(self.label_4, 2, 3, 1, 1)
|
||||
self.label_7 = QtWidgets.QLabel(parent=Form)
|
||||
self.label_7.setObjectName("label_7")
|
||||
self.horizontalLayout_4.addWidget(self.label_7)
|
||||
spacerItem = QtWidgets.QSpacerItem(32, 20, QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Minimum)
|
||||
self.horizontalLayout_4.addItem(spacerItem)
|
||||
self.averagesField = QtWidgets.QLineEdit(parent=Form)
|
||||
self.averagesField.setAlignment(QtCore.Qt.AlignmentFlag.AlignRight|QtCore.Qt.AlignmentFlag.AlignTrailing|QtCore.Qt.AlignmentFlag.AlignVCenter)
|
||||
self.averagesField.setObjectName("averagesField")
|
||||
self.horizontalLayout_4.addWidget(self.averagesField)
|
||||
spacerItem1 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Minimum)
|
||||
self.horizontalLayout_4.addItem(spacerItem1)
|
||||
self.horizontalLayout_4.setStretch(3, 1)
|
||||
self.verticalLayout.addLayout(self.horizontalLayout_4)
|
||||
self.gridLayout_3.addWidget(self.label_7, 3, 0, 1, 1)
|
||||
self.averagesEdit = QtWidgets.QLineEdit(parent=Form)
|
||||
self.averagesEdit.setAlignment(QtCore.Qt.AlignmentFlag.AlignRight|QtCore.Qt.AlignmentFlag.AlignTrailing|QtCore.Qt.AlignmentFlag.AlignVCenter)
|
||||
self.averagesEdit.setObjectName("averagesEdit")
|
||||
self.gridLayout_3.addWidget(self.averagesEdit, 3, 2, 1, 1)
|
||||
self.verticalLayout.addLayout(self.gridLayout_3)
|
||||
self.start_measurementButton = QtWidgets.QPushButton(parent=Form)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Expanding)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
|
@ -114,14 +97,6 @@ class Ui_Form(object):
|
|||
self.label_10.setAlignment(QtCore.Qt.AlignmentFlag.AlignCenter)
|
||||
self.label_10.setObjectName("label_10")
|
||||
self.verticalLayout_3.addWidget(self.label_10)
|
||||
self.load_fileButton = QtWidgets.QPushButton(parent=Form)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Expanding)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.load_fileButton.sizePolicy().hasHeightForWidth())
|
||||
self.load_fileButton.setSizePolicy(sizePolicy)
|
||||
self.load_fileButton.setObjectName("load_fileButton")
|
||||
self.verticalLayout_3.addWidget(self.load_fileButton)
|
||||
self.file_pathLabel = QtWidgets.QLabel(parent=Form)
|
||||
self.file_pathLabel.setText("")
|
||||
self.file_pathLabel.setObjectName("file_pathLabel")
|
||||
|
@ -143,7 +118,7 @@ class Ui_Form(object):
|
|||
self.infoBox.setWidgetResizable(True)
|
||||
self.infoBox.setObjectName("infoBox")
|
||||
self.scrollAreaWidgetContents = QtWidgets.QWidget()
|
||||
self.scrollAreaWidgetContents.setGeometry(QtCore.QRect(0, 0, 281, 673))
|
||||
self.scrollAreaWidgetContents.setGeometry(QtCore.QRect(0, 0, 271, 719))
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Expanding)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
|
@ -154,7 +129,7 @@ class Ui_Form(object):
|
|||
self.verticalLayout_2.addWidget(self.infoBox)
|
||||
self.verticalLayout_2.setStretch(2, 1)
|
||||
self.verticalLayout_3.addLayout(self.verticalLayout_2)
|
||||
self.verticalLayout_3.setStretch(3, 1)
|
||||
self.verticalLayout_3.setStretch(2, 1)
|
||||
self.verticalLayout_4.addLayout(self.verticalLayout_3)
|
||||
self.verticalLayout_4.setStretch(1, 1)
|
||||
self.horizontalLayout_6.addLayout(self.verticalLayout_4)
|
||||
|
@ -198,19 +173,18 @@ class Ui_Form(object):
|
|||
_translate = QtCore.QCoreApplication.translate
|
||||
Form.setWindowTitle(_translate("Form", "Form"))
|
||||
self.label_8.setText(_translate("Form", "Measurement Settings:"))
|
||||
self.label.setText(_translate("Form", "Start Frequency:"))
|
||||
self.start_frequencyField.setText(_translate("Form", "50.0"))
|
||||
self.label_6.setText(_translate("Form", "MHz"))
|
||||
self.label_5.setText(_translate("Form", "Frequency Step:"))
|
||||
self.label_2.setText(_translate("Form", "MHz"))
|
||||
self.label_3.setText(_translate("Form", "Stop Frequency:"))
|
||||
self.frequency_stepField.setText(_translate("Form", "0.1"))
|
||||
self.start_frequencyField.setText(_translate("Form", "50.0"))
|
||||
self.label.setText(_translate("Form", "Start Frequency:"))
|
||||
self.stop_frequencyField.setText(_translate("Form", "70.0"))
|
||||
self.label_4.setText(_translate("Form", "MHz"))
|
||||
self.label_5.setText(_translate("Form", "Frequency Step:"))
|
||||
self.frequency_stepField.setText(_translate("Form", "0.1"))
|
||||
self.label_6.setText(_translate("Form", "MHz"))
|
||||
self.label_7.setText(_translate("Form", "Averages:"))
|
||||
self.averagesField.setText(_translate("Form", "1000"))
|
||||
self.averagesEdit.setText(_translate("Form", "1000"))
|
||||
self.start_measurementButton.setText(_translate("Form", "Start Measurement"))
|
||||
self.label_10.setText(_translate("Form", "Sequence Settings:"))
|
||||
self.load_fileButton.setText(_translate("Form", "Load TNMR File"))
|
||||
self.label_9.setText(_translate("Form", "Info Box:"))
|
||||
from nqrduck.contrib.mplwidget import MplWidget
|
||||
|
|
Loading…
Reference in a new issue