[Change] Save picks in cnv-, xml, and obs-format simultaneously. cnv not working!

This commit is contained in:
Ludger Küperkoch 2017-07-12 15:24:55 +02:00
parent 351d473cbf
commit 76a99005ec
2 changed files with 28 additions and 20 deletions

View File

@ -1050,18 +1050,18 @@ class MainWindow(QMainWindow):
filename = 'PyLoT_'+eventname filename = 'PyLoT_'+eventname
outpath = os.path.join(directory, filename) outpath = os.path.join(directory, filename)
title = 'Save pick data ...' title = 'Save pick data ...'
if not outformat: #if not outformat:
outformat = settings.value('output/Format') # outformat = settings.value('output/Format')
outformat = outformat[0:4] # outformat = outformat[0:4]
else: #else:
selected_filter = "NonLinLoc observation file (*.obs)" # selected_filter = "NonLinLoc observation file (*.obs)"
fname = outpath # fname = outpath
if outformat == '.obs': #if outformat == '.obs':
file_filter = "NonLinLoc observation file (*.obs)" # file_filter = "NonLinLoc observation file (*.obs)"
elif outformat == '.cnv': #elif outformat == '.cnv':
file_filter = "VELEST observation file format (*.cnv)" # file_filter = "VELEST observation file format (*.cnv)"
elif outformat == '.xml': #elif outformat == '.xml':
file_filter = "QuakeML file (*.xml)" file_filter = "(*.xml *.obs *.cnv)"
if dlgflag == 1: if dlgflag == 1:
fname, selected_filter = QFileDialog.getSaveFileName(self, fname, selected_filter = QFileDialog.getSaveFileName(self,
@ -1069,11 +1069,15 @@ class MainWindow(QMainWindow):
outpath, outpath,
file_filter) file_filter)
fbasename, exform = os.path.splitext(fname) #fbasename, exform = os.path.splitext(fname)
fbasename = fname
if not exform and selected_filter or not exform in OUTPUTFORMATS: exform = ['.obs', '.xml', '.cnv']
exform = selected_filter.split('*')[1][:-1] print(fname)
return fname, exform print(fbasename)
print(exform)
#if not exform and selected_filter or not exform in OUTPUTFORMATS:
# exform = selected_filter.split('*')[1][:-1]
# return fname, exform
return fbasename, exform return fbasename, exform
settings = QSettings() settings = QSettings()
@ -1123,9 +1127,13 @@ class MainWindow(QMainWindow):
# return False # return False
# export to given path # export to given path
self.get_data().exportEvent(fbasename, exform, upperErrors=[uppererrorP[3], uppererrorS[3]]) #self.get_data().exportEvent(fbasename, exform, upperErrors=[uppererrorP[3], uppererrorS[3]])
self.get_data().exportEvent(fbasename, exform[0], upperErrors=[uppererrorP[3], uppererrorS[3]])
self.get_data().exportEvent(fbasename, exform[1], upperErrors=[uppererrorP[3], uppererrorS[3]])
#self.get_data().exportEvent(fbasename, exform[2], upperErrors=[uppererrorP[3], uppererrorS[3]])
# all files save (ui clean) # all files save (ui clean)
self.update_status('Picks saved as %s' % (fbasename + exform)) self.update_status('Picks saved as %s, %s, and %s' % (fbasename + exform[0], fbasename + exform[1],
fbasename + exform[2]))
self.disableSaveManualPicksAction() self.disableSaveManualPicksAction()
return True return True

View File

@ -2575,7 +2575,7 @@ class PropertiesDlg(QDialog):
self.setWindowTitle("PyLoT Properties") self.setWindowTitle("PyLoT Properties")
self.tabWidget = QTabWidget() self.tabWidget = QTabWidget()
self.tabWidget.addTab(InputsTab(self), "Inputs") self.tabWidget.addTab(InputsTab(self), "Inputs")
self.tabWidget.addTab(OutputsTab(self), "Outputs") #self.tabWidget.addTab(OutputsTab(self), "Outputs")
self.tabWidget.addTab(PhasesTab(self), "Phases") self.tabWidget.addTab(PhasesTab(self), "Phases")
self.tabWidget.addTab(GraphicsTab(self), "Graphics") self.tabWidget.addTab(GraphicsTab(self), "Graphics")
#self.tabWidget.addTab(LocalisationTab(self), "Loc. Tools") #self.tabWidget.addTab(LocalisationTab(self), "Loc. Tools")