Fixed bug with displaying of active serial.

This commit is contained in:
jupfi 2023-08-16 12:16:11 +02:00
parent ca9c94c5db
commit 9e772a9f5c
3 changed files with 14 additions and 19 deletions

View file

@ -26,7 +26,6 @@
<widget class="QLabel" name="titleconnectionLabel">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
@ -81,7 +80,6 @@
<widget class="QLabel" name="titletypeLabel">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
@ -93,13 +91,13 @@
<item>
<widget class="QTabWidget" name="typeTab">
<property name="currentIndex">
<number>1</number>
<number>0</number>
</property>
<widget class="QWidget" name="mechTab">
<attribute name="title">
<string>Mechanical</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout">
<layout class="QVBoxLayout" name="verticalLayout" stretch="0">
<item>
<widget class="QPushButton" name="pushButton">
<property name="text">
@ -113,7 +111,7 @@
<attribute name="title">
<string>Electrical</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_3">
<layout class="QGridLayout" name="gridLayout_3" rowstretch="0,0,0,1">
<item row="1" column="1">
<widget class="QDoubleSpinBox" name="matchingBox"/>
</item>
@ -159,7 +157,6 @@
<widget class="QLabel" name="titlefrequencyLabel">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
@ -231,7 +228,6 @@
<widget class="QLabel" name="titleinfoLabel">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
@ -250,8 +246,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>273</width>
<height>83</height>
<width>297</width>
<height>169</height>
</rect>
</property>
</widget>

View file

@ -123,7 +123,7 @@ class AutoTMView(ModuleView):
Args:
serial (serial.Serial): The current serial connection."""
logger.debug("Updating serial connection label")
if serial.isOpen():
if serial:
self._ui_form.connectionLabel.setText(serial.portName())
self.add_info_text("Connected to device %s" % serial.portName())
else:
@ -155,8 +155,12 @@ class AutoTMView(ModuleView):
plt.show()
"""
self._ui_form.S11Plot.canvas.ax.clear()
magnitude_ax = self._ui_form.S11Plot.canvas.ax
magnitude_ax.clear()
phase_ax = self._ui_form.S11Plot.canvas.ax.twinx()
phase_ax.clear()
# @ TODO: implement proper calibration
if self.module.model.calibration is not None:
# Calibration test:
@ -181,8 +185,6 @@ class AutoTMView(ModuleView):
cmath.log10(abs(g + 1e-12)) for g in gamma_corr]
magnitude_ax.plot(frequency, return_loss_db_corr, color="red")
phase_ax = self._ui_form.S11Plot.canvas.ax.twinx()
phase_ax.clear()
phase_ax.set_ylabel("|Phase (deg)|")
phase_ax.plot(frequency, phase, color="orange", linestyle="--")
phase_ax.set_ylim(-180, 180)

View file

@ -1,6 +1,6 @@
# Form implementation generated from reading ui file '../Modules/nqrduck-autotm/src/nqrduck_autotm/resources/autotm_widget.ui'
#
# Created by: PyQt6 UI code generator 6.5.1
# Created by: PyQt6 UI code generator 6.4.2
#
# WARNING: Any manual changes made to this file will be lost when pyuic6 is
# run again. Do not edit this file unless you know what you are doing.
@ -25,7 +25,6 @@ class Ui_Form(object):
self.titleconnectionLabel = QtWidgets.QLabel(parent=Form)
font = QtGui.QFont()
font.setBold(True)
font.setWeight(75)
self.titleconnectionLabel.setFont(font)
self.titleconnectionLabel.setObjectName("titleconnectionLabel")
self.verticalLayout_2.addWidget(self.titleconnectionLabel)
@ -54,7 +53,6 @@ class Ui_Form(object):
self.titletypeLabel = QtWidgets.QLabel(parent=Form)
font = QtGui.QFont()
font.setBold(True)
font.setWeight(75)
self.titletypeLabel.setFont(font)
self.titletypeLabel.setObjectName("titletypeLabel")
self.verticalLayout_2.addWidget(self.titletypeLabel)
@ -93,12 +91,12 @@ class Ui_Form(object):
self.resolutionBox = QtWidgets.QDoubleSpinBox(parent=self.elecTab)
self.resolutionBox.setObjectName("resolutionBox")
self.gridLayout_3.addWidget(self.resolutionBox, 3, 1, 1, 1)
self.gridLayout_3.setRowStretch(3, 1)
self.typeTab.addTab(self.elecTab, "")
self.verticalLayout_2.addWidget(self.typeTab)
self.titlefrequencyLabel = QtWidgets.QLabel(parent=Form)
font = QtGui.QFont()
font.setBold(True)
font.setWeight(75)
self.titlefrequencyLabel.setFont(font)
self.titlefrequencyLabel.setObjectName("titlefrequencyLabel")
self.verticalLayout_2.addWidget(self.titlefrequencyLabel)
@ -135,7 +133,6 @@ class Ui_Form(object):
self.titleinfoLabel = QtWidgets.QLabel(parent=Form)
font = QtGui.QFont()
font.setBold(True)
font.setWeight(75)
self.titleinfoLabel.setFont(font)
self.titleinfoLabel.setObjectName("titleinfoLabel")
self.verticalLayout_2.addWidget(self.titleinfoLabel)
@ -143,7 +140,7 @@ class Ui_Form(object):
self.scrollArea.setWidgetResizable(True)
self.scrollArea.setObjectName("scrollArea")
self.scrollAreaWidgetContents = QtWidgets.QWidget()
self.scrollAreaWidgetContents.setGeometry(QtCore.QRect(0, 0, 273, 83))
self.scrollAreaWidgetContents.setGeometry(QtCore.QRect(0, 0, 297, 169))
self.scrollAreaWidgetContents.setObjectName("scrollAreaWidgetContents")
self.scrollArea.setWidget(self.scrollAreaWidgetContents)
self.verticalLayout_2.addWidget(self.scrollArea)
@ -162,7 +159,7 @@ class Ui_Form(object):
self.horizontalLayout_2.setStretch(1, 1)
self.retranslateUi(Form)
self.typeTab.setCurrentIndex(1)
self.typeTab.setCurrentIndex(0)
QtCore.QMetaObject.connectSlotsByName(Form)
def retranslateUi(self, Form):