From 3c7b9eb8ea7b627aef368b759db71c3d5cb7ddce Mon Sep 17 00:00:00 2001 From: marcel Date: Tue, 15 Aug 2017 14:54:13 +0200 Subject: [PATCH 1/2] [change] code cleanup on setPicks from pickDlg --- QtPyLoT.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/QtPyLoT.py b/QtPyLoT.py index 19302281..6c35ea12 100755 --- a/QtPyLoT.py +++ b/QtPyLoT.py @@ -1751,10 +1751,10 @@ class MainWindow(QMainWindow): if pickDlg._dirty: self.setDirty(True) self.update_status('picks accepted ({0})'.format(station)) - replot = self.addPicks(station, pickDlg.getPicks()) - self.get_current_event().setPick(station, pickDlg.getPicks()) + replot1 = self.addPicks(station, pickDlg.getPicks(picktype='manual'), type='manual') + replot2 = self.addPicks(station, pickDlg.getPicks(picktype='auto'), type='auto') self.enableSaveEventAction() - if replot: + if replot1 or replot2: self.plotWaveformDataThread() self.drawPicks() self.draw() @@ -1877,12 +1877,16 @@ class MainWindow(QMainWindow): def addPicks(self, station, picks, type='manual'): stat_picks = self.getPicksOnStation(station, type) - if not stat_picks and picks: + if not stat_picks: rval = False else: rval = True - # set picks (ugly syntax?) - self.getPicks(type=type)[station] = picks + event = self.get_current_event() + # create dictionary switch + automanu = {'manual': event.setPick, + 'auto': event.setAutopick} + # dictionary consisting of set station only + automanu[type](station=station, pick=picks) return rval # if not stat_picks: # stat_picks = picks From 90dae62922fde62a5e6a5c6d848d369034d7c2ef Mon Sep 17 00:00:00 2001 From: marcel Date: Tue, 15 Aug 2017 15:02:45 +0200 Subject: [PATCH 2/2] [bugfix] pickDlg manipulate pick copy, rba error --- pylot/core/util/widgets.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pylot/core/util/widgets.py b/pylot/core/util/widgets.py index 7162c874..e7aa8c3d 100644 --- a/pylot/core/util/widgets.py +++ b/pylot/core/util/widgets.py @@ -837,14 +837,14 @@ class PickDlg(QDialog): self._user = settings.value('user/Login', pylot_user) self._dirty = False if picks: - self.picks = picks - self._init_picks = copy.deepcopy(picks) + self.picks = copy.deepcopy(picks) + self._init_picks = picks else: self.picks = {} self._init_picks = {} if autopicks: - self.autopicks = autopicks - self._init_autopicks = copy.deepcopy(autopicks) + self.autopicks = copy.deepcopy(autopicks) + self._init_autopicks = autopicks else: self.autopicks = {} self._init_autopicks = {} @@ -1734,11 +1734,11 @@ class PickDlg(QDialog): if spe: ax.fill_between([mpp-spe, mpp+spe], ylims[0], ylims[1], alpha=.25, color=color, label='{}-SPE'.format(phase)) - if epp: + if picks['epp']: linestyle_epp, width_epp = pick_linestyle_plt(picktype, 'epp') ax.plot([epp, epp], ylims, color=color, linestyle=linestyle_epp, linewidth=width_epp, label='{}-EPP'.format(phase)) - if lpp: + if picks['lpp']: linestyle_lpp, width_lpp = pick_linestyle_plt(picktype, 'lpp') ax.plot([lpp, lpp], ylims, color=color, linestyle=linestyle_lpp, linewidth=width_lpp, label='{}-LPP'.format(phase))