[add] lineEdit showing if using processed/raw data

This commit is contained in:
Marcel Paffrath 2018-04-23 17:00:09 +02:00
parent e6648a3cec
commit d3de33a12b
3 changed files with 44 additions and 13 deletions

View File

@ -1667,6 +1667,21 @@ class MainWindow(QMainWindow):
metadata=self.metadata, metadata=self.metadata,
obspy_dmt=obspy_dmt) obspy_dmt=obspy_dmt)
def setWFstatus(self):
'''
show status of current data, can be either 'raw' or 'processed'
:param status:
:return:
'''
status = self.data.processed
wf_stat_color = {True: 'green',
False: 'black',
None: None}
wf_stat = {True: 'processed',
False: 'raw',
None: None}
self.dataPlot.setPermTextRight(wf_stat[status], wf_stat_color[status])
def check_plot_quantity(self): def check_plot_quantity(self):
settings = QSettings() settings = QSettings()
nth_sample = int(settings.value("nth_sample")) if settings.value("nth_sample") else 1 nth_sample = int(settings.value("nth_sample")) if settings.value("nth_sample") else 1
@ -1807,6 +1822,7 @@ class MainWindow(QMainWindow):
if True in self.comparable.values(): if True in self.comparable.values():
self.compare_action.setEnabled(True) self.compare_action.setEnabled(True)
self.draw() self.draw()
self.setWFstatus()
def checkEvent4comparison(self, event): def checkEvent4comparison(self, event):
if event.pylot_picks and event.pylot_autopicks: if event.pylot_picks and event.pylot_autopicks:
@ -3212,9 +3228,9 @@ class MainWindow(QMainWindow):
self.fill_eventbox() self.fill_eventbox()
self.getPlotWidget().draw() self.getPlotWidget().draw()
if self.plot_method == 'fast': if self.plot_method == 'fast':
self.dataPlot.setPermText('MIN/MAX plot', color='red') self.dataPlot.setPermTextMid('MIN/MAX plot', color='red')
else: else:
self.dataPlot.setPermText() self.dataPlot.setPermTextMid()
def _setDirty(self): def _setDirty(self):
self.setDirty(True) self.setDirty(True)

View File

@ -74,6 +74,7 @@ class Data(object):
self.wforiginal = None self.wforiginal = None
self.cuttimes = None self.cuttimes = None
self.dirty = False self.dirty = False
self.processed = None
def __str__(self): def __str__(self):
return str(self.wfdata) return str(self.wfdata)
@ -381,11 +382,14 @@ class Data(object):
self.wfsyn = Stream() self.wfsyn = Stream()
wffnames = None wffnames = None
wffnames_syn = None wffnames_syn = None
wfdir = 'raw'
for fname in fnames:
if fname.endswith('processed'):
wfdir = 'processed'
if obspy_dmt: if obspy_dmt:
wfdir = 'raw'
self.processed = False
for fname in fnames:
if fname.endswith('processed'):
wfdir = 'processed'
self.processed = True
break
for fpath in fnames: for fpath in fnames:
if fpath.endswith(wfdir): if fpath.endswith(wfdir):
wffnames = [os.path.join(fpath, fname) for fname in os.listdir(fpath)] wffnames = [os.path.join(fpath, fname) for fname in os.listdir(fpath)]

View File

@ -454,14 +454,13 @@ class WaveformWidgetPG(QtGui.QWidget):
# create plot # create plot
self.main_layout = QtGui.QVBoxLayout() self.main_layout = QtGui.QVBoxLayout()
self.label_layout = QtGui.QHBoxLayout() self.label_layout = QtGui.QHBoxLayout()
self.status_label = QtGui.QLabel() self.add_labels()
self.perm_label = QtGui.QLabel()
self.setLayout(self.main_layout)
self.plotWidget = self.pg.PlotWidget(self.parent(), title=title) self.plotWidget = self.pg.PlotWidget(self.parent(), title=title)
self.main_layout.addWidget(self.plotWidget) self.main_layout.addWidget(self.plotWidget)
self.main_layout.addLayout(self.label_layout) self.main_layout.addLayout(self.label_layout)
self.label_layout.addWidget(self.status_label) self.label_layout.addWidget(self.status_label)
self.label_layout.addWidget(self.perm_label) self.label_layout.addWidget(self.perm_label_mid)
self.label_layout.addWidget(self.perm_label_right)
self.plotWidget.showGrid(x=False, y=True, alpha=0.3) self.plotWidget.showGrid(x=False, y=True, alpha=0.3)
self.plotWidget.hideAxis('bottom') self.plotWidget.hideAxis('bottom')
self.plotWidget.hideAxis('left') self.plotWidget.hideAxis('left')
@ -494,12 +493,24 @@ class WaveformWidgetPG(QtGui.QWidget):
self.vLine.setPos(mousePoint.x()) self.vLine.setPos(mousePoint.x())
self.hLine.setPos(mousePoint.y()) self.hLine.setPos(mousePoint.y())
def add_labels(self):
self.status_label = QtGui.QLabel()
self.perm_label_mid = QtGui.QLabel()
self.perm_label_mid.setAlignment(4)
self.perm_label_right = QtGui.QLabel()
self.perm_label_right.setAlignment(2)
self.setLayout(self.main_layout)
def getPlotDict(self): def getPlotDict(self):
return self.plotdict return self.plotdict
def setPermText(self, text=None, color='black'): def setPermTextMid(self, text=None, color='black'):
self.perm_label.setText(text) self.perm_label_mid.setText(text)
self.perm_label.setStyleSheet('color: {}'.format(color)) self.perm_label_mid.setStyleSheet('color: {}'.format(color))
def setPermTextRight(self, text=None, color='black'):
self.perm_label_right.setText(text)
self.perm_label_right.setStyleSheet('color: {}'.format(color))
def setPlotDict(self, key, value): def setPlotDict(self, key, value):
self.plotdict[key] = value self.plotdict[key] = value