diff --git a/QtPyLoT.py b/QtPyLoT.py index 254e88f7..d14c51a0 100755 --- a/QtPyLoT.py +++ b/QtPyLoT.py @@ -405,13 +405,16 @@ class MainWindow(QMainWindow): except OverwriteError: msgBox = QMessageBox() msgBox.setText("Picks have been modified!") - msgBox.setInformativeText("Do you want to overwrite the picks and save?") - msgBox.setStandardButtons(QMessageBox.Save | QMessageBox.Discard | - QMessageBox.Cancel) + msgBox.setInformativeText("Do you want to save the changes and overwrite the picks?") + msgBox.setDetailedText(self.getData().getPicksStr()) + msgBox.setStandardButtons(QMessageBox.Save | QMessageBox.Cancel) msgBox.setDefaultButton(QMessageBox.Save) ret = msgBox.exec_() if ret == QMessageBox.Save: - print('Overwrite and Save') + self.getData().resetPicks() + self.saveData() + elif ret == QMessageBox.Cancel: + return False try: self.getData().exportEvent(self.fname, exform) except FormatError: @@ -425,6 +428,8 @@ class MainWindow(QMainWindow): fbasename, exform = os.path.splitext(fname[0]) if not fbasename: return False + elif not exform: + exform = fname[1].split('*')[1][:-1] self.getData().exportEvent(fbasename, exform) return True diff --git a/pylot/RELEASE-VERSION b/pylot/RELEASE-VERSION index 52c00f77..541bd94d 100644 --- a/pylot/RELEASE-VERSION +++ b/pylot/RELEASE-VERSION @@ -1 +1 @@ -1abc-dirty +497c-dirty diff --git a/pylot/core/read/data.py b/pylot/core/read/data.py index f3e07d30..3c83e9aa 100644 --- a/pylot/core/read/data.py +++ b/pylot/core/read/data.py @@ -52,6 +52,13 @@ class Data(object): def __str__(self): return str(self.wfdata) + def getPicksStr(self): + picks_str = '' + for pick in self.getEvtData().picks: + picks_str += str(pick) + '\n' + return picks_str + + def getParent(self): """ @@ -360,9 +367,11 @@ class Data(object): def applyPicks(picks): """ - + Creates ObsPy pick objects and append it to the picks list from the + PyLoT dictionary contain all picks. :param picks: - :raise OverwriteError: + :raise OverwriteError: raises an OverwriteError if the picks list is + not empty. The GUI will then ask for a decision. """ firstonset = None if self.getEvtData().picks: