[fixes #194] automatic filtering works also when switching phase selection

Switching the phase selection without picking the last onset did not filter according to the selected phase filter parameter. With this revision a displaying bug showing muliple '( filtered, filtered, filtered)' statements due to switching the phases is fixed as well.
This commit is contained in:
Sebastian Wehling-Benatelli 2016-03-30 09:12:56 +02:00
parent d7cfd0d176
commit 7a712ca37c

View File

@ -5,6 +5,7 @@ Created on Wed Mar 19 11:27:35 2014
@author: sebastianw @author: sebastianw
""" """
import warnings
import datetime import datetime
import numpy as np import numpy as np
@ -348,6 +349,10 @@ class PickDlg(QDialog):
return widget.mpl_connect('button_release_event', slot) return widget.mpl_connect('button_release_event', slot)
def verifyPhaseSelection(self): def verifyPhaseSelection(self):
if self.pick_block:
self.pick_block = self.togglePickBlocker()
warnings.warn('Changed selection before phase was set!',
UserWarning)
phase = self.selectPhase.currentText() phase = self.selectPhase.currentText()
self.updateCurrentLimits() self.updateCurrentLimits()
if phase: if phase:
@ -731,13 +736,15 @@ class PickDlg(QDialog):
filtoptions = filtoptions.parseFilterOptions() filtoptions = filtoptions.parseFilterOptions()
if filtoptions is not None: if filtoptions is not None:
data.filter(**filtoptions) data.filter(**filtoptions)
if old_title.endswith(')'): if not old_title.endswith(')'):
title = old_title[:-1] + ', filtered)'
else:
title = old_title + ' (filtered)' title = old_title + ' (filtered)'
elif not old_title.endswith(' (filtered)') and not old_title.endswith(', filtered)'):
title = old_title[:-1] + ', filtered)'
else: else:
if old_title.endswith(' (filtered)'): if old_title.endswith(' (filtered)'):
title = old_title.replace(' (filtered)', '') title = old_title.replace(' (filtered)', '')
elif old_title.endswith(', filtered)'):
title = old_title.replace(', filtered)', ')')
if title is None: if title is None:
title = old_title title = old_title
self.getPlotWidget().plotWFData(wfdata=data, title=title, self.getPlotWidget().plotWFData(wfdata=data, title=title,