Updated nqrduck to newest module structure.

This commit is contained in:
jupfi 2023-07-31 08:50:34 +02:00
parent d1129bd32a
commit 14d14488c7
12 changed files with 367 additions and 291 deletions

View file

@ -22,7 +22,10 @@ classifiers = [
dependencies = [ dependencies = [
"matplotlib", "matplotlib",
"pyqt5", "pyqt6",
"NQRduck", "NQRduck",
] ]
[project.entry-points."nqrduck"]
"nqrduck-autotm" = "nqrduck_autotm.autotm:AutoTM"

View file

@ -0,0 +1 @@
from .autotm import AutoTM as Module

View file

@ -0,0 +1,6 @@
from nqrduck.module.module import Module
from .model import AutoTMModel
from .view import AutoTMView
from .controller import AutoTMController
AutoTM = Module(AutoTMModel, AutoTMView, AutoTMController)

View file

@ -0,0 +1,4 @@
from nqrduck.module.module_controller import ModuleController
class AutoTMController(ModuleController):
pass

View file

@ -1,5 +1,4 @@
from nqrduck.module.module_model import ModuleModel from nqrduck.module.module_model import ModuleModel
class AutoTM(ModuleModel): class AutoTMModel(ModuleModel):
pass

View file

@ -1,12 +1,6 @@
[META] [META]
name = nqrduck-autotm name = nqrduck-autotm
category = Measurement category = Measurement
toolbar_name = Tuning and Matching
tooltip = Application used for tuning and matching of the probe tooltip = Application used for tuning and matching of the probe
[FILES]
config = resources/AutoTM.ini
widget_file = autotm_widget
toolbox_logo = resources/toolbox_logo.png
[DEPENDECIES]
Spectrometer

View file

@ -1,280 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Form</class>
<widget class="QWidget" name="Form">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>1280</width>
<height>645</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<widget class="QWidget" name="verticalLayoutWidget_5">
<property name="geometry">
<rect>
<x>310</x>
<y>0</y>
<width>831</width>
<height>651</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_5">
<item>
<widget class="MplWidget" name="S11" native="true"/>
</item>
</layout>
</widget>
<widget class="QWidget" name="verticalLayoutWidget_4">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>311</width>
<height>651</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="label_8">
<property name="font">
<font>
<pointsize>12</pointsize>
<weight>50</weight>
<italic>false</italic>
<bold>false</bold>
</font>
</property>
<property name="text">
<string>Tuning and Matching Settings:</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Minimum Return Loss</string>
</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>
<item>
<widget class="QLineEdit" name="minimum_returnloss_Field">
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="text">
<string>15</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>dB</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QLabel" name="label_7">
<property name="text">
<string>Frequency</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_7">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>80</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLineEdit" name="frequency_Field">
<property name="text">
<string>100</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_8">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>75</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="label_5">
<property name="text">
<string>MHz</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QPushButton" name="start_TM_Button">
<property name="text">
<string>Start Tuning and Matching</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QLabel" name="label_10">
<property name="font">
<font>
<pointsize>12</pointsize>
<weight>50</weight>
<italic>false</italic>
<bold>false</bold>
</font>
</property>
<property name="text">
<string>Actions:</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="homing_Button">
<property name="text">
<string>Homing</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="measure_returnloss_Button">
<property name="text">
<string>Measure Return Loss</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="file_pathLabel">
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QLabel" name="label_9">
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="text">
<string>Info Box:</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QProgressBar" name="tm_Progress">
<property name="value">
<number>0</number>
</property>
</widget>
</item>
<item>
<widget class="QScrollArea" name="infoBox">
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>301</width>
<height>296</height>
</rect>
</property>
</widget>
</widget>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</widget>
</widget>
<customwidgets>
<customwidget>
<class>MplWidget</class>
<extends>QWidget</extends>
<header>contrib/mplwidget.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>

View file

@ -0,0 +1,198 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Form</class>
<widget class="QWidget" name="Form">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>1280</width>
<height>645</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2" stretch="0,1">
<item>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QLabel" name="label_2">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Connection Settings:</string>
</property>
</widget>
</item>
<item>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Port:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="portBox"/>
</item>
<item row="1" column="1">
<widget class="QPushButton" name="pushButton">
<property name="text">
<string>Connect</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QLabel" name="label_3">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>T&amp;M Type:</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="comboBox"/>
</item>
<item>
<widget class="QLabel" name="label_4">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Frequency Sweep:</string>
</property>
</widget>
</item>
<item>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="1">
<widget class="QLineEdit" name="startEdit"/>
</item>
<item row="1" column="2">
<widget class="QLabel" name="label_8">
<property name="text">
<string>MHz</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="stopEdit"/>
</item>
<item row="0" column="2">
<widget class="QLabel" name="label_6">
<property name="text">
<string>MHz</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_7">
<property name="text">
<string>Stop Frequency:</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Start Frequency:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QPushButton" name="pushButton_2">
<property name="text">
<string>Start Sweep</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QPushButton" name="pushButton_3">
<property name="text">
<string>T&amp;M Settings</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_9">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Info Box:</string>
</property>
</widget>
</item>
<item>
<widget class="QScrollArea" name="scrollArea">
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>273</width>
<height>255</height>
</rect>
</property>
</widget>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_5">
<item>
<widget class="MplWidget" name="S11" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>MplWidget</class>
<extends>QWidget</extends>
<header>nqrduck/contrib/mplwidget.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>

View file

@ -0,0 +1,16 @@
import logging
from PyQt6.QtWidgets import QWidget
from nqrduck.module.module_view import ModuleView
from .widget import Ui_Form
logger = logging.getLogger(__name__)
class AutoTMView(ModuleView):
def __init__(self, module):
super().__init__(module)
widget = QWidget()
self._ui_form = Ui_Form()
self._ui_form.setupUi(self)
self.widget = widget

View file

@ -0,0 +1,135 @@
# 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
#
# 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.
from PyQt6 import QtCore, QtGui, QtWidgets
class Ui_Form(object):
def setupUi(self, Form):
Form.setObjectName("Form")
Form.resize(1280, 645)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Preferred, QtWidgets.QSizePolicy.Policy.Preferred)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(Form.sizePolicy().hasHeightForWidth())
Form.setSizePolicy(sizePolicy)
self.horizontalLayout_2 = QtWidgets.QHBoxLayout(Form)
self.horizontalLayout_2.setObjectName("horizontalLayout_2")
self.verticalLayout_2 = QtWidgets.QVBoxLayout()
self.verticalLayout_2.setObjectName("verticalLayout_2")
self.label_2 = QtWidgets.QLabel(parent=Form)
font = QtGui.QFont()
font.setBold(True)
font.setWeight(75)
self.label_2.setFont(font)
self.label_2.setObjectName("label_2")
self.verticalLayout_2.addWidget(self.label_2)
self.gridLayout_2 = QtWidgets.QGridLayout()
self.gridLayout_2.setObjectName("gridLayout_2")
self.label = QtWidgets.QLabel(parent=Form)
self.label.setObjectName("label")
self.gridLayout_2.addWidget(self.label, 0, 0, 1, 1)
self.portBox = QtWidgets.QComboBox(parent=Form)
self.portBox.setObjectName("portBox")
self.gridLayout_2.addWidget(self.portBox, 0, 1, 1, 1)
self.pushButton = QtWidgets.QPushButton(parent=Form)
self.pushButton.setObjectName("pushButton")
self.gridLayout_2.addWidget(self.pushButton, 1, 1, 1, 1)
self.verticalLayout_2.addLayout(self.gridLayout_2)
self.label_3 = QtWidgets.QLabel(parent=Form)
font = QtGui.QFont()
font.setBold(True)
font.setWeight(75)
self.label_3.setFont(font)
self.label_3.setObjectName("label_3")
self.verticalLayout_2.addWidget(self.label_3)
self.comboBox = QtWidgets.QComboBox(parent=Form)
self.comboBox.setObjectName("comboBox")
self.verticalLayout_2.addWidget(self.comboBox)
self.label_4 = QtWidgets.QLabel(parent=Form)
font = QtGui.QFont()
font.setBold(True)
font.setWeight(75)
self.label_4.setFont(font)
self.label_4.setObjectName("label_4")
self.verticalLayout_2.addWidget(self.label_4)
self.gridLayout = QtWidgets.QGridLayout()
self.gridLayout.setObjectName("gridLayout")
self.startEdit = QtWidgets.QLineEdit(parent=Form)
self.startEdit.setObjectName("startEdit")
self.gridLayout.addWidget(self.startEdit, 0, 1, 1, 1)
self.label_8 = QtWidgets.QLabel(parent=Form)
self.label_8.setObjectName("label_8")
self.gridLayout.addWidget(self.label_8, 1, 2, 1, 1)
self.stopEdit = QtWidgets.QLineEdit(parent=Form)
self.stopEdit.setObjectName("stopEdit")
self.gridLayout.addWidget(self.stopEdit, 1, 1, 1, 1)
self.label_6 = QtWidgets.QLabel(parent=Form)
self.label_6.setObjectName("label_6")
self.gridLayout.addWidget(self.label_6, 0, 2, 1, 1)
self.label_7 = QtWidgets.QLabel(parent=Form)
self.label_7.setObjectName("label_7")
self.gridLayout.addWidget(self.label_7, 1, 0, 1, 1)
self.label_5 = QtWidgets.QLabel(parent=Form)
self.label_5.setObjectName("label_5")
self.gridLayout.addWidget(self.label_5, 0, 0, 1, 1)
self.pushButton_2 = QtWidgets.QPushButton(parent=Form)
self.pushButton_2.setObjectName("pushButton_2")
self.gridLayout.addWidget(self.pushButton_2, 2, 1, 1, 1)
self.verticalLayout_2.addLayout(self.gridLayout)
self.pushButton_3 = QtWidgets.QPushButton(parent=Form)
self.pushButton_3.setObjectName("pushButton_3")
self.verticalLayout_2.addWidget(self.pushButton_3)
self.label_9 = QtWidgets.QLabel(parent=Form)
font = QtGui.QFont()
font.setBold(True)
font.setWeight(75)
self.label_9.setFont(font)
self.label_9.setObjectName("label_9")
self.verticalLayout_2.addWidget(self.label_9)
self.scrollArea = QtWidgets.QScrollArea(parent=Form)
self.scrollArea.setWidgetResizable(True)
self.scrollArea.setObjectName("scrollArea")
self.scrollAreaWidgetContents = QtWidgets.QWidget()
self.scrollAreaWidgetContents.setGeometry(QtCore.QRect(0, 0, 273, 255))
self.scrollAreaWidgetContents.setObjectName("scrollAreaWidgetContents")
self.scrollArea.setWidget(self.scrollAreaWidgetContents)
self.verticalLayout_2.addWidget(self.scrollArea)
self.horizontalLayout_2.addLayout(self.verticalLayout_2)
self.verticalLayout_5 = QtWidgets.QVBoxLayout()
self.verticalLayout_5.setObjectName("verticalLayout_5")
self.S11 = MplWidget(parent=Form)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Expanding)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.S11.sizePolicy().hasHeightForWidth())
self.S11.setSizePolicy(sizePolicy)
self.S11.setObjectName("S11")
self.verticalLayout_5.addWidget(self.S11)
self.horizontalLayout_2.addLayout(self.verticalLayout_5)
self.horizontalLayout_2.setStretch(1, 1)
self.retranslateUi(Form)
QtCore.QMetaObject.connectSlotsByName(Form)
def retranslateUi(self, Form):
_translate = QtCore.QCoreApplication.translate
Form.setWindowTitle(_translate("Form", "Form"))
self.label_2.setText(_translate("Form", "Connection Settings:"))
self.label.setText(_translate("Form", "Port:"))
self.pushButton.setText(_translate("Form", "Connect"))
self.label_3.setText(_translate("Form", "T&M Type:"))
self.label_4.setText(_translate("Form", "Frequency Sweep:"))
self.label_8.setText(_translate("Form", "MHz"))
self.label_6.setText(_translate("Form", "MHz"))
self.label_7.setText(_translate("Form", "Stop Frequency:"))
self.label_5.setText(_translate("Form", "Start Frequency:"))
self.pushButton_2.setText(_translate("Form", "Start Sweep"))
self.pushButton_3.setText(_translate("Form", "T&M Settings"))
self.label_9.setText(_translate("Form", "Info Box:"))
from nqrduck.contrib.mplwidget import MplWidget