1
0
forked from IPKM/nmreval

do not overwrite old backup until new backup is done

This commit is contained in:
Dominik Demuth
2023-11-09 17:05:17 +01:00
parent 5ea1ed6d0a
commit 070509c691
2 changed files with 12 additions and 4 deletions

View File

@ -1095,7 +1095,10 @@ class NMRMainWindow(QtWidgets.QMainWindow, Ui_BaseWindow):
def _autosave(self):
# TODO better separate thread may it takes some time to save
self.status.setText('Autosave...')
NMRWriter(self.management.graphs, self.management.data).export(self.__backup_path)
success = NMRWriter(self.management.graphs, self.management.data).export(self.__backup_path.with_suffix('.nmr.0'))
if success:
self.__backup_path.with_suffix('.nmr.0').rename(self.__backup_path)
self.status.setText('')
def check_for_backup(self):