[bugfix] filter settings will be retained when leaving picking mode etc

This commit is contained in:
Marcel Paffrath 2018-01-10 16:00:34 +01:00
parent a76dd06497
commit 8d6de02afe
2 changed files with 16 additions and 19 deletions

View File

@ -1 +1 @@
7c61-dirty a76d-dirty

View File

@ -1647,7 +1647,7 @@ class PickDlg(QDialog):
self.currentPhase = None self.currentPhase = None
self.reset_p_button() self.reset_p_button()
self.reset_s_button() self.reset_s_button()
self.resetPlot() self.refreshPlot()
self.deactivatePicking() self.deactivatePicking()
def activatePicking(self): def activatePicking(self):
@ -1773,7 +1773,7 @@ class PickDlg(QDialog):
def delPicks(self): def delPicks(self):
self.resetPicks() self.resetPicks()
self.resetPlot() self.refreshPlot()
def setIniPick(self, gui_event): def setIniPick(self, gui_event):
self.multicompfig.set_frame_color('green') self.multicompfig.set_frame_color('green')
@ -1884,7 +1884,7 @@ class PickDlg(QDialog):
if filteroptions: if filteroptions:
try: try:
data.filter(**filteroptions) data.filter(**filteroptions)
wfdata.filter(**filteroptions) #wfdata.filter(**filteroptions) MP MP as above
except ValueError as e: except ValueError as e:
self.qmb = QtGui.QMessageBox(QtGui.QMessageBox.Icon.Information, self.qmb = QtGui.QMessageBox(QtGui.QMessageBox.Icon.Information,
'Denied', 'setIniPickS: Could not filter waveform: {}'.format(e)) 'Denied', 'setIniPickS: Could not filter waveform: {}'.format(e))
@ -2110,7 +2110,7 @@ class PickDlg(QDialog):
return return
x = event.mouseevent.xdata x = event.mouseevent.xdata
self.remove_pick_by_x(x) self.remove_pick_by_x(x)
self.resetPlot() self.refreshPlot()
def remove_pick_by_x(self, x): def remove_pick_by_x(self, x):
if not self.picks and not self.autopicks: if not self.picks and not self.autopicks:
@ -2193,12 +2193,11 @@ class PickDlg(QDialog):
data.detrend('linear') data.detrend('linear')
data.taper(0.02, type='cosine') data.taper(0.02, type='cosine')
data.filter(**filtoptions) data.filter(**filtoptions)
title += '({} filtered - '.format(filtoptions['type']) title += ' | {} filtered |'.format(filtoptions['type'])
for key, value in filtoptions.items(): for key, value in filtoptions.items():
if key == 'type': if key == 'type':
continue continue
title += ' {}: {},'.format(key, value) title += ' {}: {} |'.format(key, value)
title += ')'
self.multicompfig.plotWFData(wfdata=data, title=title, self.multicompfig.plotWFData(wfdata=data, title=title,
zoomx=self.getXLims(), zoomx=self.getXLims(),
zoomy=self.getYLims()) zoomy=self.getYLims())
@ -2211,33 +2210,31 @@ class PickDlg(QDialog):
if self.filterActionP.isChecked(): if self.filterActionP.isChecked():
self.filterWFData('P') self.filterWFData('P')
else: else:
self.resetPlot() self.refreshPlot()
def filterS(self): def filterS(self):
self.filterActionP.setChecked(False) self.filterActionP.setChecked(False)
if self.filterActionS.isChecked(): if self.filterActionS.isChecked():
self.filterWFData('S') self.filterWFData('S')
else: else:
self.resetPlot() self.refreshPlot()
def toggleAutoFilter(self): def toggleAutoFilter(self):
settings = QSettings() settings = QSettings()
settings.setValue('autoFilter', self.autoFilterAction.isChecked()) settings.setValue('autoFilter', self.autoFilterAction.isChecked())
def resetPlot(self): def resetPlot(self):
self.resetZoom()
self.refreshPlot()
def refreshPlot(self):
if self.autoFilterAction.isChecked(): if self.autoFilterAction.isChecked():
self.filterActionP.setChecked(False) self.filterActionP.setChecked(False)
self.filterActionS.setChecked(False) self.filterActionS.setChecked(False)
self.resetZoom()
data = self.getWFData().copy() data = self.getWFData().copy()
#title = self.multicompfig.axes[0].get_title()
title = self.getStation() title = self.getStation()
self.multicompfig.plotWFData(wfdata=data, title=title, filter = self.filterActionP.isChecked or self.filterActionS.isChecked()
zoomx=self.getXLims(), self.plotWFData(filter=filter)
zoomy=self.getYLims())
self.setPlotLabels()
self.drawAllPicks()
self.draw()
def resetZoom(self): def resetZoom(self):
ax = self.multicompfig.axes[0] ax = self.multicompfig.axes[0]
@ -2290,7 +2287,7 @@ class PickDlg(QDialog):
if not self._embedded: if not self._embedded:
QDialog.reject(self) QDialog.reject(self)
else: else:
self.resetPlot() self.refreshPlot()
self.qmb = QtGui.QMessageBox(QtGui.QMessageBox.Icon.Information, self.qmb = QtGui.QMessageBox(QtGui.QMessageBox.Icon.Information,
'Denied', 'New picks rejected!') 'Denied', 'New picks rejected!')
self.qmb.show() self.qmb.show()