[update] autopick -> only export necessary XML (WIP)

This commit is contained in:
Marcel Paffrath 2018-07-17 10:53:37 +02:00
parent fbc01290d5
commit dda997e457
2 changed files with 9 additions and 6 deletions

View File

@ -1433,8 +1433,11 @@ class MainWindow(QMainWindow):
return True return True
def exportAllEvents(self, outformats=['.xml']): def exportEvents(self, outformats=['.xml'], events='all'):
for event in self.project.eventlist: if events == 'all':
events = self.project.eventlist
assert type(events) == list, 'Wrong input type: {}'.format(type(events))
for event in events:
self.get_data().setEvtData(event) self.get_data().setEvtData(event)
try: try:
self.saveData(event, event.path, outformats) self.saveData(event, event.path, outformats)
@ -2495,7 +2498,7 @@ class MainWindow(QMainWindow):
self.apw.enable(False) self.apw.enable(False)
# export current picks etc. # export current picks etc.
self.exportAllEvents(['.xml']) self.exportEvents(['.xml'], events=events)
wfpath = self.dataPlot.qcombo_processed.currentText() if self.obspy_dmt else '' wfpath = self.dataPlot.qcombo_processed.currentText() if self.obspy_dmt else ''
# define arguments for picker # define arguments for picker
@ -3298,7 +3301,7 @@ class MainWindow(QMainWindow):
self.project.save(filename) self.project.save(filename)
self.setDirty(False) self.setDirty(False)
self.saveProjectAsAction.setEnabled(True) self.saveProjectAsAction.setEnabled(True)
self.exportAllEvents() self.exportEvents()
self.update_status('Saved new project to {}'.format(filename), duration=5000) self.update_status('Saved new project to {}'.format(filename), duration=5000)
return True return True
@ -3314,7 +3317,7 @@ class MainWindow(QMainWindow):
else: else:
self.project.parameter = self._inputs self.project.parameter = self._inputs
self.project.save() self.project.save()
self.exportAllEvents() self.exportEvents()
if not self.project.dirty: if not self.project.dirty:
self.update_status('Saved back project to file:\n{}'.format(self.project.location), duration=5000) self.update_status('Saved back project to file:\n{}'.format(self.project.location), duration=5000)
self.setDirty(False) self.setDirty(False)

View File

@ -4003,7 +4003,7 @@ class AutoPickDlg(QDialog):
self.gb.setLayout(self.jobLayout) self.gb.setLayout(self.jobLayout)
def exportParameter(self): def exportParameter(self):
self.parent().exportAllEvents() self.parent().exportEvents()
pylot_params = self.parent()._inputs pylot_params = self.parent()._inputs
self.addEvents2pp(pylot_params) self.addEvents2pp(pylot_params)
pylot_params.export2File(self.pp_export) pylot_params.export2File(self.pp_export)