[edit] exit if no waveform files are selected

PyLoT will only start if waveformfiles are selected
This commit is contained in:
Sebastian Wehling-Benatelli 2016-03-22 10:49:06 +01:00
parent 7225da87db
commit cad6ed2274
2 changed files with 15 additions and 5 deletions

View File

@ -110,8 +110,10 @@ class MainWindow(QMainWindow):
# load and display waveform data # load and display waveform data
self.dirty = False self.dirty = False
self.loadData() self.loadData()
self.loadWaveformData() if self.loadWaveformData():
self.updateFilterOptions() self.updateFilterOptions()
else:
sys.exit(0)
def setupUi(self): def setupUi(self):
@ -403,6 +405,8 @@ class MainWindow(QMainWindow):
else: else:
raise DatastructureError('not specified') raise DatastructureError('not specified')
if not self.fnames:
return None
return self.fnames return self.fnames
except DatastructureError as e: except DatastructureError as e:
print(e) print(e)
@ -525,10 +529,13 @@ class MainWindow(QMainWindow):
def loadWaveformData(self): def loadWaveformData(self):
if self.fnames and self.okToContinue(): if self.fnames and self.okToContinue():
self.setDirty(True) self.setDirty(True)
self.data.setWFData(self.fnames) ans = self.data.setWFData(self.fnames)
elif self.fnames is None and self.okToContinue(): elif self.fnames is None and self.okToContinue():
self.data.setWFData(self.getWFFnames()) ans = self.data.setWFData(self.getWFFnames())
if ans:
self.plotWaveformData() self.plotWaveformData()
else:
return ans
def plotWaveformData(self): def plotWaveformData(self):
zne_text = {'Z': 'vertical', 'N': 'north-south', 'E': 'east-west'} zne_text = {'Z': 'vertical', 'N': 'north-south', 'E': 'east-west'}

View File

@ -186,8 +186,11 @@ class Data(object):
self.wforiginal = None self.wforiginal = None
if fnames is not None: if fnames is not None:
self.appendWFData(fnames) self.appendWFData(fnames)
else:
return False
self.wforiginal = self.getWFData().copy() self.wforiginal = self.getWFData().copy()
self.dirty = False self.dirty = False
return True
def appendWFData(self, fnames): def appendWFData(self, fnames):
""" """