From b605781082fdbb24705e555436ec73cb6905949d Mon Sep 17 00:00:00 2001 From: jupfi Date: Fri, 24 Nov 2023 08:56:42 +0100 Subject: [PATCH] Initial commit. --- .gitignore | 22 ++++++++++++ LICENSE | 21 ++++++++++++ README.md | 2 ++ pyproject.toml | 30 ++++++++++++++++ src/nqrduck_module/__init__.py | 4 +++ src/nqrduck_module/controller.py | 13 +++++++ src/nqrduck_module/model.py | 9 +++++ src/nqrduck_module/module.py | 14 ++++++++ src/nqrduck_module/resources/module.ini | 6 ++++ src/nqrduck_module/resources/module_widget.ui | 34 +++++++++++++++++++ src/nqrduck_module/view.py | 19 +++++++++++ src/nqrduck_module/widget.py | 33 ++++++++++++++++++ 12 files changed, 207 insertions(+) create mode 100644 .gitignore create mode 100644 LICENSE create mode 100644 README.md create mode 100644 pyproject.toml create mode 100644 src/nqrduck_module/__init__.py create mode 100644 src/nqrduck_module/controller.py create mode 100644 src/nqrduck_module/model.py create mode 100644 src/nqrduck_module/module.py create mode 100644 src/nqrduck_module/resources/module.ini create mode 100644 src/nqrduck_module/resources/module_widget.ui create mode 100644 src/nqrduck_module/view.py create mode 100644 src/nqrduck_module/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..e76702c --- /dev/null +++ b/README.md @@ -0,0 +1,2 @@ +# Introduction +This is a template for a nqrduck module. \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..7206e50 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,30 @@ +[build-system] +requires = ["hatchling"] +build-backend = "hatchling.build" + +[project] +name = "nqrduck-module" +version = "0.0.1" +authors = [ + { name="Julia Pfitzer", email="git@jupfi.me" }, +] + +description = "A template for nqrduck modules." +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-module" = "nqrduck_module.module:module" diff --git a/src/nqrduck_module/__init__.py b/src/nqrduck_module/__init__.py new file mode 100644 index 0000000..1c875ee --- /dev/null +++ b/src/nqrduck_module/__init__.py @@ -0,0 +1,4 @@ +# If the module is called "duck" the following line would be: +# from .duck import Duck as Module + +from .module import Module as Module \ No newline at end of file diff --git a/src/nqrduck_module/controller.py b/src/nqrduck_module/controller.py new file mode 100644 index 0000000..ff82583 --- /dev/null +++ b/src/nqrduck_module/controller.py @@ -0,0 +1,13 @@ +from nqrduck.module.module_controller import ModuleController + +# If the module is called "duck" the class would be called "DuckController" + +class ModuleController(ModuleController): + + def __init__(self, module): + """Initialize the controller.""" + super().__init__(module) + + def on_loading(self): + """This method is called when the module is loaded.""" + pass \ No newline at end of file diff --git a/src/nqrduck_module/model.py b/src/nqrduck_module/model.py new file mode 100644 index 0000000..f3d0648 --- /dev/null +++ b/src/nqrduck_module/model.py @@ -0,0 +1,9 @@ +from nqrduck.module.module_model import ModuleModel + +# If the module is called "duck" the class would be called "DuckModel" + +class ModuleModel(ModuleModel): + + def __init__(self, module): + """Initialize the model.""" + super().__init__(module) \ No newline at end of file diff --git a/src/nqrduck_module/module.py b/src/nqrduck_module/module.py new file mode 100644 index 0000000..0166ab2 --- /dev/null +++ b/src/nqrduck_module/module.py @@ -0,0 +1,14 @@ +from nqrduck.module.module import Module +# If the module is called "duck" the following line would be: +# from .model import DuckModel +from .model import ModuleModel +# If the module is called "duck" the following line would be: +# from .view import DuckView +from .view import ModuleView +# If the module is called "duck" the following line would be: +# from .controller import DuckController +from .controller import ModuleController + +# If the module is called "duck" the following line would be: +# Duck = Module(DuckModel, DuckView, DuckController) +module = Module(ModuleModel, ModuleView, ModuleController) \ No newline at end of file diff --git a/src/nqrduck_module/resources/module.ini b/src/nqrduck_module/resources/module.ini new file mode 100644 index 0000000..53836c5 --- /dev/null +++ b/src/nqrduck_module/resources/module.ini @@ -0,0 +1,6 @@ +[META] +name = nqrduck-module +category = Measurement +toolbar_name = MODULETOOLBARNAME +tooltip = Template for a new module + diff --git a/src/nqrduck_module/resources/module_widget.ui b/src/nqrduck_module/resources/module_widget.ui new file mode 100644 index 0000000..ac77041 --- /dev/null +++ b/src/nqrduck_module/resources/module_widget.ui @@ -0,0 +1,34 @@ + + + Form + + + + 0 + 0 + 1920 + 1080 + + + + + 0 + 0 + + + + Form + + + + + + Test + + + + + + + + diff --git a/src/nqrduck_module/view.py b/src/nqrduck_module/view.py new file mode 100644 index 0000000..2dd1495 --- /dev/null +++ b/src/nqrduck_module/view.py @@ -0,0 +1,19 @@ +from nqrduck.module.module_view import ModuleView + +# This is the widget that is loaded into the module view. +# It is generated from the .ui file in the same directory using the pyuic6 command. +from .widget import Ui_Form + +from PyQt6.QtWidgets import QWidget + +# If the module is called "duck" the class would be called "DuckView" + +class ModuleView(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_module/widget.py b/src/nqrduck_module/widget.py new file mode 100644 index 0000000..808dd3e --- /dev/null +++ b/src/nqrduck_module/widget.py @@ -0,0 +1,33 @@ +# Form implementation generated from reading ui file '../Modules/nqrduck-module/src/nqrduck_module/resources/module_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.Expanding, QtWidgets.QSizePolicy.Policy.Expanding) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(Form.sizePolicy().hasHeightForWidth()) + Form.setSizePolicy(sizePolicy) + self.horizontalLayout = QtWidgets.QHBoxLayout(Form) + self.horizontalLayout.setObjectName("horizontalLayout") + self.pushButton = QtWidgets.QPushButton(parent=Form) + self.pushButton.setObjectName("pushButton") + self.horizontalLayout.addWidget(self.pushButton) + + self.retranslateUi(Form) + QtCore.QMetaObject.connectSlotsByName(Form) + + def retranslateUi(self, Form): + _translate = QtCore.QCoreApplication.translate + Form.setWindowTitle(_translate("Form", "Form")) + self.pushButton.setText(_translate("Form", "Test"))