diff --git a/docs/0900766b804c9851.pdf b/docs/0900766b804c9851.pdf new file mode 100644 index 0000000..409c620 Binary files /dev/null and b/docs/0900766b804c9851.pdf differ diff --git a/pyproject.toml b/pyproject.toml index 7ce6881..93344e5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,7 +3,20 @@ name = "pyrelacs" version = "0.1.0" description = "Relaxed ELectrophysiology Acquisition, Control, and Stimulation in python" authors = ["wendtalexander "] +repository = "https://whale.am28.uni-tuebingen.de/git/awendt/pyrelacs" readme = "README.md" +license = "MIT" +organization = "de.uni-tuebingen.neuroetho" +classifiers = [ + "Topic :: Scientific/Engineering", + "Intended Audience :: Science/Research", + "Intended Audience :: End Users/Desktop", +] +copyright = "(c) 2020, Neuroethology lab, Uni Tuebingen" + +include = [ + { path = "pyproject.toml" } +] [tool.poetry.dependencies] python = "^3.12" @@ -13,8 +26,11 @@ matplotlib = "^3.9.2" numpy = "^2.1.1" pyqt6 = "^6.7.1" tomli = "^2.0.1" +tomlkit = "^0.13.2" scipy = "^1.14.1" +[tool.poetry.scripts] +pyrelacs = "pyrelacs.app:main" [build-system] requires = ["poetry-core"] diff --git a/pyrelacs/app.py b/pyrelacs/app.py index ea8c152..d346741 100644 --- a/pyrelacs/app.py +++ b/pyrelacs/app.py @@ -2,7 +2,7 @@ from PyQt6.QtGui import QAction import sys import pathlib -from PyQt6.QtCore import QProcess, QSize, QThreadPool, Qt +from PyQt6.QtCore import QProcess, QSize, QThreadPool, Qt, QSettings from PyQt6.QtWidgets import ( QApplication, QGridLayout, @@ -17,6 +17,7 @@ from IPython import embed import numpy as np from pyrelacs.util.logging import config_logging +import pyrelacs.info as info from pyrelacs.worker import Worker from pyrelacs.repros.repros import Repro @@ -94,8 +95,35 @@ class PyRelacs(QMainWindow): self.text.appendPlainText(f"started Repro {n}, {fn}") -if __name__ == "__main__": +def main(): app = QApplication(sys.argv) + app.setApplicationName(info.NAME) + app.setApplicationVersion(str(info.VERSION)) + app.setOrganizationDomain(info.ORGANIZATION) + + # read window settings + settings = QSettings(info.ORGANIZATION, info.NAME) + width = int(settings.value("app/width", 1024)) + height = int(settings.value("app/height", 768)) + x = int(settings.value("app/pos_x", 100)) + y = int(settings.value("app/pos_y", 100)) + window = PyRelacs() + window.setMinimumWidth(200) + window.setMinimumHeight(200) + window.resize(width, height) + window.move(x, y) window.show() app.exec() + + # store window position and size + pos = window.pos() + settings.setValue("app/width", window.width()) + settings.setValue("app/height", window.height()) + settings.setValue("app/pos_x", pos.x()) + settings.setValue("app/pos_y", pos.y()) + sys.exit(exit_code) + + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/pyrelacs/info.py b/pyrelacs/info.py new file mode 100644 index 0000000..5d5c9a8 --- /dev/null +++ b/pyrelacs/info.py @@ -0,0 +1,37 @@ +import tomlkit +import pathlib + +def load_project_settings(project_root): + # Read the pyproject.toml file + with open(pathlib.Path.joinpath(project_root, 'pyproject.toml'), 'r') as f: + pyproject_content = f.read() + + # Parse the toml content + pyproject = tomlkit.parse(pyproject_content) + + # Access project settings + return { + 'name': pyproject['tool']['poetry']['name'], + 'version': pyproject['tool']['poetry']['version'], + 'description': pyproject['tool']['poetry']['description'], + 'authors': pyproject['tool']['poetry']['authors'], + 'readme': pyproject['tool']['poetry']['authors'], + 'licence': pyproject['tool']['poetry']['license'], + 'organization': pyproject['tool']['poetry']['organization'], + 'classifiers': pyproject['tool']['poetry']['classifiers'], + 'copyright': pyproject['tool']['poetry']['copyright'], + "repository": pyproject['tool']['poetry']['repository'], + } + + +_root = pathlib.Path(__file__).parent.parent +_infodict = load_project_settings(_root) + +NAME = _infodict["name"] +VERSION = _infodict["version"] +AUTHORS = _infodict["authors"] +COPYRIGHT = _infodict["copyright"] +HOMEPAGE = _infodict["repository"] +CLASSIFIERS = _infodict["classifiers"] +DESCRIPTION = _infodict["description"] +ORGANIZATION = _infodict["organization"]