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

View file

@ -123,7 +123,7 @@ class AutoTMView(ModuleView):
Args: Args:
serial (serial.Serial): The current serial connection.""" serial (serial.Serial): The current serial connection."""
logger.debug("Updating serial connection label") logger.debug("Updating serial connection label")
if serial.isOpen(): if serial:
self._ui_form.connectionLabel.setText(serial.portName()) self._ui_form.connectionLabel.setText(serial.portName())
self.add_info_text("Connected to device %s" % serial.portName()) self.add_info_text("Connected to device %s" % serial.portName())
else: else:
@ -155,8 +155,12 @@ class AutoTMView(ModuleView):
plt.show() plt.show()
""" """
self._ui_form.S11Plot.canvas.ax.clear()
magnitude_ax = self._ui_form.S11Plot.canvas.ax magnitude_ax = self._ui_form.S11Plot.canvas.ax
magnitude_ax.clear() magnitude_ax.clear()
phase_ax = self._ui_form.S11Plot.canvas.ax.twinx()
phase_ax.clear()
# @ TODO: implement proper calibration # @ TODO: implement proper calibration
if self.module.model.calibration is not None: if self.module.model.calibration is not None:
# Calibration test: # Calibration test:
@ -181,8 +185,6 @@ class AutoTMView(ModuleView):
cmath.log10(abs(g + 1e-12)) for g in gamma_corr] cmath.log10(abs(g + 1e-12)) for g in gamma_corr]
magnitude_ax.plot(frequency, return_loss_db_corr, color="red") 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.set_ylabel("|Phase (deg)|")
phase_ax.plot(frequency, phase, color="orange", linestyle="--") phase_ax.plot(frequency, phase, color="orange", linestyle="--")
phase_ax.set_ylim(-180, 180) 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' # 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 # 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. # 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) self.titleconnectionLabel = QtWidgets.QLabel(parent=Form)
font = QtGui.QFont() font = QtGui.QFont()
font.setBold(True) font.setBold(True)
font.setWeight(75)
self.titleconnectionLabel.setFont(font) self.titleconnectionLabel.setFont(font)
self.titleconnectionLabel.setObjectName("titleconnectionLabel") self.titleconnectionLabel.setObjectName("titleconnectionLabel")
self.verticalLayout_2.addWidget(self.titleconnectionLabel) self.verticalLayout_2.addWidget(self.titleconnectionLabel)
@ -54,7 +53,6 @@ class Ui_Form(object):
self.titletypeLabel = QtWidgets.QLabel(parent=Form) self.titletypeLabel = QtWidgets.QLabel(parent=Form)
font = QtGui.QFont() font = QtGui.QFont()
font.setBold(True) font.setBold(True)
font.setWeight(75)
self.titletypeLabel.setFont(font) self.titletypeLabel.setFont(font)
self.titletypeLabel.setObjectName("titletypeLabel") self.titletypeLabel.setObjectName("titletypeLabel")
self.verticalLayout_2.addWidget(self.titletypeLabel) self.verticalLayout_2.addWidget(self.titletypeLabel)
@ -93,12 +91,12 @@ class Ui_Form(object):
self.resolutionBox = QtWidgets.QDoubleSpinBox(parent=self.elecTab) self.resolutionBox = QtWidgets.QDoubleSpinBox(parent=self.elecTab)
self.resolutionBox.setObjectName("resolutionBox") self.resolutionBox.setObjectName("resolutionBox")
self.gridLayout_3.addWidget(self.resolutionBox, 3, 1, 1, 1) self.gridLayout_3.addWidget(self.resolutionBox, 3, 1, 1, 1)
self.gridLayout_3.setRowStretch(3, 1)
self.typeTab.addTab(self.elecTab, "") self.typeTab.addTab(self.elecTab, "")
self.verticalLayout_2.addWidget(self.typeTab) self.verticalLayout_2.addWidget(self.typeTab)
self.titlefrequencyLabel = QtWidgets.QLabel(parent=Form) self.titlefrequencyLabel = QtWidgets.QLabel(parent=Form)
font = QtGui.QFont() font = QtGui.QFont()
font.setBold(True) font.setBold(True)
font.setWeight(75)
self.titlefrequencyLabel.setFont(font) self.titlefrequencyLabel.setFont(font)
self.titlefrequencyLabel.setObjectName("titlefrequencyLabel") self.titlefrequencyLabel.setObjectName("titlefrequencyLabel")
self.verticalLayout_2.addWidget(self.titlefrequencyLabel) self.verticalLayout_2.addWidget(self.titlefrequencyLabel)
@ -135,7 +133,6 @@ class Ui_Form(object):
self.titleinfoLabel = QtWidgets.QLabel(parent=Form) self.titleinfoLabel = QtWidgets.QLabel(parent=Form)
font = QtGui.QFont() font = QtGui.QFont()
font.setBold(True) font.setBold(True)
font.setWeight(75)
self.titleinfoLabel.setFont(font) self.titleinfoLabel.setFont(font)
self.titleinfoLabel.setObjectName("titleinfoLabel") self.titleinfoLabel.setObjectName("titleinfoLabel")
self.verticalLayout_2.addWidget(self.titleinfoLabel) self.verticalLayout_2.addWidget(self.titleinfoLabel)
@ -143,7 +140,7 @@ class Ui_Form(object):
self.scrollArea.setWidgetResizable(True) self.scrollArea.setWidgetResizable(True)
self.scrollArea.setObjectName("scrollArea") self.scrollArea.setObjectName("scrollArea")
self.scrollAreaWidgetContents = QtWidgets.QWidget() 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.scrollAreaWidgetContents.setObjectName("scrollAreaWidgetContents")
self.scrollArea.setWidget(self.scrollAreaWidgetContents) self.scrollArea.setWidget(self.scrollAreaWidgetContents)
self.verticalLayout_2.addWidget(self.scrollArea) self.verticalLayout_2.addWidget(self.scrollArea)
@ -162,7 +159,7 @@ class Ui_Form(object):
self.horizontalLayout_2.setStretch(1, 1) self.horizontalLayout_2.setStretch(1, 1)
self.retranslateUi(Form) self.retranslateUi(Form)
self.typeTab.setCurrentIndex(1) self.typeTab.setCurrentIndex(0)
QtCore.QMetaObject.connectSlotsByName(Form) QtCore.QMetaObject.connectSlotsByName(Form)
def retranslateUi(self, Form): def retranslateUi(self, Form):