2022-03-08 09:27:40 +00:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
|
|
|
|
import sys
|
2022-03-25 10:04:02 +00:00
|
|
|
import pathlib
|
2023-12-31 14:46:14 +00:00
|
|
|
import os
|
2022-11-08 19:07:16 +00:00
|
|
|
sys.path.append(str(pathlib.Path(__file__).absolute().parent.parent / 'src'))
|
2022-03-25 10:04:53 +00:00
|
|
|
|
2022-04-16 18:41:26 +00:00
|
|
|
from nmreval.configs import check_for_config
|
|
|
|
|
|
|
|
# does a directory for config stuff exist? create it if not
|
|
|
|
check_for_config()
|
|
|
|
|
2022-03-08 09:27:40 +00:00
|
|
|
# pyqtgraph warns on Mac if QApplication is created when it is imported
|
2022-03-25 10:04:02 +00:00
|
|
|
# import pyqtgraph
|
2022-03-08 09:27:40 +00:00
|
|
|
|
|
|
|
from nmreval.lib.logger import handle_exception
|
|
|
|
sys.excepthook = handle_exception
|
|
|
|
|
2022-10-20 15:23:15 +00:00
|
|
|
from gui_qt import App
|
2024-01-01 10:25:40 +00:00
|
|
|
from gui_qt.Qt import QtCore
|
2022-03-08 09:27:40 +00:00
|
|
|
|
2023-01-05 14:27:33 +00:00
|
|
|
app = App(['Team Rocket FTW!'])
|
|
|
|
|
|
|
|
from gui_qt.main.mainwindow import NMRMainWindow
|
2024-01-01 10:25:40 +00:00
|
|
|
from gui_qt.lib.backup import BackupManager
|
2023-12-31 14:46:14 +00:00
|
|
|
|
2024-01-01 11:08:17 +00:00
|
|
|
|
|
|
|
def do_autosave():
|
|
|
|
success = mplQt.autosave()
|
|
|
|
if success:
|
|
|
|
backuping.update_last_save()
|
|
|
|
|
|
|
|
|
2024-01-01 10:25:40 +00:00
|
|
|
backuping = BackupManager()
|
2023-12-31 14:46:14 +00:00
|
|
|
|
|
|
|
files = backuping.search_unsaved()
|
|
|
|
print(files)
|
2024-01-01 11:08:17 +00:00
|
|
|
print(sys.executable, sys.argv)
|
2023-12-31 14:46:14 +00:00
|
|
|
|
2024-01-01 11:08:17 +00:00
|
|
|
pid = os.getpid()
|
2023-12-31 14:46:14 +00:00
|
|
|
bck_name = backuping.create_entry(pid)
|
2024-01-01 10:25:40 +00:00
|
|
|
mplQt = NMRMainWindow(bck_file=bck_name)
|
|
|
|
|
2024-01-01 11:08:17 +00:00
|
|
|
do_autosave()
|
2024-01-01 10:25:40 +00:00
|
|
|
|
2024-01-01 11:08:17 +00:00
|
|
|
timer = QtCore.QTimer()
|
|
|
|
timer.timeout.connect(do_autosave)
|
2024-01-01 10:25:40 +00:00
|
|
|
timer.start(3 * 1000)
|
2023-12-31 14:46:14 +00:00
|
|
|
|
|
|
|
app.aboutToQuit.connect(backuping.close)
|
2022-03-08 09:27:40 +00:00
|
|
|
|
|
|
|
mplQt.show()
|
|
|
|
|
|
|
|
sys.exit(app.exec())
|