Added units fro frequency.

This commit is contained in:
jupfi 2023-07-19 12:27:03 +02:00
parent 29ba0cdeed
commit 1df480090b
3 changed files with 27 additions and 13 deletions

View file

@ -16,8 +16,11 @@ class MeasurementController(ModuleController):
@pyqtSlot(str)
def set_frequency(self, value):
logger.debug("Setting frequency to: " + value)
self.module.nqrduck_signal.emit("set_frequency", value)
try:
logger.debug("Setting frequency to: %s MHz" % value)
self.module.nqrduck_signal.emit("set_frequency", float(value) * 1e6)
except ValueError:
self.set_averages_failure.emit()
@pyqtSlot(str)
def set_averages(self, value):

View file

@ -50,6 +50,13 @@
</item>
<item>
<layout class="QGridLayout" name="gridLayout">
<item row="1" column="0">
<widget class="QLabel" name="averagesLabel">
<property name="text">
<string>Averages</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="frequencyLabel">
<property name="text">
@ -60,16 +67,16 @@
<item row="1" column="1">
<widget class="QLineEdit" name="averagesEdit"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="averagesLabel">
<property name="text">
<string>Averages</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="frequencyEdit"/>
</item>
<item row="0" column="2">
<widget class="QLabel" name="frequencyunitLabel">
<property name="text">
<string>MHz</string>
</property>
</widget>
</item>
</layout>
</item>
<item>

View file

@ -39,18 +39,21 @@ class Ui_Form(object):
self.settingsLayout.addLayout(self.spectrometerLayout)
self.gridLayout = QtWidgets.QGridLayout()
self.gridLayout.setObjectName("gridLayout")
self.averagesLabel = QtWidgets.QLabel(parent=Form)
self.averagesLabel.setObjectName("averagesLabel")
self.gridLayout.addWidget(self.averagesLabel, 1, 0, 1, 1)
self.frequencyLabel = QtWidgets.QLabel(parent=Form)
self.frequencyLabel.setObjectName("frequencyLabel")
self.gridLayout.addWidget(self.frequencyLabel, 0, 0, 1, 1)
self.averagesEdit = QtWidgets.QLineEdit(parent=Form)
self.averagesEdit.setObjectName("averagesEdit")
self.gridLayout.addWidget(self.averagesEdit, 1, 1, 1, 1)
self.averagesLabel = QtWidgets.QLabel(parent=Form)
self.averagesLabel.setObjectName("averagesLabel")
self.gridLayout.addWidget(self.averagesLabel, 1, 0, 1, 1)
self.frequencyEdit = QtWidgets.QLineEdit(parent=Form)
self.frequencyEdit.setObjectName("frequencyEdit")
self.gridLayout.addWidget(self.frequencyEdit, 0, 1, 1, 1)
self.frequencyunitLabel = QtWidgets.QLabel(parent=Form)
self.frequencyunitLabel.setObjectName("frequencyunitLabel")
self.gridLayout.addWidget(self.frequencyunitLabel, 0, 2, 1, 1)
self.settingsLayout.addLayout(self.gridLayout)
self.buttonStart = QtWidgets.QPushButton(parent=Form)
self.buttonStart.setObjectName("buttonStart")
@ -95,8 +98,9 @@ class Ui_Form(object):
Form.setWindowTitle(_translate("Form", "Form"))
self.titleLable.setText(_translate("Form", "Single Frequency Measurement: "))
self.spectrometerLabel.setText(_translate("Form", "Spectrometer:"))
self.frequencyLabel.setText(_translate("Form", "Target Frequency"))
self.averagesLabel.setText(_translate("Form", "Averages"))
self.frequencyLabel.setText(_translate("Form", "Target Frequency"))
self.frequencyunitLabel.setText(_translate("Form", "MHz"))
self.buttonStart.setText(_translate("Form", "Start Measurement"))
self.fftButton.setText(_translate("Form", "FFT"))
from nqrduck.contrib.mplwidget import MplWidget