method getWFFnames implemented returning the file names of the waveform data files given in a particular data structure case as well as setting the attribute pointing to the same information; method openWaveformData implemented in order to read waveform data into the Data object

This commit is contained in:
Sebastian Wehling-Benatelli 2015-01-29 08:48:25 +01:00
parent 8eb69822b1
commit f5eda74730

View File

@ -267,16 +267,28 @@ class MainWindow(QMainWindow):
evt = self.getData().getEvtData() evt = self.getData().getEvtData()
if evt.picks: if evt.picks:
for pick in evt.picks: for pick in evt.picks:
if pick.waveform_id is not None: try:
fname = pick.waveform_id.getSEEDstring() if pick.waveform_id is not None:
if fname not in self.fnames: fname = pick.waveform_id.getSEEDstring()
self.fnames.append(fname) if fname not in self.fnames:
self.fnames.append(fname)
except:
continue
else: else:
if self.dataStructure: if self.dataStructure:
searchPath = self.dataStructure.expandDataPath() searchPath = self.dataStructure.expandDataPath()
except: self.fnames = QFileDialog.getOpenFileNames(self,
return None "Select waveform files:",
dir=searchPath)
else:
raise ValueError('dataStructure not specified')
return self.fnames
except ValueError:
props = PropertiesDlg(self)
if props.exec_() == QDialog.Accepted:
return self.getWFFnames()
else:
return
def saveData(self): def saveData(self):
settings = QSettings() settings = QSettings()
@ -308,6 +320,13 @@ class MainWindow(QMainWindow):
return self.saveData() return self.saveData()
return True return True
def openWaveformData(self):
if self.fnames and self.okToContinue():
self.dirty = True
self.data.wfdata = self.data.setWFData(self.fnames)
elif self.fnames is None and self.okToContinue():
self.data.setWFData(self.getWFFnames())
def plotData(self): def plotData(self):
self.getData().plotData(self.getDataWidget()) self.getData().plotData(self.getDataWidget())