From 9e772a9f5cc1074edf3d66556f41b763f58f29d7 Mon Sep 17 00:00:00 2001 From: jupfi Date: Wed, 16 Aug 2023 12:16:11 +0200 Subject: [PATCH] Fixed bug with displaying of active serial. --- src/nqrduck_autotm/resources/autotm_widget.ui | 14 +++++--------- src/nqrduck_autotm/view.py | 8 +++++--- src/nqrduck_autotm/widget.py | 11 ++++------- 3 files changed, 14 insertions(+), 19 deletions(-) diff --git a/src/nqrduck_autotm/resources/autotm_widget.ui b/src/nqrduck_autotm/resources/autotm_widget.ui index 4e02f66..804180c 100644 --- a/src/nqrduck_autotm/resources/autotm_widget.ui +++ b/src/nqrduck_autotm/resources/autotm_widget.ui @@ -26,7 +26,6 @@ - 75 true @@ -81,7 +80,6 @@ - 75 true @@ -93,13 +91,13 @@ - 1 + 0 Mechanical - + @@ -113,7 +111,7 @@ Electrical - + @@ -159,7 +157,6 @@ - 75 true @@ -231,7 +228,6 @@ - 75 true @@ -250,8 +246,8 @@ 0 0 - 273 - 83 + 297 + 169 diff --git a/src/nqrduck_autotm/view.py b/src/nqrduck_autotm/view.py index 67f0955..88698f4 100644 --- a/src/nqrduck_autotm/view.py +++ b/src/nqrduck_autotm/view.py @@ -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) diff --git a/src/nqrduck_autotm/widget.py b/src/nqrduck_autotm/widget.py index 0bd74f6..8007741 100644 --- a/src/nqrduck_autotm/widget.py +++ b/src/nqrduck_autotm/widget.py @@ -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):