[closes #209] spacebar can now be used to accept pickDlg, also added a checkbox to automatically open next station (experimental)

This commit is contained in:
Marcel Paffrath 2017-06-21 15:20:36 +02:00
parent b0dcf5ff4b
commit 6feffaeadb
3 changed files with 32 additions and 19 deletions

View File

@ -172,7 +172,6 @@ class MainWindow(QMainWindow):
self.setupUi()
self.filteroptions = {}
self.pickDlgs = {}
self.picks = {}
self.autopicks = {}
self.loc = False
@ -1565,7 +1564,9 @@ class MainWindow(QMainWindow):
wfID = self.getWFID(ycoord)
if wfID is None: return
self.pickDialog(wfID)
def pickDialog(self, wfID, nextStation=False):
station = self.getStationName(wfID)
if not station:
return
@ -1576,21 +1577,23 @@ class MainWindow(QMainWindow):
station=station,
picks=self.getPicksOnStation(station, 'manual'),
autopicks=self.getPicksOnStation(station, 'auto'))
pickDlg.nextStation.setChecked(nextStation)
if pickDlg.exec_():
if not pickDlg.getPicks():
return
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())
self.enableSaveManualPicksAction()
if replot:
self.plotWaveformDataThread()
self.drawPicks()
self.draw()
else:
self.drawPicks(station)
self.draw()
if pickDlg.getPicks():
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())
self.enableSaveManualPicksAction()
if replot:
self.plotWaveformDataThread()
self.drawPicks()
self.draw()
else:
self.drawPicks(station)
self.draw()
if pickDlg.nextStation.isChecked():
self.pickDialog(wfID - 1, nextStation=pickDlg.nextStation.isChecked())
else:
self.update_status('picks discarded ({0})'.format(station))
if not self.get_loc_flag() and self.check4Loc():

View File

@ -1 +1 @@
d77a-dirty
b0dc-dirty

View File

@ -752,6 +752,7 @@ class PickDlg(QDialog):
self._init_autopicks = {}
self.filteroptions = FILTERDEFAULTS
self.pick_block = False
self.nextStation = QtGui.QCheckBox('Continue with next station.')
# initialize panning attributes
self.press = None
@ -876,7 +877,9 @@ class PickDlg(QDialog):
_dialtoolbar.addAction(self.resetPicksAction)
if self._embedded:
_dialtoolbar.addWidget(self.accept_button)
_dialtoolbar.addWidget(self.reject_button)
_dialtoolbar.addWidget(self.reject_button)
else:
_dialtoolbar.addWidget(self.nextStation)
# layout the innermost widget
_innerlayout = QVBoxLayout()
@ -1728,7 +1731,6 @@ class TuneAutopicker(QWidget):
pickDlg.update_picks.connect(self.picks_from_pickdlg)
pickDlg.update_picks.connect(self.fill_eventbox)
pickDlg.update_picks.connect(self.fill_stationbox)
pickDlg.update_picks.connect(self.parent.drawPicks)
pickDlg.update_picks.connect(lambda: self.parent.setDirty(True))
pickDlg.update_picks.connect(self.parent.enableSaveManualPicksAction)
self.pickDlg = QtGui.QWidget()
@ -1738,7 +1740,15 @@ class TuneAutopicker(QWidget):
def picks_from_pickdlg(self, picks=None):
station = self.get_current_station()
replot = self.parent.addPicks(station, picks)
self.get_current_event().setPick(station, picks)
if self.get_current_event() == self.parent.get_current_event():
if replot:
self.parent.plotWaveformDataThread()
self.parent.drawPicks()
else:
self.parent.drawPicks(station)
self.parent.draw()
def plot_manual_picks_to_figs(self):
picks = self.get_current_event_picks(self.get_current_station())