added some buttons for setting current event to ref/test, made ref/test color settings 'global', some fixes

This commit is contained in:
2017-05-19 10:56:27 +02:00
parent cf971d6a87
commit e911262c3e
4 changed files with 120 additions and 41 deletions

View File

@@ -1 +1 @@
1143-dirty
cf971-dirty

View File

@@ -48,31 +48,33 @@ class map_projection(QtGui.QWidget):
pickDlg = PickDlg(self, parameter=self._parent._inputs,
data=data.select(station=station),
station=station,
picks=self._parent.getCurrentEvent().getPick(station),
autopicks=self._parent.getCurrentEvent().getAutopick(station))
picks=self._parent.get_current_event().getPick(station),
autopicks=self._parent.get_current_event().getAutopick(station))
except Exception as e:
message = 'Could not generate Plot for station {st}.\n{er}'.format(st=station, er=e)
self._warn(message)
print(message, e)
return
pyl_mw = self._parent
#try:
if pickDlg.exec_():
pyl_mw.setDirty(True)
pyl_mw.update_status('picks accepted ({0})'.format(station))
replot = pyl_mw.getCurrentEvent().setPick(station, pickDlg.getPicks())
if replot:
pyl_mw.plotWaveformData()
pyl_mw.drawPicks()
pyl_mw.draw()
try:
if pickDlg.exec_():
pyl_mw.setDirty(True)
pyl_mw.update_status('picks accepted ({0})'.format(station))
replot = pyl_mw.get_current_event().setPick(station, pickDlg.getPicks())
self._refresh_drawings()
if replot:
pyl_mw.plotWaveformData()
pyl_mw.drawPicks()
pyl_mw.draw()
else:
pyl_mw.drawPicks(station)
pyl_mw.draw()
else:
pyl_mw.drawPicks(station)
pyl_mw.draw()
else:
pyl_mw.update_status('picks discarded ({0})'.format(station))
# except Exception as e:
# message = 'Could not save picks for station {st}.\n{er}'.format(st=station, er=e)
# self._warn(message)
# print(message, e)
pyl_mw.update_status('picks discarded ({0})'.format(station))
except Exception as e:
message = 'Could not save picks for station {st}.\n{er}'.format(st=station, er=e)
self._warn(message)
print(message, e)
def connectSignals(self):
self.comboBox_phase.currentIndexChanged.connect(self._refresh_drawings)

View File

@@ -765,7 +765,14 @@ class PickDlg(QDialog):
self.currentPhase = 'S'
def set_button_color(self, button, color = None):
button.setStyleSheet("background-color: {}".format(color))
if type(color) == QtGui.QColor:
palette = button.palette()
role = button.backgroundRole()
palette.setColor(role, color)
button.setPalette(palette)
button.setAutoFillBackground(True)
elif type(color) == str or not color:
button.setStyleSheet("background-color: {}".format(color))
def leave_picking_mode(self):
self.currentPhase = None
@@ -1396,7 +1403,7 @@ class TuneAutopicker(QWidget):
for station in stations:
item = QtGui.QStandardItem(str(station))
if station in self.get_current_event().picks:
item.setBackground(QtGui.QColor(200, 210, 230, 255))
item.setBackground(self.parent._colors['ref'])
model.appendRow(item)
def init_figure_tabs(self):
@@ -1525,11 +1532,11 @@ class TuneAutopicker(QWidget):
y_top = 0.9*ax.get_ylim()[1]
y_bot = 0.9*ax.get_ylim()[0]
ax.vlines(pick, y_bot, y_top,
color='cyan', linewidth=2, label='manual P Onset')
color='teal', linewidth=2, label='manual P Onset')
ax.plot([pick-0.5, pick+0.5],
[y_bot, y_bot], linewidth=2, color='cyan')
[y_bot, y_bot], linewidth=2, color='teal')
ax.plot([pick-0.5, pick+0.5],
[y_top, y_top], linewidth=2, color='cyan')
[y_top, y_top], linewidth=2, color='teal')
ax.legend()
def plot_manual_Spick_to_ax(self, ax, pick):