nmreval/bin/evaluate.py
Dominik Demuth c55a983b54 more work
2024-01-01 12:08:17 +01:00

55 lines
1.1 KiB
Python
Executable File

#!/usr/bin/env python3
import sys
import pathlib
import os
sys.path.append(str(pathlib.Path(__file__).absolute().parent.parent / 'src'))
from nmreval.configs import check_for_config
# does a directory for config stuff exist? create it if not
check_for_config()
# pyqtgraph warns on Mac if QApplication is created when it is imported
# import pyqtgraph
from nmreval.lib.logger import handle_exception
sys.excepthook = handle_exception
from gui_qt import App
from gui_qt.Qt import QtCore
app = App(['Team Rocket FTW!'])
from gui_qt.main.mainwindow import NMRMainWindow
from gui_qt.lib.backup import BackupManager
def do_autosave():
success = mplQt.autosave()
if success:
backuping.update_last_save()
backuping = BackupManager()
files = backuping.search_unsaved()
print(files)
print(sys.executable, sys.argv)
pid = os.getpid()
bck_name = backuping.create_entry(pid)
mplQt = NMRMainWindow(bck_file=bck_name)
do_autosave()
timer = QtCore.QTimer()
timer.timeout.connect(do_autosave)
timer.start(3 * 1000)
app.aboutToQuit.connect(backuping.close)
mplQt.show()
sys.exit(app.exec())