Merge pull request 'main' (#1) from jgrewe/minipyrelacs:main into main
Reviewed-on: Awendt/pyrelacs#1
This commit is contained in:
commit
45a267c8c7
BIN
docs/0900766b804c9851.pdf
Normal file
BIN
docs/0900766b804c9851.pdf
Normal file
Binary file not shown.
@ -3,7 +3,20 @@ name = "pyrelacs"
|
|||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
description = "Relaxed ELectrophysiology Acquisition, Control, and Stimulation in python"
|
description = "Relaxed ELectrophysiology Acquisition, Control, and Stimulation in python"
|
||||||
authors = ["wendtalexander <wendtalexander@protonmail.com>"]
|
authors = ["wendtalexander <wendtalexander@protonmail.com>"]
|
||||||
|
repository = "https://whale.am28.uni-tuebingen.de/git/awendt/pyrelacs"
|
||||||
readme = "README.md"
|
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]
|
[tool.poetry.dependencies]
|
||||||
python = "^3.12"
|
python = "^3.12"
|
||||||
@ -13,8 +26,11 @@ matplotlib = "^3.9.2"
|
|||||||
numpy = "^2.1.1"
|
numpy = "^2.1.1"
|
||||||
pyqt6 = "^6.7.1"
|
pyqt6 = "^6.7.1"
|
||||||
tomli = "^2.0.1"
|
tomli = "^2.0.1"
|
||||||
|
tomlkit = "^0.13.2"
|
||||||
scipy = "^1.14.1"
|
scipy = "^1.14.1"
|
||||||
|
|
||||||
|
[tool.poetry.scripts]
|
||||||
|
pyrelacs = "pyrelacs.app:main"
|
||||||
|
|
||||||
[build-system]
|
[build-system]
|
||||||
requires = ["poetry-core"]
|
requires = ["poetry-core"]
|
||||||
|
@ -2,7 +2,7 @@ from PyQt6.QtGui import QAction
|
|||||||
import sys
|
import sys
|
||||||
import pathlib
|
import pathlib
|
||||||
|
|
||||||
from PyQt6.QtCore import QProcess, QSize, QThreadPool, Qt
|
from PyQt6.QtCore import QProcess, QSize, QThreadPool, Qt, QSettings
|
||||||
from PyQt6.QtWidgets import (
|
from PyQt6.QtWidgets import (
|
||||||
QApplication,
|
QApplication,
|
||||||
QGridLayout,
|
QGridLayout,
|
||||||
@ -17,6 +17,7 @@ from IPython import embed
|
|||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
from pyrelacs.util.logging import config_logging
|
from pyrelacs.util.logging import config_logging
|
||||||
|
import pyrelacs.info as info
|
||||||
from pyrelacs.worker import Worker
|
from pyrelacs.worker import Worker
|
||||||
from pyrelacs.repros.repros import Repro
|
from pyrelacs.repros.repros import Repro
|
||||||
|
|
||||||
@ -94,8 +95,35 @@ class PyRelacs(QMainWindow):
|
|||||||
self.text.appendPlainText(f"started Repro {n}, {fn}")
|
self.text.appendPlainText(f"started Repro {n}, {fn}")
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
def main():
|
||||||
app = QApplication(sys.argv)
|
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 = PyRelacs()
|
||||||
|
window.setMinimumWidth(200)
|
||||||
|
window.setMinimumHeight(200)
|
||||||
|
window.resize(width, height)
|
||||||
|
window.move(x, y)
|
||||||
window.show()
|
window.show()
|
||||||
app.exec()
|
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()
|
37
pyrelacs/info.py
Normal file
37
pyrelacs/info.py
Normal file
@ -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"]
|
Loading…
Reference in New Issue
Block a user