Bug fix: PyLoT displays warning message end terminates if no PyLoT-input file or autoPyLoT-output file is declared.

This commit is contained in:
Ludger Küperkoch 2017-04-10 09:50:53 +02:00
parent 35705f1f1d
commit 49a4cccc92

View File

@ -14,7 +14,7 @@ chosen for the particular data set.
Some icons are out of a free of charge icon set, which can be found here: Some icons are out of a free of charge icon set, which can be found here:
https://www.iconfinder.com/iconsets/flavour https://www.iconfinder.com/iconsets/flavour
:author: :authors:
Sebastian Wehling-Benatelli / Ludger Küperkoch Sebastian Wehling-Benatelli / Ludger Küperkoch
:copyright: :copyright:
The PyLoT Development Team (https://ariadne.geophysik.rub.de/trac/PyLoT) The PyLoT Development Team (https://ariadne.geophysik.rub.de/trac/PyLoT)
@ -42,7 +42,6 @@ from obspy import UTCDateTime
from pylot.core.analysis.magnitude import RichterMagnitude, MomentMagnitude from pylot.core.analysis.magnitude import RichterMagnitude, MomentMagnitude
from pylot.core.io.data import Data from pylot.core.io.data import Data
from pylot.core.io.inputs import FilterOptions, AutoPickParameter from pylot.core.io.inputs import FilterOptions, AutoPickParameter
#from pylot.core.pick.autopick import autopickevent
from autoPyLoT import autoPyLoT from autoPyLoT import autoPyLoT
from pylot.core.pick.compare import Comparison from pylot.core.pick.compare import Comparison
from pylot.core.pick.utils import symmetrize_error from pylot.core.pick.utils import symmetrize_error
@ -80,8 +79,11 @@ class MainWindow(QMainWindow):
# check for default pylot.in-file # check for default pylot.in-file
infile = os.path.join(os.path.expanduser('~'), '.pylot', 'pylot.in') infile = os.path.join(os.path.expanduser('~'), '.pylot', 'pylot.in')
if os.path.isfile(infile)== False: if os.path.isfile(infile)== False:
infile = QFileDialog().getOpenFileName(caption='Choose PyLoT-input file', infile = QFileDialog().getOpenFileName(caption='Choose PyLoT-input file')
filter='*.in') if not os.path.exists(infile[0]):
QMessageBox.warning(self, "PyLoT Warning",
"No PyLoT-input file declared!")
sys.exit(0)
self.infile = infile[0] self.infile = infile[0]
else: else:
self.infile = infile self.infile = infile
@ -844,6 +846,10 @@ class MainWindow(QMainWindow):
def autoPick(self): def autoPick(self):
self.autosave = QFileDialog().getExistingDirectory(caption='Select autoPyLoT output') self.autosave = QFileDialog().getExistingDirectory(caption='Select autoPyLoT output')
if not os.path.exists(self.autosave):
QMessageBox.warning(self, "PyLoT Warning",
"No autoPyLoT output declared!")
return
self.listWidget = QListWidget() self.listWidget = QListWidget()
self.setDirty(True) self.setDirty(True)
self.logDockWidget = QDockWidget("AutoPickLog", self) self.logDockWidget = QDockWidget("AutoPickLog", self)