From 896048ab3919465061c5425c1ce1a368b652891b Mon Sep 17 00:00:00 2001 From: jupfi Date: Mon, 17 Jul 2023 10:18:06 +0200 Subject: [PATCH] Initial commit. --- .gitignore | 22 +++++++ LICENSE | 21 ++++++ README.md | 0 pyproject.toml | 33 ++++++++++ src/nqrduck_measurement/__init__.py | 1 + src/nqrduck_measurement/controller.py | 8 +++ src/nqrduck_measurement/measurement.py | 6 ++ src/nqrduck_measurement/model.py | 8 +++ .../resources/measurement_widget.ui | 64 +++++++++++++++++++ .../resources/mesurement.ini | 10 +++ src/nqrduck_measurement/view.py | 15 +++++ src/nqrduck_measurement/widget.py | 51 +++++++++++++++ 12 files changed, 239 insertions(+) create mode 100644 .gitignore create mode 100644 LICENSE create mode 100644 README.md create mode 100644 pyproject.toml create mode 100644 src/nqrduck_measurement/__init__.py create mode 100644 src/nqrduck_measurement/controller.py create mode 100644 src/nqrduck_measurement/measurement.py create mode 100644 src/nqrduck_measurement/model.py create mode 100644 src/nqrduck_measurement/resources/measurement_widget.ui create mode 100644 src/nqrduck_measurement/resources/mesurement.ini create mode 100644 src/nqrduck_measurement/view.py create mode 100644 src/nqrduck_measurement/widget.py diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c1a36ca --- /dev/null +++ b/.gitignore @@ -0,0 +1,22 @@ +# Byte-compiled / optimized / DLL files +__pycache__/ +*.pyc +*$py.class + +# Distribution / packaging +dist/ +build/ +*.egg-info/ + +# IDE-specific files +.idea/ +.vscode/ + +# Logs +*.log + +# Virtual environments +venv/ + +# Other +*.DS_Store \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..94b1433 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2023 Julia Pfitzer + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..e69de29 diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..e5e4c64 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,33 @@ +[build-system] +requires = ["hatchling"] +build-backend = "hatchling.build" + +[tool.hatch.metadata] +allow-direct-references = true + +[project] +name = "nqrduck-measurement" +version = "0.0.1" +authors = [ + { name="Julia Pfitzer", email="git@jupfi.me" }, +] + +description = "A module for the NQRduck program (a simple python scriptâ„¢) to perform single frequency measurements." +readme = "README.md" +license = { file="LICENSE" } +requires-python = ">=3.8" + +classifiers = [ + "Programming Language :: Python :: 3", + "License :: OSI Approved :: MIT License", + "Operating System :: OS Independent", +] + +dependencies = [ + "matplotlib", + "pyqt6", + "NQRduck", +] + +[project.entry-points."nqrduck"] +"nqrduck-measurement" = "nqrduck_measurement.measurement:Measurement" \ No newline at end of file diff --git a/src/nqrduck_measurement/__init__.py b/src/nqrduck_measurement/__init__.py new file mode 100644 index 0000000..9adb38f --- /dev/null +++ b/src/nqrduck_measurement/__init__.py @@ -0,0 +1 @@ +from .measurement import Measurement as Module \ No newline at end of file diff --git a/src/nqrduck_measurement/controller.py b/src/nqrduck_measurement/controller.py new file mode 100644 index 0000000..dcf8137 --- /dev/null +++ b/src/nqrduck_measurement/controller.py @@ -0,0 +1,8 @@ +import logging +from nqrduck.module.module_controller import ModuleController + +logger = logging.getLogger(__name__) + +class MeasurementController(ModuleController): + def __init__(self, module): + super().__init__(module) \ No newline at end of file diff --git a/src/nqrduck_measurement/measurement.py b/src/nqrduck_measurement/measurement.py new file mode 100644 index 0000000..51663af --- /dev/null +++ b/src/nqrduck_measurement/measurement.py @@ -0,0 +1,6 @@ +from nqrduck.module.module import Module +from .model import MeasurementModel +from .view import MeasurementView +from .controller import MeasurementController + +Measurement = Module(MeasurementModel, MeasurementView, MeasurementController) \ No newline at end of file diff --git a/src/nqrduck_measurement/model.py b/src/nqrduck_measurement/model.py new file mode 100644 index 0000000..ba7e885 --- /dev/null +++ b/src/nqrduck_measurement/model.py @@ -0,0 +1,8 @@ +import logging +from nqrduck.module.module_model import ModuleModel + +logger = logging.getLogger(__name__) + +class MeasurementModel(ModuleModel): + def __init__(self, module) -> None: + super().__init__(module) \ No newline at end of file diff --git a/src/nqrduck_measurement/resources/measurement_widget.ui b/src/nqrduck_measurement/resources/measurement_widget.ui new file mode 100644 index 0000000..711d751 --- /dev/null +++ b/src/nqrduck_measurement/resources/measurement_widget.ui @@ -0,0 +1,64 @@ + + + Form + + + + 0 + 0 + 1920 + 1080 + + + + + 0 + 0 + + + + Form + + + + + + + + + + Start Measurement + + + + + + + Spectrometer: + + + + + + + + + + + + + + + + + + + MplWidget + QWidget +
contrib/mplwidget.h
+ 1 +
+
+ + +
diff --git a/src/nqrduck_measurement/resources/mesurement.ini b/src/nqrduck_measurement/resources/mesurement.ini new file mode 100644 index 0000000..0c2de1e --- /dev/null +++ b/src/nqrduck_measurement/resources/mesurement.ini @@ -0,0 +1,10 @@ +[META] +name = nqrduck-measurement +toolbar_name = Measurement +category = Measurement +tooltip = AModule to perform single frequency measurement + +[FILES] +widget_file = measurement_widget.py +toolbox_logo = resources/toolbox_logo.png + diff --git a/src/nqrduck_measurement/view.py b/src/nqrduck_measurement/view.py new file mode 100644 index 0000000..a10f8ab --- /dev/null +++ b/src/nqrduck_measurement/view.py @@ -0,0 +1,15 @@ +import logging +from PyQt6.QtWidgets import QWidget +from .widget import Ui_Form +from nqrduck.module.module_view import ModuleView + +logger = logging.getLogger(__name__) + +class MeasurementView(ModuleView): + def __init__(self, module): + super().__init__(module) + + widget = QWidget() + self._ui_form = Ui_Form() + self._ui_form.setupUi(self) + self.widget = widget \ No newline at end of file diff --git a/src/nqrduck_measurement/widget.py b/src/nqrduck_measurement/widget.py new file mode 100644 index 0000000..b281760 --- /dev/null +++ b/src/nqrduck_measurement/widget.py @@ -0,0 +1,51 @@ +# Form implementation generated from reading ui file '../Modules/nqrduck-measurement/src/nqrduck_measurement/resources/measurement_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(1920, 1080) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Minimum, QtWidgets.QSizePolicy.Policy.Minimum) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(Form.sizePolicy().hasHeightForWidth()) + Form.setSizePolicy(sizePolicy) + self.horizontalLayout = QtWidgets.QHBoxLayout(Form) + self.horizontalLayout.setObjectName("horizontalLayout") + self.horizontalLayout_2 = QtWidgets.QHBoxLayout() + self.horizontalLayout_2.setObjectName("horizontalLayout_2") + self.verticalLayout_2 = QtWidgets.QVBoxLayout() + self.verticalLayout_2.setObjectName("verticalLayout_2") + self.buttonStart = QtWidgets.QPushButton(parent=Form) + self.buttonStart.setObjectName("buttonStart") + self.verticalLayout_2.addWidget(self.buttonStart) + self.labelSpectrometer = QtWidgets.QLabel(parent=Form) + self.labelSpectrometer.setObjectName("labelSpectrometer") + self.verticalLayout_2.addWidget(self.labelSpectrometer) + self.horizontalLayout_2.addLayout(self.verticalLayout_2) + self.verticalLayout = QtWidgets.QVBoxLayout() + self.verticalLayout.setObjectName("verticalLayout") + self.plotter = MplWidget(parent=Form) + self.plotter.setObjectName("plotter") + self.verticalLayout.addWidget(self.plotter) + self.horizontalLayout_2.addLayout(self.verticalLayout) + self.horizontalLayout.addLayout(self.horizontalLayout_2) + + self.retranslateUi(Form) + QtCore.QMetaObject.connectSlotsByName(Form) + + def retranslateUi(self, Form): + _translate = QtCore.QCoreApplication.translate + Form.setWindowTitle(_translate("Form", "Form")) + self.buttonStart.setText(_translate("Form", "Start Measurement")) + self.labelSpectrometer.setText(_translate("Form", "Spectrometer:")) + +from nqrduck.contrib.mplwidget import MplWidget