[change] code cleanup on setPicks from pickDlg
This commit is contained in:
parent
c7e4cd0c8b
commit
3c7b9eb8ea
16
QtPyLoT.py
16
QtPyLoT.py
@ -1751,10 +1751,10 @@ class MainWindow(QMainWindow):
|
|||||||
if pickDlg._dirty:
|
if pickDlg._dirty:
|
||||||
self.setDirty(True)
|
self.setDirty(True)
|
||||||
self.update_status('picks accepted ({0})'.format(station))
|
self.update_status('picks accepted ({0})'.format(station))
|
||||||
replot = self.addPicks(station, pickDlg.getPicks())
|
replot1 = self.addPicks(station, pickDlg.getPicks(picktype='manual'), type='manual')
|
||||||
self.get_current_event().setPick(station, pickDlg.getPicks())
|
replot2 = self.addPicks(station, pickDlg.getPicks(picktype='auto'), type='auto')
|
||||||
self.enableSaveEventAction()
|
self.enableSaveEventAction()
|
||||||
if replot:
|
if replot1 or replot2:
|
||||||
self.plotWaveformDataThread()
|
self.plotWaveformDataThread()
|
||||||
self.drawPicks()
|
self.drawPicks()
|
||||||
self.draw()
|
self.draw()
|
||||||
@ -1877,12 +1877,16 @@ class MainWindow(QMainWindow):
|
|||||||
|
|
||||||
def addPicks(self, station, picks, type='manual'):
|
def addPicks(self, station, picks, type='manual'):
|
||||||
stat_picks = self.getPicksOnStation(station, type)
|
stat_picks = self.getPicksOnStation(station, type)
|
||||||
if not stat_picks and picks:
|
if not stat_picks:
|
||||||
rval = False
|
rval = False
|
||||||
else:
|
else:
|
||||||
rval = True
|
rval = True
|
||||||
# set picks (ugly syntax?)
|
event = self.get_current_event()
|
||||||
self.getPicks(type=type)[station] = picks
|
# create dictionary switch
|
||||||
|
automanu = {'manual': event.setPick,
|
||||||
|
'auto': event.setAutopick}
|
||||||
|
# dictionary consisting of set station only
|
||||||
|
automanu[type](station=station, pick=picks)
|
||||||
return rval
|
return rval
|
||||||
# if not stat_picks:
|
# if not stat_picks:
|
||||||
# stat_picks = picks
|
# stat_picks = picks
|
||||||
|
Loading…
Reference in New Issue
Block a user