Merge branch 'style_options' into develop

This commit is contained in:
Marcel Paffrath 2017-09-11 15:53:49 +02:00
commit ed915f29df
13 changed files with 4743 additions and 6860 deletions

View File

@ -74,7 +74,8 @@ from pylot.core.util.connection import checkurl
from pylot.core.util.dataprocessing import read_metadata, restitute_data from pylot.core.util.dataprocessing import read_metadata, restitute_data
from pylot.core.util.utils import fnConstructor, getLogin, \ from pylot.core.util.utils import fnConstructor, getLogin, \
full_range, readFilterInformation, trim_station_components, check4gaps, make_pen, pick_color_plt, \ full_range, readFilterInformation, trim_station_components, check4gaps, make_pen, pick_color_plt, \
pick_linestyle_plt, remove_underscores, check4doubled, identifyPhaseID, excludeQualityClasses, has_spe, check4rotated pick_linestyle_plt, remove_underscores, check4doubled, identifyPhaseID, excludeQualityClasses, has_spe, \
check4rotated, transform_colors_mpl, transform_colors_mpl_str
from pylot.core.util.event import Event from pylot.core.util.event import Event
from pylot.core.io.location import create_creation_info, create_event from pylot.core.io.location import create_creation_info, create_event
from pylot.core.util.widgets import FilterOptionsDialog, NewEventDlg, \ from pylot.core.util.widgets import FilterOptionsDialog, NewEventDlg, \
@ -86,6 +87,8 @@ from pylot.core.util.structure import DATASTRUCTURE
from pylot.core.util.thread import Thread, Worker from pylot.core.util.thread import Thread, Worker
from pylot.core.util.version import get_git_version as _getVersionString from pylot.core.util.version import get_git_version as _getVersionString
from pylot.styles import style_settings
if sys.version_info.major == 3: if sys.version_info.major == 3:
import icons_rc_3 as icons_rc import icons_rc_3 as icons_rc
elif sys.version_info.major == 2: elif sys.version_info.major == 2:
@ -109,6 +112,7 @@ class MainWindow(QMainWindow):
print('Using default input file {}'.format(infile)) print('Using default input file {}'.format(infile))
if os.path.isfile(infile) == False: if os.path.isfile(infile) == False:
infile = QFileDialog().getOpenFileName(caption='Choose PyLoT-input file') infile = QFileDialog().getOpenFileName(caption='Choose PyLoT-input file')
if not os.path.exists(infile[0]): if not os.path.exists(infile[0]):
QMessageBox.warning(self, "PyLoT Warning", QMessageBox.warning(self, "PyLoT Warning",
"No PyLoT-input file declared!") "No PyLoT-input file declared!")
@ -139,12 +143,6 @@ class MainWindow(QMainWindow):
# default factor for dataplot e.g. enabling/disabling scrollarea # default factor for dataplot e.g. enabling/disabling scrollarea
self.height_factor = 12 self.height_factor = 12
# default colors for ref/test event
self._colors = {
'ref': QtGui.QColor(200, 210, 230, 255),
'test': QtGui.QColor(200, 230, 200, 255)
}
# UI has to be set up before(!) children widgets are about to show up # UI has to be set up before(!) children widgets are about to show up
self.createAction = createAction self.createAction = createAction
# read settings # read settings
@ -211,6 +209,8 @@ class MainWindow(QMainWindow):
except: except:
self.startTime = UTCDateTime() self.startTime = UTCDateTime()
self.init_styles()
pylot_icon = QIcon() pylot_icon = QIcon()
pylot_icon.addPixmap(QPixmap(':/icons/pylot.png')) pylot_icon.addPixmap(QPixmap(':/icons/pylot.png'))
@ -552,6 +552,13 @@ class MainWindow(QMainWindow):
self.addActions(toolbars["autoPyLoT"], pickActions) self.addActions(toolbars["autoPyLoT"], pickActions)
self.addActions(toolbars["LocationTools"], locationToolActions) self.addActions(toolbars["LocationTools"], locationToolActions)
# init pyqtgraph
self.pg = pg
# init style
settings = QSettings()
style = settings.value('style')
self.set_style(style)
# add event combo box and ref/test buttons # add event combo box and ref/test buttons
self.eventBox = self.createEventBox() self.eventBox = self.createEventBox()
@ -568,21 +575,20 @@ class MainWindow(QMainWindow):
self.eventBox.activated.connect(self.refreshEvents) self.eventBox.activated.connect(self.refreshEvents)
# add main tab widget # add main tab widget
self.tabs = QTabWidget() self.tabs = QTabWidget(self)
self._main_layout.addWidget(self.tabs) self._main_layout.addWidget(self.tabs)
self.tabs.currentChanged.connect(self.refreshTabs) self.tabs.currentChanged.connect(self.refreshTabs)
# add scroll area used in case number of traces gets too high # add scroll area used in case number of traces gets too high
self.wf_scroll_area = QtGui.QScrollArea() self.wf_scroll_area = QtGui.QScrollArea(self)
# create central matplotlib figure canvas widget # create central matplotlib figure canvas widget
self.pg = pg
self.init_wfWidget() self.init_wfWidget()
# init main widgets for main tabs # init main widgets for main tabs
wf_tab = QtGui.QWidget() wf_tab = QtGui.QWidget(self)
array_tab = QtGui.QWidget() array_tab = QtGui.QWidget(self)
events_tab = QtGui.QWidget() events_tab = QtGui.QWidget(self)
# init main widgets layouts # init main widgets layouts
self.wf_layout = QtGui.QVBoxLayout() self.wf_layout = QtGui.QVBoxLayout()
@ -625,8 +631,8 @@ class MainWindow(QMainWindow):
self.dataPlot = PylotCanvas(parent=self, connect_events=False, multicursor=True) self.dataPlot = PylotCanvas(parent=self, connect_events=False, multicursor=True)
self.dataPlot.updateWidget(xlab, None, plottitle) self.dataPlot.updateWidget(xlab, None, plottitle)
else: else:
self.pg = True self.pg = pg
self.dataPlot = WaveformWidgetPG(parent=self, xlabel=xlab, ylabel=None, self.dataPlot = WaveformWidgetPG(parent=self,
title=plottitle) title=plottitle)
self.dataPlot.setCursor(Qt.CrossCursor) self.dataPlot.setCursor(Qt.CrossCursor)
self.wf_scroll_area.setWidget(self.dataPlot) self.wf_scroll_area.setWidget(self.dataPlot)
@ -645,8 +651,8 @@ class MainWindow(QMainWindow):
'event as test picks for autopicker testing.') 'event as test picks for autopicker testing.')
self.ref_event_button.setCheckable(True) self.ref_event_button.setCheckable(True)
self.test_event_button.setCheckable(True) self.test_event_button.setCheckable(True)
self.set_button_color(self.ref_event_button, self._colors['ref']) self.set_button_border_color(self.ref_event_button, self._style['ref']['rgba'])
self.set_button_color(self.test_event_button, self._colors['test']) self.set_button_border_color(self.test_event_button, self._style['test']['rgba'])
self.ref_event_button.clicked.connect(self.toggleRef) self.ref_event_button.clicked.connect(self.toggleRef)
self.test_event_button.clicked.connect(self.toggleTest) self.test_event_button.clicked.connect(self.toggleTest)
self.ref_event_button.setEnabled(False) self.ref_event_button.setEnabled(False)
@ -664,6 +670,84 @@ class MainWindow(QMainWindow):
if event.key() == QtCore.Qt.Key.Key_Shift: if event.key() == QtCore.Qt.Key.Key_Shift:
self._shift = False self._shift = False
def init_styles(self):
self._styles = {}
styles = ['default', 'dark', 'bright']
stylecolors = style_settings.stylecolors
for style in styles:
if style in stylecolors.keys():
self._styles[style] = stylecolors[style]
self._phasecolors = style_settings.phasecolors
for style, stylecolors in self._styles.items():
stylesheet = stylecolors['stylesheet']['filename']
if stylesheet:
stylesheet_file = open(stylesheet, 'r')
stylesheet = stylesheet_file.read()
stylesheet_file.close()
else:
stylesheet = self.styleSheet()
bg_color = stylecolors['background']['rgba']
line_color = stylecolors['linecolor']['rgba']
multcursor_color = stylecolors['multicursor']['rgba']
# transform to 0-1 values for mpl and update dict
stylecolors['background']['rgba_mpl'] = transform_colors_mpl(bg_color)
stylecolors['linecolor']['rgba_mpl'] = transform_colors_mpl(line_color)
multcursor_color = stylecolors['multicursor']['rgba_mpl'] = transform_colors_mpl(multcursor_color)
stylecolors['stylesheet'] = stylesheet
def set_style(self, stylename=None):
if not stylename:
stylename = 'default'
if not stylename in self._styles:
qmb = QMessageBox.warning(self, 'Could not find style',
'Could not find style with name {}. Using default.'.format(stylename))
self.set_style('default')
return
style = self._styles[stylename]
self._style = style
self.setStyleSheet(style['stylesheet'])
# colors for ref/test event
self._ref_test_colors = {
'ref': QtGui.QColor(*style['ref']['rgba']),
'test': QtGui.QColor(*style['test']['rgba']),
}
# plot colors
bg_color = style['background']['rgba']
bg_color_mpl_na = transform_colors_mpl_str(bg_color, no_alpha=True)
line_color = style['linecolor']['rgba']
line_color_mpl_na = transform_colors_mpl_str(line_color, no_alpha=True)
for param in matplotlib.rcParams:
if 'color' in param and matplotlib.rcParams[param] in ['k', 'black']:
matplotlib.rcParams[param] = line_color_mpl_na
matplotlib.rc('axes',
edgecolor=line_color_mpl_na,
facecolor=bg_color_mpl_na,
labelcolor=line_color_mpl_na)
matplotlib.rc('xtick',
color=line_color_mpl_na)
matplotlib.rc('ytick',
color=line_color_mpl_na)
matplotlib.rc('figure',
facecolor=bg_color_mpl_na)
if self.pg:
pg.setConfigOption('background', bg_color)
pg.setConfigOption('foreground', line_color)
settings = QSettings()
settings.setValue('style', stylename)
settings.sync()
@property @property
def metadata(self): def metadata(self):
return self._metadata return self._metadata
@ -803,20 +887,27 @@ class MainWindow(QMainWindow):
def add_recentfile(self, event): def add_recentfile(self, event):
self.recentfiles.insert(0, event) self.recentfiles.insert(0, event)
def set_button_color(self, button, color=None): def set_button_border_color(self, button, color=None):
''' '''
Set background color of a button. Set background color of a button.
button: type = QtGui.QAbstractButton button: type = QtGui.QAbstractButton
color: type = QtGui.QColor or type = str (RGBA) color: type = QtGui.QColor or type = str (RGBA)
''' '''
if type(color) == QtGui.QColor: if type(color) == QtGui.QColor:
button.setStyleSheet({'QPushButton{background-color:transparent}'})
palette = button.palette() palette = button.palette()
role = button.backgroundRole() role = button.backgroundRole()
palette.setColor(role, color) palette.setColor(role, color)
button.setPalette(palette) button.setPalette(palette)
button.setAutoFillBackground(True) button.setAutoFillBackground(True)
elif type(color) == str or not color: elif type(color) == str:
button.setStyleSheet("background-color: {}".format(color)) button.setStyleSheet('QPushButton{border-color: %s}'
'QPushButton:checked{background-color: rgba%s}'% (color, color))
elif type(color) == tuple:
button.setStyleSheet('QPushButton{border-color: rgba%s}'
'QPushButton:checked{background-color: rgba%s}' % (str(color), str(color)))
elif not color:
button.setStyleSheet(self.orig_parent._style['stylesheet'])
def getWFFnames(self): def getWFFnames(self):
try: try:
@ -1092,9 +1183,9 @@ class MainWindow(QMainWindow):
item_ref = QtGui.QStandardItem() # str(event_ref)) item_ref = QtGui.QStandardItem() # str(event_ref))
item_test = QtGui.QStandardItem() # str(event_test)) item_test = QtGui.QStandardItem() # str(event_test))
if event_ref: if event_ref:
item_ref.setBackground(self._colors['ref']) item_ref.setBackground(self._ref_test_colors['ref'])
if event_test: if event_test:
item_test.setBackground(self._colors['test']) item_test.setBackground(self._ref_test_colors['test'])
item_notes = QtGui.QStandardItem(event.notes) item_notes = QtGui.QStandardItem(event.notes)
openIcon = self.style().standardIcon(QStyle.SP_DirOpenIcon) openIcon = self.style().standardIcon(QStyle.SP_DirOpenIcon)
@ -1523,7 +1614,8 @@ class MainWindow(QMainWindow):
self.getPlotWidget().updateWidget() self.getPlotWidget().updateWidget()
plots = self.wfp_thread.data plots = self.wfp_thread.data
for times, data in plots: for times, data in plots:
self.dataPlot.plotWidget.getPlotItem().plot(times, data, pen='k') self.dataPlot.plotWidget.getPlotItem().plot(times, data,
pen=self.dataPlot.pen_linecolor)
self.dataPlot.reinitMoveProxy() self.dataPlot.reinitMoveProxy()
self.dataPlot.plotWidget.showAxis('left') self.dataPlot.plotWidget.showAxis('left')
self.dataPlot.plotWidget.showAxis('bottom') self.dataPlot.plotWidget.showAxis('bottom')
@ -1907,27 +1999,36 @@ class MainWindow(QMainWindow):
'el_S1pick', 'el_S1pick',
'el_S2pick', 'el_S2pick',
'refSpick', 'refSpick',
'aicARHfig' 'aicARHfig',
'plot_style'
] ]
for key in self.fig_keys: for key in self.fig_keys:
fig = Figure() if key == 'plot_style':
fig = self._style
else:
fig = Figure()
self.fig_dict[key] = fig self.fig_dict[key] = fig
def init_canvas_dict(self): def init_canvas_dict(self):
self.canvas_dict = {} self.canvas_dict = {}
for key in self.fig_keys: for key in self.fig_keys:
self.canvas_dict[key] = PylotCanvas(self.fig_dict[key]) if not key == 'plot_style':
self.canvas_dict[key] = PylotCanvas(self.fig_dict[key], parent=self)
def init_fig_dict_wadatijack(self, eventIDs): def init_fig_dict_wadatijack(self, eventIDs):
self.fig_dict_wadatijack = {} self.fig_dict_wadatijack = {}
self.fig_keys_wadatijack = [ self.fig_keys_wadatijack = [
'jackknife', 'jackknife',
'wadati' 'wadati',
'plot_style'
] ]
for eventID in eventIDs: for eventID in eventIDs:
self.fig_dict_wadatijack[eventID] = {} self.fig_dict_wadatijack[eventID] = {}
for key in self.fig_keys_wadatijack: for key in self.fig_keys_wadatijack:
fig = Figure() if key == 'plot_style':
fig = self._style
else:
fig = Figure()
self.fig_dict_wadatijack[eventID][key] = fig self.fig_dict_wadatijack[eventID][key] = fig
def init_canvas_dict_wadatijack(self): def init_canvas_dict_wadatijack(self):
@ -1935,7 +2036,9 @@ class MainWindow(QMainWindow):
for eventID in self.fig_dict_wadatijack.keys(): for eventID in self.fig_dict_wadatijack.keys():
self.canvas_dict_wadatijack[eventID] = {} self.canvas_dict_wadatijack[eventID] = {}
for key in self.fig_keys_wadatijack: for key in self.fig_keys_wadatijack:
self.canvas_dict_wadatijack[eventID][key] = PylotCanvas(self.fig_dict_wadatijack[eventID][key]) if not key == 'plot_style':
self.canvas_dict_wadatijack[eventID][key] = PylotCanvas(self.fig_dict_wadatijack[eventID][key],
parent=self)
def tune_autopicker(self): def tune_autopicker(self):
''' '''
@ -2500,7 +2603,7 @@ class MainWindow(QMainWindow):
self.events_layout.removeWidget(self.event_table) self.events_layout.removeWidget(self.event_table)
# init new qtable # init new qtable
self.event_table = QtGui.QTableWidget() self.event_table = QtGui.QTableWidget(self)
self.event_table.setColumnCount(12) self.event_table.setColumnCount(12)
self.event_table.setRowCount(len(eventlist)) self.event_table.setRowCount(len(eventlist))
self.event_table.setHorizontalHeaderLabels(['', self.event_table.setHorizontalHeaderLabels(['',
@ -2554,8 +2657,8 @@ class MainWindow(QMainWindow):
item_notes = QtGui.QTableWidgetItem() item_notes = QtGui.QTableWidgetItem()
# manipulate items # manipulate items
item_ref.setBackground(self._colors['ref']) item_ref.setBackground(self._ref_test_colors['ref'])
item_test.setBackground(self._colors['test']) item_test.setBackground(self._ref_test_colors['test'])
item_path.setText(event.path) item_path.setText(event.path)
if hasattr(event, 'origins'): if hasattr(event, 'origins'):
if event.origins: if event.origins:
@ -2777,7 +2880,7 @@ class MainWindow(QMainWindow):
if not self.okToContinue(): if not self.okToContinue():
return return
if not fnm: if not fnm:
dlg = QFileDialog() dlg = QFileDialog(parent=self)
fnm = dlg.getOpenFileName(self, 'Open project file...', filter='Pylot project (*.plp)') fnm = dlg.getOpenFileName(self, 'Open project file...', filter='Pylot project (*.plp)')
if not fnm: if not fnm:
return return
@ -2804,7 +2907,7 @@ class MainWindow(QMainWindow):
''' '''
Save back project to new pickle file. Save back project to new pickle file.
''' '''
dlg = QFileDialog() dlg = QFileDialog(self)
fnm = dlg.getSaveFileName(self, 'Create a new project file...', filter='Pylot project (*.plp)') fnm = dlg.getSaveFileName(self, 'Create a new project file...', filter='Pylot project (*.plp)')
filename = fnm[0] filename = fnm[0]
if not len(fnm[0]): if not len(fnm[0]):
@ -2866,7 +2969,7 @@ class MainWindow(QMainWindow):
def setParameter(self, show=True): def setParameter(self, show=True):
if not self.paraBox: if not self.paraBox:
self.paraBox = PylotParaBox(self._inputs) self.paraBox = PylotParaBox(self._inputs, parent=self, windowflag=1)
self.paraBox.accepted.connect(self._setDirty) self.paraBox.accepted.connect(self._setDirty)
self.paraBox.accepted.connect(self.filterOptionsFromParameter) self.paraBox.accepted.connect(self.filterOptionsFromParameter)
if show: if show:
@ -3090,6 +3193,7 @@ def create_window():
def main(args=None): def main(args=None):
project_filename = None project_filename = None
#args.project_filename = 'C:/Shared/AlpArray/alparray_data/project_alparray_test.plp'
pylot_infile = None pylot_infile = None
if args: if args:
if args.project_filename: if args.project_filename:

Binary file not shown.

Before

Width:  |  Height:  |  Size: 52 KiB

After

Width:  |  Height:  |  Size: 30 KiB

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -322,9 +322,11 @@ def autopickstation(wfstream, pickparam, verbose=False,
key = 'aicFig' key = 'aicFig'
if fig_dict: if fig_dict:
fig = fig_dict[key] fig = fig_dict[key]
linecolor = fig_dict['plot_style']['linecolor']['rgba_mpl']
else: else:
fig = None fig = None
aicpick = AICPicker(aiccf, tsnrz, pickwinP, iplot, None, aictsmoothP, fig=fig) linecolor = 'k'
aicpick = AICPicker(aiccf, tsnrz, pickwinP, iplot, None, aictsmoothP, fig=fig, linecolor=linecolor)
# add pstart and pstop to aic plot # add pstart and pstop to aic plot
if fig: if fig:
for ax in fig.axes: for ax in fig.axes:
@ -347,12 +349,14 @@ def autopickstation(wfstream, pickparam, verbose=False,
key = 'slength' key = 'slength'
if fig_dict: if fig_dict:
fig = fig_dict[key] fig = fig_dict[key]
linecolor = fig_dict['plot_style']['linecolor']['rgba_mpl']
else: else:
fig = None fig = None
linecolor = 'k'
Pflag = checksignallength(zne, aicpick.getpick(), tsnrz, Pflag = checksignallength(zne, aicpick.getpick(), tsnrz,
minsiglength / 2, minsiglength / 2,
nfacsl, minpercent, iplot, nfacsl, minpercent, iplot,
fig) fig, linecolor)
else: else:
# filter and taper horizontal traces # filter and taper horizontal traces
trH1_filt = edat.copy() trH1_filt = edat.copy()
@ -369,12 +373,14 @@ def autopickstation(wfstream, pickparam, verbose=False,
zne += trH2_filt zne += trH2_filt
if fig_dict: if fig_dict:
fig = fig_dict['slength'] fig = fig_dict['slength']
linecolor = fig_dict['plot_style']['linecolor']['rgba_mpl']
else: else:
fig = None fig = None
linecolor = 'k'
Pflag = checksignallength(zne, aicpick.getpick(), tsnrz, Pflag = checksignallength(zne, aicpick.getpick(), tsnrz,
minsiglength, minsiglength,
nfacsl, minpercent, iplot, nfacsl, minpercent, iplot,
fig) fig, linecolor)
if Pflag == 1: if Pflag == 1:
# check for spuriously picked S onset # check for spuriously picked S onset
@ -387,10 +393,12 @@ def autopickstation(wfstream, pickparam, verbose=False,
if iplot > 1: if iplot > 1:
if fig_dict: if fig_dict:
fig = fig_dict['checkZ4s'] fig = fig_dict['checkZ4s']
linecolor = fig_dict['plot_style']['linecolor']['rgba_mpl']
else: else:
fig = None fig = None
linecolor = 'k'
Pflag = checkZ4S(zne, aicpick.getpick(), zfac, Pflag = checkZ4S(zne, aicpick.getpick(), zfac,
tsnrz[2], iplot, fig) tsnrz[2], iplot, fig, linecolor)
if Pflag == 0: if Pflag == 0:
Pmarker = 'SinsteadP' Pmarker = 'SinsteadP'
Pweight = 9 Pweight = 9
@ -442,10 +450,12 @@ def autopickstation(wfstream, pickparam, verbose=False,
algoP=algoP) algoP=algoP)
if fig_dict: if fig_dict:
fig = fig_dict['refPpick'] fig = fig_dict['refPpick']
linecolor = fig_dict['plot_style']['linecolor']['rgba_mpl']
else: else:
fig = None fig = None
linecolor = 'k'
refPpick = PragPicker(cf2, tsnrz, pickwinP, iplot, ausP, tsmoothP, refPpick = PragPicker(cf2, tsnrz, pickwinP, iplot, ausP, tsmoothP,
aicpick.getpick(), fig) aicpick.getpick(), fig, linecolor)
mpickP = refPpick.getpick() mpickP = refPpick.getpick()
############################################################# #############################################################
if mpickP is not None: if mpickP is not None:
@ -454,10 +464,13 @@ def autopickstation(wfstream, pickparam, verbose=False,
if iplot: if iplot:
if fig_dict: if fig_dict:
fig = fig_dict['el_Ppick'] fig = fig_dict['el_Ppick']
linecolor = fig_dict['plot_style']['linecolor']['rgba_mpl']
else: else:
fig = None fig = None
linecolor = 'k'
epickP, lpickP, Perror = earllatepicker(z_copy, nfacP, tsnrz, epickP, lpickP, Perror = earllatepicker(z_copy, nfacP, tsnrz,
mpickP, iplot, fig=fig) mpickP, iplot, fig=fig,
linecolor=linecolor)
else: else:
epickP, lpickP, Perror = earllatepicker(z_copy, nfacP, tsnrz, epickP, lpickP, Perror = earllatepicker(z_copy, nfacP, tsnrz,
mpickP, iplot) mpickP, iplot)
@ -487,9 +500,10 @@ def autopickstation(wfstream, pickparam, verbose=False,
if iplot: if iplot:
if fig_dict: if fig_dict:
fig = fig_dict['fm_picker'] fig = fig_dict['fm_picker']
linecolor = fig_dict['plot_style']['linecolor']['rgba_mpl']
else: else:
fig = None fig = None
FM = fmpicker(zdat, z_copy, fmpickwin, mpickP, iplot, fig) FM = fmpicker(zdat, z_copy, fmpickwin, mpickP, iplot, fig, linecolor)
else: else:
FM = fmpicker(zdat, z_copy, fmpickwin, mpickP, iplot) FM = fmpicker(zdat, z_copy, fmpickwin, mpickP, iplot)
else: else:
@ -624,10 +638,12 @@ def autopickstation(wfstream, pickparam, verbose=False,
# of class AutoPicking # of class AutoPicking
if fig_dict: if fig_dict:
fig = fig_dict['aicARHfig'] fig = fig_dict['aicARHfig']
linecolor = fig_dict['plot_style']['linecolor']['rgba_mpl']
else: else:
fig = None fig = None
linecolor = 'k'
aicarhpick = AICPicker(haiccf, tsnrh, pickwinS, iplot, None, aicarhpick = AICPicker(haiccf, tsnrh, pickwinS, iplot, None,
aictsmoothS, fig=fig) aictsmoothS, fig=fig, linecolor=linecolor)
############################################################### ###############################################################
# go on with processing if AIC onset passes quality control # go on with processing if AIC onset passes quality control
slope = aicarhpick.getSlope() slope = aicarhpick.getSlope()
@ -686,10 +702,12 @@ def autopickstation(wfstream, pickparam, verbose=False,
# get refined onset time from CF2 using class Picker # get refined onset time from CF2 using class Picker
if fig_dict: if fig_dict:
fig = fig_dict['refSpick'] fig = fig_dict['refSpick']
linecolor = fig_dict['plot_style']['linecolor']['rgba_mpl']
else: else:
fig = None fig = None
linecolor = 'k'
refSpick = PragPicker(arhcf2, tsnrh, pickwinS, iplot, ausS, refSpick = PragPicker(arhcf2, tsnrh, pickwinS, iplot, ausS,
tsmoothS, aicarhpick.getpick(), fig) tsmoothS, aicarhpick.getpick(), fig, linecolor)
mpickS = refSpick.getpick() mpickS = refSpick.getpick()
############################################################# #############################################################
if mpickS is not None: if mpickS is not None:
@ -699,12 +717,15 @@ def autopickstation(wfstream, pickparam, verbose=False,
if iplot: if iplot:
if fig_dict: if fig_dict:
fig = fig_dict['el_S1pick'] fig = fig_dict['el_S1pick']
linecolor = fig_dict['plot_style']['linecolor']['rgba_mpl']
else: else:
fig = None fig = None
linecolor = 'k'
epickS1, lpickS1, Serror1 = earllatepicker(h_copy, nfacS, epickS1, lpickS1, Serror1 = earllatepicker(h_copy, nfacS,
tsnrh, tsnrh,
mpickS, iplot, mpickS, iplot,
fig=fig) fig=fig,
linecolor=linecolor)
else: else:
epickS1, lpickS1, Serror1 = earllatepicker(h_copy, nfacS, epickS1, lpickS1, Serror1 = earllatepicker(h_copy, nfacS,
tsnrh, tsnrh,
@ -714,12 +735,15 @@ def autopickstation(wfstream, pickparam, verbose=False,
if iplot: if iplot:
if fig_dict: if fig_dict:
fig = fig_dict['el_S2pick'] fig = fig_dict['el_S2pick']
linecolor = fig_dict['plot_style']['linecolor']['rgba_mpl']
else: else:
fig = None fig = None
linecolor = ''
epickS2, lpickS2, Serror2 = earllatepicker(h_copy, nfacS, epickS2, lpickS2, Serror2 = earllatepicker(h_copy, nfacS,
tsnrh, tsnrh,
mpickS, iplot, mpickS, iplot,
fig=fig) fig=fig,
linecolor=linecolor)
else: else:
epickS2, lpickS2, Serror2 = earllatepicker(h_copy, nfacS, epickS2, lpickS2, Serror2 = earllatepicker(h_copy, nfacS,
tsnrh, tsnrh,
@ -828,8 +852,10 @@ def autopickstation(wfstream, pickparam, verbose=False,
if fig_dict == None or fig_dict == 'None': if fig_dict == None or fig_dict == 'None':
fig = plt.figure() fig = plt.figure()
plt_flag = 1 plt_flag = 1
linecolor = 'k'
else: else:
fig = fig_dict['mainFig'] fig = fig_dict['mainFig']
linecolor = fig_dict['plot_style']['linecolor']['rgba_mpl']
ax1 = fig.add_subplot(311) ax1 = fig.add_subplot(311)
tdata = np.arange(0, zdat[0].stats.npts / tr_filt.stats.sampling_rate, tdata = np.arange(0, zdat[0].stats.npts / tr_filt.stats.sampling_rate,
tr_filt.stats.delta) tr_filt.stats.delta)
@ -837,7 +863,7 @@ def autopickstation(wfstream, pickparam, verbose=False,
wfldiff = len(tr_filt.data) - len(tdata) wfldiff = len(tr_filt.data) - len(tdata)
if wfldiff < 0: if wfldiff < 0:
tdata = tdata[0:len(tdata) - abs(wfldiff)] tdata = tdata[0:len(tdata) - abs(wfldiff)]
ax1.plot(tdata, tr_filt.data / max(tr_filt.data), 'k', label='Data') ax1.plot(tdata, tr_filt.data / max(tr_filt.data), color=linecolor, linewidth=0.7, label='Data')
if Pweight < 4: if Pweight < 4:
ax1.plot(cf1.getTimeArray(), cf1.getCF() / max(cf1.getCF()), ax1.plot(cf1.getTimeArray(), cf1.getCF() / max(cf1.getCF()),
'b', label='CF1') 'b', label='CF1')
@ -896,7 +922,7 @@ def autopickstation(wfstream, pickparam, verbose=False,
wfldiff = len(trH1_filt.data) - len(th1data) wfldiff = len(trH1_filt.data) - len(th1data)
if wfldiff < 0: if wfldiff < 0:
th1data = th1data[0:len(th1data) - abs(wfldiff)] th1data = th1data[0:len(th1data) - abs(wfldiff)]
ax2.plot(th1data, trH1_filt.data / max(trH1_filt.data), 'k', label='Data') ax2.plot(th1data, trH1_filt.data / max(trH1_filt.data), color=linecolor, linewidth=0.7, label='Data')
if Pweight < 4: if Pweight < 4:
ax2.plot(arhcf1.getTimeArray(), ax2.plot(arhcf1.getTimeArray(),
arhcf1.getCF() / max(arhcf1.getCF()), 'b', label='CF1') arhcf1.getCF() / max(arhcf1.getCF()), 'b', label='CF1')
@ -945,7 +971,7 @@ def autopickstation(wfstream, pickparam, verbose=False,
wfldiff = len(trH2_filt.data) - len(th2data) wfldiff = len(trH2_filt.data) - len(th2data)
if wfldiff < 0: if wfldiff < 0:
th2data = th2data[0:len(th2data) - abs(wfldiff)] th2data = th2data[0:len(th2data) - abs(wfldiff)]
ax3.plot(th2data, trH2_filt.data / max(trH2_filt.data), 'k', label='Data') ax3.plot(th2data, trH2_filt.data / max(trH2_filt.data), color=linecolor, linewidth=0.7, label='Data')
if Pweight < 4: if Pweight < 4:
p22, = ax3.plot(arhcf1.getTimeArray(), p22, = ax3.plot(arhcf1.getTimeArray(),
arhcf1.getCF() / max(arhcf1.getCF()), 'b', label='CF1') arhcf1.getCF() / max(arhcf1.getCF()), 'b', label='CF1')

View File

@ -35,7 +35,7 @@ class AutoPicker(object):
warnings.simplefilter('ignore') warnings.simplefilter('ignore')
def __init__(self, cf, TSNR, PickWindow, iplot=0, aus=None, Tsmooth=None, Pick1=None, fig=None): def __init__(self, cf, TSNR, PickWindow, iplot=0, aus=None, Tsmooth=None, Pick1=None, fig=None, linecolor='k'):
''' '''
:param: cf, characteristic function, on which the picking algorithm is applied :param: cf, characteristic function, on which the picking algorithm is applied
:type: `~pylot.core.pick.CharFuns.CharacteristicFunction` object :type: `~pylot.core.pick.CharFuns.CharacteristicFunction` object
@ -62,7 +62,8 @@ class AutoPicker(object):
''' '''
assert isinstance(cf, CharacteristicFunction), "%s is not a CharacteristicFunction object" % str(cf) assert isinstance(cf, CharacteristicFunction), "%s is not a CharacteristicFunction object" % str(cf)
self._linecolor = linecolor
self._pickcolor_p = 'b'
self.cf = cf.getCF() self.cf = cf.getCF()
self.Tcf = cf.getTimeArray() self.Tcf = cf.getTimeArray()
self.Data = cf.getXCF() self.Data = cf.getXCF()
@ -264,13 +265,13 @@ class AICPicker(AutoPicker):
print("Choose longer slope determination window!") print("Choose longer slope determination window!")
if self.iplot > 1: if self.iplot > 1:
if self.fig == None or self.fig == 'None': if self.fig == None or self.fig == 'None':
fig = plt.figure() # self.iplot) ### WHY? MP MP fig = plt.figure()
plt_flag = 1 plt_flag = 1
else: else:
fig = self.fig fig = self.fig
ax = fig.add_subplot(111) ax = fig.add_subplot(111)
x = self.Data[0].data x = self.Data[0].data
ax.plot(self.Tcf, x / max(x), 'k', label='(HOS-/AR-) Data') ax.plot(self.Tcf, x / max(x), color=self._linecolor, linewidth=0.7, label='(HOS-/AR-) Data')
ax.plot(self.Tcf, aicsmooth / max(aicsmooth), 'r', label='Smoothed AIC-CF') ax.plot(self.Tcf, aicsmooth / max(aicsmooth), 'r', label='Smoothed AIC-CF')
ax.legend(loc=1) ax.legend(loc=1)
ax.set_xlabel('Time [s] since %s' % self.Data[0].stats.starttime) ax.set_xlabel('Time [s] since %s' % self.Data[0].stats.starttime)
@ -307,7 +308,7 @@ class AICPicker(AutoPicker):
x = self.Data[0].data x = self.Data[0].data
if len(self.Tcf) > len(self.Data[0].data): # why? LK if len(self.Tcf) > len(self.Data[0].data): # why? LK
self.Tcf = self.Tcf[0:len(self.Tcf)-1] self.Tcf = self.Tcf[0:len(self.Tcf)-1]
ax1.plot(self.Tcf, x / max(x), 'k', label='(HOS-/AR-) Data') ax1.plot(self.Tcf, x / max(x), color=self._linecolor, linewidth=0.7, label='(HOS-/AR-) Data')
ax1.plot(self.Tcf, aicsmooth / max(aicsmooth), 'r', label='Smoothed AIC-CF') ax1.plot(self.Tcf, aicsmooth / max(aicsmooth), 'r', label='Smoothed AIC-CF')
if self.Pick is not None: if self.Pick is not None:
ax1.plot([self.Pick, self.Pick], [-0.1, 0.5], 'b', linewidth=2, label='AIC-Pick') ax1.plot([self.Pick, self.Pick], [-0.1, 0.5], 'b', linewidth=2, label='AIC-Pick')
@ -317,7 +318,7 @@ class AICPicker(AutoPicker):
if self.Pick is not None: if self.Pick is not None:
ax2 = fig.add_subplot(2, 1, 2, sharex=ax1) ax2 = fig.add_subplot(2, 1, 2, sharex=ax1)
ax2.plot(self.Tcf, x, 'k', label='Data') ax2.plot(self.Tcf, x, color=self._linecolor, linewidth=0.7, label='Data')
ax1.axvspan(self.Tcf[inoise[0]], self.Tcf[inoise[-1]], color='y', alpha=0.2, lw=0, label='Noise Window') ax1.axvspan(self.Tcf[inoise[0]], self.Tcf[inoise[-1]], color='y', alpha=0.2, lw=0, label='Noise Window')
ax1.axvspan(self.Tcf[isignal[0]], self.Tcf[isignal[-1]], color='b', alpha=0.2, lw=0, ax1.axvspan(self.Tcf[isignal[0]], self.Tcf[isignal[-1]], color='b', alpha=0.2, lw=0,
label='Signal Window') label='Signal Window')
@ -473,10 +474,10 @@ class PragPicker(AutoPicker):
else: else:
fig = self.fig fig = self.fig
ax = fig.add_subplot(111) ax = fig.add_subplot(111)
ax.plot(Tcfpick, cfipick, 'k', label='CF') ax.plot(Tcfpick, cfipick, color=self._linecolor, linewidth=0.7, label='CF')
ax.plot(Tcfpick, cfsmoothipick, 'r', label='Smoothed CF') ax.plot(Tcfpick, cfsmoothipick, 'r', label='Smoothed CF')
if pickflag > 0: if pickflag > 0:
ax.plot([self.Pick, self.Pick], [min(cfipick), max(cfipick)], 'b', linewidth=2, label='Pick') ax.plot([self.Pick, self.Pick], [min(cfipick), max(cfipick)], self._pickcolor_p, linewidth=2, label='Pick')
ax.set_xlabel('Time [s] since %s' % self.Data[0].stats.starttime) ax.set_xlabel('Time [s] since %s' % self.Data[0].stats.starttime)
ax.set_yticks([]) ax.set_yticks([])
ax.set_title(self.Data[0].stats.station) ax.set_title(self.Data[0].stats.station)

View File

@ -15,7 +15,7 @@ import numpy as np
from obspy.core import Stream, UTCDateTime from obspy.core import Stream, UTCDateTime
def earllatepicker(X, nfac, TSNR, Pick1, iplot=0, verbosity=1, fig=None): def earllatepicker(X, nfac, TSNR, Pick1, iplot=0, verbosity=1, fig=None, linecolor='k'):
''' '''
Function to derive earliest and latest possible pick after Diehl & Kissling (2009) Function to derive earliest and latest possible pick after Diehl & Kissling (2009)
as reasonable uncertainties. Latest possible pick is based on noise level, as reasonable uncertainties. Latest possible pick is based on noise level,
@ -131,16 +131,16 @@ def earllatepicker(X, nfac, TSNR, Pick1, iplot=0, verbosity=1, fig=None):
fig = plt.figure() # iplot) fig = plt.figure() # iplot)
plt_flag = 1 plt_flag = 1
ax = fig.add_subplot(111) ax = fig.add_subplot(111)
ax.plot(t, x, 'k', label='Data') ax.plot(t, x, color=linecolor, linewidth=0.7, label='Data')
ax.axvspan(t[inoise[0]], t[inoise[-1]], color='y', alpha=0.2, lw=0, label='Noise Window') ax.axvspan(t[inoise[0]], t[inoise[-1]], color='y', alpha=0.2, lw=0, label='Noise Window')
ax.axvspan(t[isignal[0]], t[isignal[-1]], color='b', alpha=0.2, lw=0, label='Signal Window') ax.axvspan(t[isignal[0]], t[isignal[-1]], color='b', alpha=0.2, lw=0, label='Signal Window')
ax.plot([t[0], t[int(len(t)) - 1]], [nlevel, nlevel], '--k', label='Noise Level') ax.plot([t[0], t[int(len(t)) - 1]], [nlevel, nlevel], color=linecolor, linewidth=0.7, linestyle='dashed', label='Noise Level')
ax.plot(t[pis[zc]], np.zeros(len(zc)), '*g', ax.plot(t[pis[zc]], np.zeros(len(zc)), '*g',
markersize=14, label='Zero Crossings') markersize=14, label='Zero Crossings')
ax.plot([t[0], t[int(len(t)) - 1]], [-nlevel, -nlevel], '--k') ax.plot([t[0], t[int(len(t)) - 1]], [-nlevel, -nlevel], color=linecolor, linewidth=0.7, linestyle='dashed')
ax.plot([Pick1, Pick1], [max(x), -max(x)], 'b', linewidth=2, label='mpp') ax.plot([Pick1, Pick1], [max(x), -max(x)], 'b', linewidth=2, label='mpp')
ax.plot([LPick, LPick], [max(x) / 2, -max(x) / 2], '--k', label='lpp') ax.plot([LPick, LPick], [max(x) / 2, -max(x) / 2], color=linecolor, linewidth=0.7, linestyle='dashed', label='lpp')
ax.plot([EPick, EPick], [max(x) / 2, -max(x) / 2], '--k', label='epp') ax.plot([EPick, EPick], [max(x) / 2, -max(x) / 2], color=linecolor, linewidth=0.7, linestyle='dashed', label='epp')
ax.plot([Pick1 + PickError, Pick1 + PickError], ax.plot([Pick1 + PickError, Pick1 + PickError],
[max(x) / 2, -max(x) / 2], 'r--', label='spe') [max(x) / 2, -max(x) / 2], 'r--', label='spe')
ax.plot([Pick1 - PickError, Pick1 - PickError], ax.plot([Pick1 - PickError, Pick1 - PickError],
@ -160,7 +160,7 @@ def earllatepicker(X, nfac, TSNR, Pick1, iplot=0, verbosity=1, fig=None):
return EPick, LPick, PickError return EPick, LPick, PickError
def fmpicker(Xraw, Xfilt, pickwin, Pick, iplot=0, fig=None): def fmpicker(Xraw, Xfilt, pickwin, Pick, iplot=0, fig=None, linecolor='k'):
''' '''
Function to derive first motion (polarity) of given phase onset Pick. Function to derive first motion (polarity) of given phase onset Pick.
Calculation is based on zero crossings determined within time window pickwin Calculation is based on zero crossings determined within time window pickwin
@ -324,7 +324,7 @@ def fmpicker(Xraw, Xfilt, pickwin, Pick, iplot=0, fig=None):
fig = plt.figure() # iplot) fig = plt.figure() # iplot)
plt_flag = 1 plt_flag = 1
ax1 = fig.add_subplot(211) ax1 = fig.add_subplot(211)
ax1.plot(t, xraw, 'k') ax1.plot(t, xraw, color=linecolor, linewidth=0.7)
ax1.plot([Pick, Pick], [max(xraw), -max(xraw)], 'b', linewidth=2, label='Pick') ax1.plot([Pick, Pick], [max(xraw), -max(xraw)], 'b', linewidth=2, label='Pick')
if P1 is not None: if P1 is not None:
ax1.plot(t[islope1], xraw[islope1], label='Slope Window') ax1.plot(t[islope1], xraw[islope1], label='Slope Window')
@ -338,7 +338,7 @@ def fmpicker(Xraw, Xfilt, pickwin, Pick, iplot=0, fig=None):
ax2 = fig.add_subplot(2, 1, 2, sharex=ax1) ax2 = fig.add_subplot(2, 1, 2, sharex=ax1)
ax2.set_title('First-Motion Determination, Filtered Data') ax2.set_title('First-Motion Determination, Filtered Data')
ax2.plot(t, xfilt, 'k') ax2.plot(t, xfilt, color=linecolor, linewidth=0.7)
ax2.plot([Pick, Pick], [max(xfilt), -max(xfilt)], 'b', ax2.plot([Pick, Pick], [max(xfilt), -max(xfilt)], 'b',
linewidth=2) linewidth=2)
if P2 is not None: if P2 is not None:
@ -668,15 +668,18 @@ def wadaticheck(pickdic, dttolerance, iplot=0, fig_dict=None):
if iplot > 0: if iplot > 0:
if fig_dict: if fig_dict:
fig = fig_dict['wadati'] fig = fig_dict['wadati']
linecolor = fig_dict['plot_style']['linecolor']['rgba_mpl']
plt_flag = 0 plt_flag = 0
else: else:
fig = plt.figure() fig = plt.figure()
linecolor = 'k'
plt_flag = 1 plt_flag = 1
ax = fig.add_subplot(111) ax = fig.add_subplot(111)
ax.plot(Ppicks, SPtimes, 'ro', label='Skipped S-Picks') ax.plot(Ppicks, SPtimes, 'ro', label='Skipped S-Picks')
if wfitflag == 0: if wfitflag == 0:
ax.plot(Ppicks, wdfit, 'k', label='Wadati 1') ax.plot(Ppicks, wdfit, color=linecolor, linewidth=0.7, label='Wadati 1')
ax.plot(checkedPpicks, checkedSPtimes, 'ko', label='Reliable S-Picks') ax.plot(checkedPpicks, checkedSPtimes, color=linecolor,
linewidth=0, marker='o', label='Reliable S-Picks')
ax.plot(checkedPpicks, wdfit2, 'g', label='Wadati 2') ax.plot(checkedPpicks, wdfit2, 'g', label='Wadati 2')
ax.set_title('Wadati-Diagram, %d S-P Times, Vp/Vs(raw)=%5.2f,' \ ax.set_title('Wadati-Diagram, %d S-P Times, Vp/Vs(raw)=%5.2f,' \
'Vp/Vs(checked)=%5.2f' % (len(SPtimes), vpvsr, cvpvsr)) 'Vp/Vs(checked)=%5.2f' % (len(SPtimes), vpvsr, cvpvsr))
@ -699,7 +702,7 @@ def RMS(X):
return np.sqrt(np.sum(np.power(X, 2)) / len(X)) return np.sqrt(np.sum(np.power(X, 2)) / len(X))
def checksignallength(X, pick, TSNR, minsiglength, nfac, minpercent, iplot=0, fig=None): def checksignallength(X, pick, TSNR, minsiglength, nfac, minpercent, iplot=0, fig=None, linecolor='k'):
''' '''
Function to detect spuriously picked noise peaks. Function to detect spuriously picked noise peaks.
Uses RMS trace of all 3 components (if available) to determine, Uses RMS trace of all 3 components (if available) to determine,
@ -785,7 +788,7 @@ def checksignallength(X, pick, TSNR, minsiglength, nfac, minpercent, iplot=0, fi
fig = plt.figure() # iplot) fig = plt.figure() # iplot)
plt_flag = 1 plt_flag = 1
ax = fig.add_subplot(111) ax = fig.add_subplot(111)
ax.plot(t, rms, 'k', label='RMS Data') ax.plot(t, rms, color=linecolor, linewidth=0.7, label='RMS Data')
ax.axvspan(t[inoise[0]], t[inoise[-1]], color='y', alpha=0.2, lw=0, label='Noise Window') ax.axvspan(t[inoise[0]], t[inoise[-1]], color='y', alpha=0.2, lw=0, label='Noise Window')
ax.axvspan(t[isignal[0]], t[isignal[-1]], color='b', alpha=0.2, lw=0, label='Signal Window') ax.axvspan(t[isignal[0]], t[isignal[-1]], color='b', alpha=0.2, lw=0, label='Signal Window')
ax.plot([t[isignal[0]], t[isignal[len(isignal) - 1]]], ax.plot([t[isignal[0]], t[isignal[len(isignal) - 1]]],
@ -975,7 +978,7 @@ def jackknife(X, phi, h):
return PHI_jack, PHI_pseudo, PHI_sub return PHI_jack, PHI_pseudo, PHI_sub
def checkZ4S(X, pick, zfac, checkwin, iplot, fig=None): def checkZ4S(X, pick, zfac, checkwin, iplot, fig=None, linecolor='k'):
''' '''
Function to compare energy content of vertical trace with Function to compare energy content of vertical trace with
energy content of horizontal traces to detect spuriously energy content of horizontal traces to detect spuriously
@ -1103,7 +1106,7 @@ def checkZ4S(X, pick, zfac, checkwin, iplot, fig=None):
plt_flag = 1 plt_flag = 1
ax = fig.add_subplot(3, 1, i + 1, sharex=ax1) ax = fig.add_subplot(3, 1, i + 1, sharex=ax1)
ax.plot(t, abs(trace.data), color='b', label='abs') ax.plot(t, abs(trace.data), color='b', label='abs')
ax.plot(t, trace.data, color='k') ax.plot(t, trace.data, color=linecolor, linewidth=0.7)
name = str(trace.stats.channel) + ': {}'.format(rms) name = str(trace.stats.channel) + ': {}'.format(rms)
ax.plot([pick, pick + checkwin], [rms, rms], 'r', label='RMS {}'.format(name)) ax.plot([pick, pick + checkwin], [rms, rms], 'r', label='RMS {}'.format(name))
ax.plot([pick, pick], ax.get_ylim(), 'm', label='Pick') ax.plot([pick, pick], ax.get_ylim(), 'm', label='Pick')

View File

@ -14,6 +14,7 @@ from obspy.signal.rotate import rotate2zne
from obspy.io.xseed.utils import SEEDParserException from obspy.io.xseed.utils import SEEDParserException
from pylot.core.io.inputs import PylotParameter from pylot.core.io.inputs import PylotParameter
from pylot.styles import style_settings
from scipy.interpolate import splrep, splev from scipy.interpolate import splrep, splev
from PySide import QtCore, QtGui from PySide import QtCore, QtGui
@ -577,36 +578,22 @@ def modify_rgba(rgba, modifier, intensity):
def base_phase_colors(picktype, phase): def base_phase_colors(picktype, phase):
phases = { phasecolors = style_settings.phasecolors
'manual': return phasecolors[picktype][phase]
{
'P':
{
'rgba': (0, 0, 255, 255),
'modifier': 'g'
},
'S':
{
'rgba': (255, 0, 0, 255),
'modifier': 'b'
}
},
'auto':
{
'P':
{
'rgba': (140, 0, 255, 255),
'modifier': 'g'
},
'S':
{
'rgba': (255, 140, 0, 255),
'modifier': 'b'
}
}
}
return phases[picktype][phase]
def transform_colors_mpl_str(colors, no_alpha=False):
colors = list(colors)
colors_mpl = tuple([color / 255. for color in colors])
if no_alpha:
colors_mpl = '({}, {}, {})'.format(*colors_mpl)
else:
colors_mpl = '({}, {}, {}, {})'.format(*colors_mpl)
return colors_mpl
def transform_colors_mpl(colors):
colors = list(colors)
colors_mpl = tuple([color / 255. for color in colors])
return colors_mpl
def remove_underscores(data): def remove_underscores(data):
""" """

View File

@ -16,11 +16,6 @@ import time
import numpy as np import numpy as np
try:
import pyqtgraph as pg
except:
pg = None
from matplotlib.figure import Figure from matplotlib.figure import Figure
from pylot.core.util.utils import find_horizontals, identifyPhase, loopIdentifyPhase, trim_station_components, \ from pylot.core.util.utils import find_horizontals, identifyPhase, loopIdentifyPhase, trim_station_components, \
identifyPhaseID, check4rotated identifyPhaseID, check4rotated
@ -64,12 +59,6 @@ elif sys.version_info.major == 2:
else: else:
raise ImportError('Could not determine python version.') raise ImportError('Could not determine python version.')
if pg:
pg.setConfigOption('background', 'w')
pg.setConfigOption('foreground', 'k')
pg.setConfigOptions(antialias=True)
# pg.setConfigOption('leftButtonPan', False)
def getDataType(parent): def getDataType(parent):
type = QInputDialog().getItem(parent, "Select phases type", "Type:", type = QInputDialog().getItem(parent, "Select phases type", "Type:",
@ -435,29 +424,32 @@ class PlotWidget(FigureCanvas):
class WaveformWidgetPG(QtGui.QWidget): class WaveformWidgetPG(QtGui.QWidget):
def __init__(self, parent=None, xlabel='x', ylabel='y', title='Title'): def __init__(self, parent, title='Title'):
QtGui.QWidget.__init__(self, parent) # , 1) QtGui.QWidget.__init__(self, parent=parent)
self.setParent(parent) self.pg = self.parent().pg
self._parent = parent # added because adding widget to scrollArea will set scrollArea to parent
self.orig_parent = parent
# attribute plotdict is a dictionary connecting position and a name # attribute plotdict is a dictionary connecting position and a name
self.plotdict = dict() self.plotdict = dict()
# create plot # create plot
self.main_layout = QtGui.QVBoxLayout() self.main_layout = QtGui.QVBoxLayout()
self.label = QtGui.QLabel() self.label = QtGui.QLabel()
self.setLayout(self.main_layout) self.setLayout(self.main_layout)
self.plotWidget = pg.PlotWidget(title=title, autoDownsample=True) self.plotWidget = self.pg.PlotWidget(self.parent(), title=title, autoDownsample=True)
self.main_layout.addWidget(self.plotWidget) self.main_layout.addWidget(self.plotWidget)
self.main_layout.addWidget(self.label) self.main_layout.addWidget(self.label)
self.plotWidget.showGrid(x=False, y=True, alpha=0.2) 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')
self.wfstart, self.wfend = 0, 0 self.wfstart, self.wfend = 0, 0
self.pen_multicursor = self.pg.mkPen(self.parent()._style['multicursor']['rgba'])
self.pen_linecolor = self.pg.mkPen(self.parent()._style['linecolor']['rgba'])
self.reinitMoveProxy() self.reinitMoveProxy()
self._proxy = pg.SignalProxy(self.plotWidget.scene().sigMouseMoved, rateLimit=60, slot=self.mouseMoved) self._proxy = self.pg.SignalProxy(self.plotWidget.scene().sigMouseMoved, rateLimit=60, slot=self.mouseMoved)
def reinitMoveProxy(self): def reinitMoveProxy(self):
self.vLine = pg.InfiniteLine(angle=90, movable=False) self.vLine = self.pg.InfiniteLine(angle=90, movable=False, pen=self.pen_multicursor)
self.hLine = pg.InfiniteLine(angle=0, movable=False) self.hLine = self.pg.InfiniteLine(angle=0, movable=False, pen=self.pen_multicursor)
self.plotWidget.addItem(self.vLine, ignoreBounds=True) self.plotWidget.addItem(self.vLine, ignoreBounds=True)
self.plotWidget.addItem(self.hLine, ignoreBounds=True) self.plotWidget.addItem(self.hLine, ignoreBounds=True)
@ -467,10 +459,10 @@ class WaveformWidgetPG(QtGui.QWidget):
mousePoint = self.plotWidget.getPlotItem().vb.mapSceneToView(pos) mousePoint = self.plotWidget.getPlotItem().vb.mapSceneToView(pos)
x, y, = (mousePoint.x(), mousePoint.y()) x, y, = (mousePoint.x(), mousePoint.y())
# if x > 0:# and index < len(data1): # if x > 0:# and index < len(data1):
wfID = self._parent.getWFID(y) wfID = self.orig_parent.getWFID(y)
station = self._parent.getStationName(wfID) station = self.orig_parent.getStationName(wfID)
abstime = self.wfstart + x abstime = self.wfstart + x
if self._parent.get_current_event(): if self.orig_parent.get_current_event():
self.label.setText("station = {}, T = {}, t = {} [s]".format(station, abstime, x)) self.label.setText("station = {}, T = {}, t = {} [s]".format(station, abstime, x))
self.vLine.setPos(mousePoint.x()) self.vLine.setPos(mousePoint.x())
self.hLine.setPos(mousePoint.y()) self.hLine.setPos(mousePoint.y())
@ -484,12 +476,6 @@ class WaveformWidgetPG(QtGui.QWidget):
def clearPlotDict(self): def clearPlotDict(self):
self.plotdict = dict() self.plotdict = dict()
def getParent(self):
return self._parent
def setParent(self, parent):
self._parent = parent
def plotWFData(self, wfdata, title=None, zoomx=None, zoomy=None, def plotWFData(self, wfdata, title=None, zoomx=None, zoomy=None,
noiselevel=None, scaleddata=False, mapping=True, noiselevel=None, scaleddata=False, mapping=True,
component='*', nth_sample=1, iniPick=None, verbosity=0): component='*', nth_sample=1, iniPick=None, verbosity=0):
@ -610,7 +596,6 @@ class WaveformWidgetPG(QtGui.QWidget):
class PylotCanvas(FigureCanvas): class PylotCanvas(FigureCanvas):
def __init__(self, figure=None, parent=None, connect_events=True, multicursor=False, def __init__(self, figure=None, parent=None, connect_events=True, multicursor=False,
panZoomX=True, panZoomY=True): panZoomX=True, panZoomY=True):
self._parent = parent
if not figure: if not figure:
figure = Figure() figure = Figure()
# create axes # create axes
@ -618,17 +603,18 @@ class PylotCanvas(FigureCanvas):
self.axes = figure.axes self.axes = figure.axes
self.figure = figure self.figure = figure
self.figure.set_facecolor((1., 1., 1.)) self.figure.set_facecolor(parent._style['background']['rgba_mpl'])
# attribute plotdict is a dictionary connecting position and a name # attribute plotdict is a dictionary connecting position and a name
self.plotdict = dict() self.plotdict = dict()
# initialize super class # initialize super class
super(PylotCanvas, self).__init__(self.figure) super(PylotCanvas, self).__init__(self.figure)
self.setParent(parent)
if multicursor: if multicursor:
# add a cursor for station selection # add a cursor for station selection
self.multiCursor = MultiCursor(self.figure.canvas, self.axes, self.multiCursor = MultiCursor(self.figure.canvas, self.axes,
horizOn=True, useblit=True, horizOn=True, useblit=True,
color='m', lw=1) color=parent._style['multicursor']['rgba_mpl'], lw=1)
# initialize panning attributes # initialize panning attributes
self.press = None self.press = None
@ -743,7 +729,7 @@ class PylotCanvas(FigureCanvas):
def saveFigure(self): def saveFigure(self):
if self.figure: if self.figure:
fd = QtGui.QFileDialog() fd = QtGui.QFileDialog()
fname, filter = fd.getSaveFileName(self._parent, filter='Images (*.png)') fname, filter = fd.getSaveFileName(self.parent(), filter='Images (*.png)')
if not fname: if not fname:
return return
if not fname.endswith('.png'): if not fname.endswith('.png'):
@ -884,12 +870,6 @@ class PylotCanvas(FigureCanvas):
def clearPlotDict(self): def clearPlotDict(self):
self.plotdict = dict() self.plotdict = dict()
def getParent(self):
return self._parent
def setParent(self, parent):
self._parent = parent
def plotWFData(self, wfdata, title=None, zoomx=None, zoomy=None, def plotWFData(self, wfdata, title=None, zoomx=None, zoomy=None,
noiselevel=None, scaleddata=False, mapping=True, noiselevel=None, scaleddata=False, mapping=True,
component='*', nth_sample=1, iniPick=None, verbosity=0): component='*', nth_sample=1, iniPick=None, verbosity=0):
@ -922,6 +902,9 @@ class PylotCanvas(FigureCanvas):
nsc.sort() nsc.sort()
nsc.reverse() nsc.reverse()
style = self.parent()._style
linecolor = style['linecolor']['rgba_mpl']
for n, (network, station, channel) in enumerate(nsc): for n, (network, station, channel) in enumerate(nsc):
st = st_select.select(network=network, station=station, channel=channel) st = st_select.select(network=network, station=station, channel=channel)
trace = st[0] trace = st[0]
@ -942,11 +925,13 @@ class PylotCanvas(FigureCanvas):
trace.normalize(np.max(np.abs(trace.data)) * 2) trace.normalize(np.max(np.abs(trace.data)) * 2)
times = [time for index, time in enumerate(time_ax) if not index % nth_sample] times = [time for index, time in enumerate(time_ax) if not index % nth_sample]
data = [datum + n for index, datum in enumerate(trace.data) if not index % nth_sample] data = [datum + n for index, datum in enumerate(trace.data) if not index % nth_sample]
ax.plot(times, data, 'k', linewidth=0.7) ax.plot(times, data, color=linecolor, linewidth=0.7)
if noiselevel is not None: if noiselevel is not None:
for level in noiselevel: for level in noiselevel:
ax.plot([time_ax[0], time_ax[-1]], ax.plot([time_ax[0], time_ax[-1]],
[level, level], '--k') [level, level],
color = linecolor,
linestyle = 'dashed')
self.setPlotDict(n, (station, channel, network)) self.setPlotDict(n, (station, channel, network))
if iniPick: if iniPick:
ax.vlines(iniPick, ax.get_ylim()[0], ax.get_ylim()[1], ax.vlines(iniPick, ax.get_ylim()[0], ax.get_ylim()[1],
@ -1109,7 +1094,8 @@ class PickDlg(QDialog):
def __init__(self, parent=None, data=None, station=None, network=None, picks=None, def __init__(self, parent=None, data=None, station=None, network=None, picks=None,
autopicks=None, rotate=False, parameter=None, embedded=False, metadata=None, autopicks=None, rotate=False, parameter=None, embedded=False, metadata=None,
event=None, filteroptions=None, model='iasp91'): event=None, filteroptions=None, model='iasp91'):
super(PickDlg, self).__init__(parent) super(PickDlg, self).__init__(parent, 1)
self.orig_parent = parent
# initialize attributes # initialize attributes
self.parameter = parameter self.parameter = parameter
@ -1129,6 +1115,7 @@ class PickDlg(QDialog):
pylot_user = getpass.getuser() pylot_user = getpass.getuser()
self._user = settings.value('user/Login', pylot_user) self._user = settings.value('user/Login', pylot_user)
self._dirty = False self._dirty = False
self._style = parent._style
if picks: if picks:
self.picks = copy.deepcopy(picks) self.picks = copy.deepcopy(picks)
self._init_picks = picks self._init_picks = picks
@ -1525,36 +1512,46 @@ class PickDlg(QDialog):
self.leave_picking_mode() self.leave_picking_mode()
def init_p_pick(self): def init_p_pick(self):
self.set_button_color(self.p_button, 'yellow') self.set_button_border_color(self.p_button, 'yellow')
self.activatePicking() self.activatePicking()
self.currentPhase = str(self.p_button.text()) self.currentPhase = str(self.p_button.text())
def init_s_pick(self): def init_s_pick(self):
self.set_button_color(self.s_button, 'yellow') self.set_button_border_color(self.s_button, 'yellow')
self.activatePicking() self.activatePicking()
self.currentPhase = str(self.s_button.text()) self.currentPhase = str(self.s_button.text())
def getPhaseID(self, phase): def getPhaseID(self, phase):
return identifyPhaseID(phase) return identifyPhaseID(phase)
def set_button_color(self, button, color=None): def set_button_border_color(self, button, color=None):
'''
Set background color of a button.
button: type = QtGui.QAbstractButton
color: type = QtGui.QColor or type = str (RGBA)
'''
if type(color) == QtGui.QColor: if type(color) == QtGui.QColor:
button.setStyleSheet({'QPushButton{background-color:transparent}'})
palette = button.palette() palette = button.palette()
role = button.backgroundRole() role = button.backgroundRole()
palette.setColor(role, color) palette.setColor(role, color)
button.setPalette(palette) button.setPalette(palette)
button.setAutoFillBackground(True) button.setAutoFillBackground(True)
elif type(color) == str or not color: elif type(color) == str:
button.setStyleSheet("background-color: {}".format(color)) button.setStyleSheet('QPushButton{border-color: %s}' % color)
elif type(color) == tuple:
button.setStyleSheet('QPushButton{border-color: rgba%s}' % str(color))
elif not color:
button.setStyleSheet(self.orig_parent._style['stylesheet'])
def reset_p_button(self): def reset_p_button(self):
self.set_button_color(self.p_button) self.set_button_border_color(self.p_button)
self.p_button.setEnabled(True) self.p_button.setEnabled(True)
self.p_button.setChecked(False) self.p_button.setChecked(False)
self.p_button.setText('P') self.p_button.setText('P')
def reset_s_button(self): def reset_s_button(self):
self.set_button_color(self.s_button) self.set_button_border_color(self.s_button)
self.s_button.setEnabled(True) self.s_button.setEnabled(True)
self.s_button.setChecked(False) self.s_button.setChecked(False)
self.s_button.setText('S') self.s_button.setText('S')
@ -1693,10 +1690,10 @@ class PickDlg(QDialog):
self.cidpress = self.multicompfig.connectPressEvent(self.setPick) self.cidpress = self.multicompfig.connectPressEvent(self.setPick)
if self.getPhaseID(self.currentPhase) == 'P': if self.getPhaseID(self.currentPhase) == 'P':
self.set_button_color(self.p_button, 'green') self.set_button_border_color(self.p_button, 'green')
self.setIniPickP(gui_event, wfdata, trace_number) self.setIniPickP(gui_event, wfdata, trace_number)
elif self.getPhaseID(self.currentPhase) == 'S': elif self.getPhaseID(self.currentPhase) == 'S':
self.set_button_color(self.s_button, 'green') self.set_button_border_color(self.s_button, 'green')
self.setIniPickS(gui_event, wfdata) self.setIniPickS(gui_event, wfdata)
self.zoomAction.setEnabled(False) self.zoomAction.setEnabled(False)
@ -2438,11 +2435,10 @@ class TuneAutopicker(QWidget):
def __init__(self, parent): def __init__(self, parent):
QtGui.QWidget.__init__(self, parent, 1) QtGui.QWidget.__init__(self, parent, 1)
self.parent = parent self._style = parent._style
self.setParent(parent)
self.setWindowTitle('PyLoT - Tune Autopicker') self.setWindowTitle('PyLoT - Tune Autopicker')
self.parameter = parent._inputs self.parameter = self.parent()._inputs
self.fig_dict = parent.fig_dict self.fig_dict = self.parent().fig_dict
self.data = Data() self.data = Data()
self.init_main_layouts() self.init_main_layouts()
self.init_eventlist() self.init_eventlist()
@ -2455,8 +2451,8 @@ class TuneAutopicker(QWidget):
self.add_log() self.add_log()
self.set_stretch() self.set_stretch()
self.resize(1280, 720) self.resize(1280, 720)
if hasattr(parent, 'metadata'): if hasattr(self.parent(), 'metadata'):
self.metadata = self.parent.metadata self.metadata = self.parent().metadata
else: else:
self.metadata = None self.metadata = None
# self.setWindowModality(QtCore.Qt.WindowModality.ApplicationModal) # self.setWindowModality(QtCore.Qt.WindowModality.ApplicationModal)
@ -2473,7 +2469,7 @@ class TuneAutopicker(QWidget):
self.setLayout(self.main_layout) self.setLayout(self.main_layout)
def init_eventlist(self): def init_eventlist(self):
self.eventBox = self.parent.createEventBox() self.eventBox = self.parent().createEventBox()
self.eventBox.setMaxVisibleItems(20) self.eventBox.setMaxVisibleItems(20)
self.fill_eventbox() self.fill_eventbox()
self.trace_layout.addWidget(self.eventBox) self.trace_layout.addWidget(self.eventBox)
@ -2491,13 +2487,13 @@ class TuneAutopicker(QWidget):
self.stationBox.activated.connect(self.fill_tabs) self.stationBox.activated.connect(self.fill_tabs)
def fill_stationbox(self): def fill_stationbox(self):
fnames = self.parent.getWFFnames_from_eventbox(eventbox=self.eventBox) fnames = self.parent().getWFFnames_from_eventbox(eventbox=self.eventBox)
self.data.setWFData(fnames) self.data.setWFData(fnames)
wfdat = self.data.getWFData() # all available streams wfdat = self.data.getWFData() # all available streams
# trim station components to same start value # trim station components to same start value
trim_station_components(wfdat, trim_start=True, trim_end=False) trim_station_components(wfdat, trim_start=True, trim_end=False)
# rotate misaligned stations to ZNE # rotate misaligned stations to ZNE
wfdat = check4rotated(wfdat, self.parent.metadata, verbosity=0) wfdat = check4rotated(wfdat, self.parent().metadata, verbosity=0)
self.stationBox.clear() self.stationBox.clear()
stations = [] stations = []
for trace in self.data.getWFData(): for trace in self.data.getWFData():
@ -2511,7 +2507,7 @@ class TuneAutopicker(QWidget):
for network, station in stations: for network, station in stations:
item = QtGui.QStandardItem(network + '.' + station) item = QtGui.QStandardItem(network + '.' + station)
if station in self.get_current_event().pylot_picks: if station in self.get_current_event().pylot_picks:
item.setBackground(self.parent._colors['ref']) item.setBackground(self.parent()._ref_test_colors['ref'])
model.appendRow(item) model.appendRow(item)
def init_figure_tabs(self): def init_figure_tabs(self):
@ -2526,7 +2522,7 @@ class TuneAutopicker(QWidget):
self.stb_names = ['aicARHfig', 'refSpick', 'el_S1pick', 'el_S2pick'] self.stb_names = ['aicARHfig', 'refSpick', 'el_S1pick', 'el_S2pick']
def add_parameters(self): def add_parameters(self):
self.paraBox = PylotParaBox(self.parameter) self.paraBox = PylotParaBox(self.parameter, parent=self, windowflag=0)
self.paraBox.set_tune_mode(True) self.paraBox.set_tune_mode(True)
self.update_eventID() self.update_eventID()
self.parameter_layout.addWidget(self.paraBox) self.parameter_layout.addWidget(self.paraBox)
@ -2535,6 +2531,7 @@ class TuneAutopicker(QWidget):
def add_buttons(self): def add_buttons(self):
self.pick_button = QtGui.QPushButton('Pick Trace') self.pick_button = QtGui.QPushButton('Pick Trace')
self.pick_button.setStyleSheet('QPushButton{border-color: rgba(110, 200, 0, 255)}')
self.pick_button.clicked.connect(self.call_picker) self.pick_button.clicked.connect(self.call_picker)
self.close_button = QtGui.QPushButton('Close') self.close_button = QtGui.QPushButton('Close')
self.close_button.clicked.connect(self.hide) self.close_button.clicked.connect(self.hide)
@ -2552,7 +2549,7 @@ class TuneAutopicker(QWidget):
def get_current_event(self): def get_current_event(self):
path = self.eventBox.currentText() path = self.eventBox.currentText()
return self.parent.project.getEventFromPath(path) return self.parent().project.getEventFromPath(path)
def get_current_event_name(self): def get_current_event_name(self):
return self.eventBox.currentText().split('/')[-1] return self.eventBox.currentText().split('/')[-1]
@ -2583,40 +2580,42 @@ class TuneAutopicker(QWidget):
def gen_pick_dlg(self): def gen_pick_dlg(self):
if not self.get_current_event(): if not self.get_current_event():
self.pickDlg = None if self.pdlg_widget:
self.pdlg_widget.setParent(None)
self.pdlg_widget = None
return return
station = self.get_current_station() station = self.get_current_station()
data = self.data.getWFData() data = self.data.getWFData()
metadata = self.parent.metadata metadata = self.parent().metadata
event = self.get_current_event() event = self.get_current_event()
filteroptions = self.parent.filteroptions filteroptions = self.parent().filteroptions
pickDlg = PickDlg(self, data=data.select(station=station), self.pickDlg = PickDlg(self, data=data.select(station=station),
station=station, parameter=self.parameter, station=station, parameter=self.parameter,
picks=self.get_current_event_picks(station), picks=self.get_current_event_picks(station),
autopicks=self.get_current_event_autopicks(station), autopicks=self.get_current_event_autopicks(station),
metadata=metadata, event=event, filteroptions=filteroptions, metadata=metadata, event=event, filteroptions=filteroptions,
embedded=True) embedded=True)
pickDlg.update_picks.connect(self.picks_from_pickdlg) self.pickDlg.update_picks.connect(self.picks_from_pickdlg)
pickDlg.update_picks.connect(self.fill_eventbox) self.pickDlg.update_picks.connect(self.fill_eventbox)
pickDlg.update_picks.connect(self.fill_stationbox) self.pickDlg.update_picks.connect(self.fill_stationbox)
pickDlg.update_picks.connect(lambda: self.parent.setDirty(True)) self.pickDlg.update_picks.connect(lambda: self.parent().setDirty(True))
pickDlg.update_picks.connect(self.parent.enableSaveEventAction) self.pickDlg.update_picks.connect(self.parent().enableSaveEventAction)
self.pickDlg = QtGui.QWidget() self.pdlg_widget = QtGui.QWidget(self)
hl = QtGui.QHBoxLayout() hl = QtGui.QHBoxLayout()
self.pickDlg.setLayout(hl) self.pdlg_widget.setLayout(hl)
hl.addWidget(pickDlg) hl.addWidget(self.pickDlg)
def picks_from_pickdlg(self, picks=None): def picks_from_pickdlg(self, picks=None):
station = self.get_current_station() station = self.get_current_station()
replot = self.parent.addPicks(station, picks) replot = self.parent().addPicks(station, picks)
self.get_current_event().setPick(station, picks) self.get_current_event().setPick(station, picks)
if self.get_current_event() == self.parent.get_current_event(): if self.get_current_event() == self.parent().get_current_event():
if replot: if replot:
self.parent.plotWaveformDataThread() self.parent().plotWaveformDataThread()
self.parent.drawPicks() self.parent().drawPicks()
else: else:
self.parent.drawPicks(station) self.parent().drawPicks(station)
self.parent.draw() self.parent().draw()
def plot_manual_picks_to_figs(self): def plot_manual_picks_to_figs(self):
picks = self.get_current_event_picks(self.get_current_station()) picks = self.get_current_event_picks(self.get_current_station())
@ -2641,13 +2640,13 @@ class TuneAutopicker(QWidget):
('el_S1pick', 0), ('el_S1pick', 0),
('el_S2pick', 0)] ('el_S2pick', 0)]
for p_ax in p_axes: for p_ax in p_axes:
axes = self.parent.fig_dict[p_ax[0]].axes axes = self.parent().fig_dict[p_ax[0]].axes
if not axes: if not axes:
continue continue
ax = axes[p_ax[1]] ax = axes[p_ax[1]]
self.plot_manual_Ppick_to_ax(ax, (picks['P']['mpp'] - starttime)) self.plot_manual_Ppick_to_ax(ax, (picks['P']['mpp'] - starttime))
for s_ax in s_axes: for s_ax in s_axes:
axes = self.parent.fig_dict[s_ax[0]].axes axes = self.parent().fig_dict[s_ax[0]].axes
if not axes: if not axes:
continue continue
ax = axes[s_ax[1]] ax = axes[s_ax[1]]
@ -2677,10 +2676,10 @@ class TuneAutopicker(QWidget):
def fill_tabs(self, event=None, picked=False): def fill_tabs(self, event=None, picked=False):
self.clear_all() self.clear_all()
canvas_dict = self.parent.canvas_dict
self.gen_pick_dlg() self.gen_pick_dlg()
canvas_dict = self.parent().canvas_dict
self.overview = self.gen_tab_widget('Overview', canvas_dict['mainFig']) self.overview = self.gen_tab_widget('Overview', canvas_dict['mainFig'])
id0 = self.figure_tabs.insertTab(0, self.pickDlg, 'Traces Plot') id0 = self.figure_tabs.insertTab(0, self.pdlg_widget, 'Traces Plot')
id1 = self.figure_tabs.insertTab(1, self.overview, 'Overview') id1 = self.figure_tabs.insertTab(1, self.overview, 'Overview')
id2 = self.figure_tabs.insertTab(2, self.p_tabs, 'P') id2 = self.figure_tabs.insertTab(2, self.p_tabs, 'P')
id3 = self.figure_tabs.insertTab(3, self.s_tabs, 'S') id3 = self.figure_tabs.insertTab(3, self.s_tabs, 'S')
@ -2723,12 +2722,12 @@ class TuneAutopicker(QWidget):
self.init_tab_names() self.init_tab_names()
def fill_eventbox(self): def fill_eventbox(self):
project = self.parent.project project = self.parent().project
if not project: if not project:
return return
# update own list # update own list
self.parent.fill_eventbox(eventBox=self.eventBox, select_events='ref') self.parent().fill_eventbox(eventBox=self.eventBox, select_events='ref')
index_start = self.parent.eventBox.currentIndex() index_start = self.parent().eventBox.currentIndex()
index = index_start index = index_start
if index == -1: if index == -1:
index += 1 index += 1
@ -2747,7 +2746,7 @@ class TuneAutopicker(QWidget):
if not index == index_start: if not index == index_start:
self.eventBox.activated.emit(index) self.eventBox.activated.emit(index)
# update parent # update parent
self.parent.fill_eventbox() self.parent().fill_eventbox()
def update_eventID(self): def update_eventID(self):
self.paraBox.boxes['eventID'].setText( self.paraBox.boxes['eventID'].setText(
@ -2769,7 +2768,8 @@ class TuneAutopicker(QWidget):
'locflag': 0, 'locflag': 0,
'savexml': False} 'savexml': False}
for key in self.fig_dict.keys(): for key in self.fig_dict.keys():
self.fig_dict[key].clear() if not key == 'plot_style':
self.fig_dict[key].clear()
self.ap_thread = Thread(self, autoPyLoT, arg=args, self.ap_thread = Thread(self, autoPyLoT, arg=args,
progressText='Picking trace...', progressText='Picking trace...',
pb_widget=self.pb_widget, pb_widget=self.pb_widget,
@ -2810,8 +2810,8 @@ class TuneAutopicker(QWidget):
def params_from_gui(self): def params_from_gui(self):
parameters = self.paraBox.params_from_gui() parameters = self.paraBox.params_from_gui()
if self.parent: if self.parent():
self.parent._inputs = parameters self.parent()._inputs = parameters
return parameters return parameters
def set_stretch(self): def set_stretch(self):
@ -2819,10 +2819,11 @@ class TuneAutopicker(QWidget):
self.tune_layout.setStretch(1, 1) self.tune_layout.setStretch(1, 1)
def clear_all(self): def clear_all(self):
if hasattr(self, 'pickDlg'): if hasattr(self, 'pdlg_widget'):
if self.pickDlg: if self.pdlg_widget:
self.pickDlg.setParent(None) self.pdlg_widget.setParent(None)
del (self.pickDlg) # TODO: removing widget by parent deletion raises exception when activating stationbox:
# RuntimeError: Internal C++ object (PylotCanvas) already deleted.
if hasattr(self, 'overview'): if hasattr(self, 'overview'):
self.overview.setParent(None) self.overview.setParent(None)
if hasattr(self, 'p_tabs'): if hasattr(self, 'p_tabs'):
@ -2851,7 +2852,7 @@ class PylotParaBox(QtGui.QWidget):
accepted = QtCore.Signal(str) accepted = QtCore.Signal(str)
rejected = QtCore.Signal(str) rejected = QtCore.Signal(str)
def __init__(self, parameter, parent=None): def __init__(self, parameter, parent=None, windowflag=1):
''' '''
Generate Widget containing parameters for PyLoT. Generate Widget containing parameters for PyLoT.
@ -2859,7 +2860,7 @@ class PylotParaBox(QtGui.QWidget):
:type: PylotParameter (object) :type: PylotParameter (object)
''' '''
QtGui.QWidget.__init__(self, parent) QtGui.QWidget.__init__(self, parent, windowflag)
self.parameter = parameter self.parameter = parameter
self.tabs = QtGui.QTabWidget() self.tabs = QtGui.QTabWidget()
self.layout = QtGui.QVBoxLayout() self.layout = QtGui.QVBoxLayout()
@ -3424,6 +3425,7 @@ class SubmitLocal(QWidget):
class PropertiesDlg(QDialog): class PropertiesDlg(QDialog):
def __init__(self, parent=None, infile=None, inputs=None): def __init__(self, parent=None, infile=None, inputs=None):
super(PropertiesDlg, self).__init__(parent) super(PropertiesDlg, self).__init__(parent)
self._pylot_mainwindow = self.parent()
self.infile = infile self.infile = infile
self.inputs = inputs self.inputs = inputs
@ -3724,14 +3726,26 @@ class PhasesTab(PropTab):
class GraphicsTab(PropTab): class GraphicsTab(PropTab):
def __init__(self, parent=None): def __init__(self, parent=None):
super(GraphicsTab, self).__init__(parent) super(GraphicsTab, self).__init__(parent)
self.pylot_mainwindow = parent._pylot_mainwindow
self.init_layout() self.init_layout()
self.add_pg_cb() self.add_pg_cb()
self.add_nth_sample() self.add_nth_sample()
self.add_style_settings()
self.setLayout(self.main_layout) self.setLayout(self.main_layout)
def init_layout(self): def init_layout(self):
self.main_layout = QGridLayout() self.main_layout = QGridLayout()
def add_style_settings(self):
styles = self.pylot_mainwindow._styles
label = QtGui.QLabel('Application style (might require Application restart):')
self.style_cb = QComboBox()
for stylename, style in styles.items():
self.style_cb.addItem(stylename, style)
self.main_layout.addWidget(label, 2, 0)
self.main_layout.addWidget(self.style_cb, 2, 1)
self.style_cb.activated.connect(self.set_current_style)
def add_nth_sample(self): def add_nth_sample(self):
settings = QSettings() settings = QSettings()
nth_sample = settings.value("nth_sample") nth_sample = settings.value("nth_sample")
@ -3748,6 +3762,12 @@ class GraphicsTab(PropTab):
self.main_layout.addWidget(self.spinbox_nth_sample, 1, 1) self.main_layout.addWidget(self.spinbox_nth_sample, 1, 1)
def add_pg_cb(self): def add_pg_cb(self):
try:
import pyqtgraph as pg
pg = True
except:
pg = False
text = {True: 'Use pyqtgraphic library for plotting', text = {True: 'Use pyqtgraphic library for plotting',
False: 'Cannot use library: pyqtgraphic not found on system'} False: 'Cannot use library: pyqtgraphic not found on system'}
label = QLabel('PyQt graphic') label = QLabel('PyQt graphic')
@ -3759,6 +3779,10 @@ class GraphicsTab(PropTab):
self.main_layout.addWidget(label, 0, 0) self.main_layout.addWidget(label, 0, 0)
self.main_layout.addWidget(self.checkbox_pg, 0, 1) self.main_layout.addWidget(self.checkbox_pg, 0, 1)
def set_current_style(self):
selected_style = self.style_cb.currentText()
self.pylot_mainwindow.set_style(selected_style)
def getValues(self): def getValues(self):
values = {'nth_sample': self.spinbox_nth_sample.value(), values = {'nth_sample': self.spinbox_nth_sample.value(),
'pyqtgraphic': self.checkbox_pg.isChecked()} 'pyqtgraphic': self.checkbox_pg.isChecked()}

1
pylot/styles/__init__.py Normal file
View File

@ -0,0 +1 @@
# -*- coding: utf-8 -*-

248
pylot/styles/bright.qss Normal file
View File

@ -0,0 +1,248 @@
QMainWindow{
background-color: qlineargradient(spread:reflect, x1:0, y1:0, x2:0, y2:0.5, stop:0 rgba(230, 230, 230, 255), stop:1 rgba(255, 255, 255, 255));
color: rgba(0, 0, 0, 255);
}
QWidget{
background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 rgba(235, 235, 235, 255), stop:1 rgba(230, 230, 230, 255));
color: rgba(0, 0, 0, 255);
}
QToolBar QWidget:checked{
background-color: transparent;
border-color: rgba(230, 230, 230, 255);
border-width: 2px;
border-style:inset;
}
QComboBox{
background-color: rgba(255, 255, 255, 255);
color: rgba(0, 0, 0, 255);
min-height: 1.5em;
selection-background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 rgba(0, 55, 140, 150), stop:1 rgba(0, 70, 180, 150));
}
QComboBox *{
background-color: rgba(255, 255, 255, 255);
color: rgba(0, 0, 0, 255);
selection-background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 rgba(0, 55, 140, 150), stop:1 rgba(0, 70, 180, 150));
selection-color: rgba(255, 255, 255, 255);
}
QMenuBar{
background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:2, stop:0 rgba(240, 240, 240, 255), stop:1 rgba(230, 230, 230, 255));
padding:1px;
}
QMenuBar::item{
background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:2, stop:0 rgba(240, 240, 240, 255), stop:1 rgba(230, 230, 230, 255));
color: rgba(0, 0, 0, 255);
padding:3px;
padding-left:5px;
padding-right:5px;
}
QMenu{
background-color: qlineargradient(spread:reflect, x1:0, y1:0, x2:0, y2:0.5, stop:0 rgba(230, 230, 230, 255), stop:1 rgba(230, 230, 230 255));
color: rgba(0, 0, 0, 255);
padding:0;
}
*::item:selected{
color: rgba(0, 0, 0, 255);
background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 rgba(0, 55, 140, 150), stop:1 rgba(0, 70, 180, 150));
}
QToolBar{
background-color: qlineargradient(spread:reflect, x1:0, y1:0, x2:0, y2:0.5, stop:0 rgba(230, 230, 230, 255), stop:1 rgba(255, 255, 255, 255));
border-style:solid;
border-color:rgba(200, 200, 200, 150);
border-width:1px;
}
QToolBar *{
background-color: qlineargradient(spread:reflect, x1:0, y1:0, x2:0, y2:0.5, stop:0 rgba(230, 230, 230, 255), stop:1 rgba(255, 255, 255, 255));
}
QMessageBox{
background-color: rgba(255, 255, 255, 255);
color: rgba(0, 0, 0, 255);
}
QTableWidget{
background-color: rgba(255, 255, 255, 255);
color:rgba(0, 0, 0, 255);
border-color:rgba(0, 0, 0, 255);
selection-background-color: rgba(200, 210, 230, 255);
}
QTableCornerButton::section{
border: none;
background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 rgba(255, 255, 255, 255), stop:1 rgba(230, 230, 230, 255));
}
QHeaderView::section{
background-color:qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 rgba(255, 255, 255, 255), stop:1 rgba(230, 230, 230, 255));
border:none;
border-top-style:solid;
border-width:1px;
border-top-color:qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 rgba(255, 255, 255, 255), stop:1 rgba(230, 230, 230, 255));
color:rgba(0, 0, 0, 255);
padding:5px;
}
QHeaderView::section:checked{
background-color:qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 rgba(0, 55, 140, 150), stop:1 rgba(0, 70, 180, 150));
border-top-color:qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 rgba(0, 55, 140, 150), stop:1 rgba(0, 70, 180, 150));
}
QHeaderView{
background-color:qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 rgba(255, 255, 255, 255), stop:1 rgba(230, 230, 230, 255));
border:none;
border-top-style:solid;
border-width:1px;
border-top-color:rgba(230, 230, 230, 255);
color:rgba(0, 0, 0, 255);
}
QListWidget{
background-color:rgba(230, 230, 230, 255);
color:rgba(0, 0, 0, 255);
}
QStatusBar{
background-color:rgba(255, 255, 255, 255);
color:rgba(0, 0, 0, 255);
}
QPushButton{
background-color:qlineargradient(spread:reflect, x1:0, y1:0, x2:0, y2:0.5, stop:0 rgba(230, 230, 230, 255), stop:1 rgba(245, 245, 245, 255));
color:rgba(0, 0, 0, 255);
border-style: outset;
border-width: 1px;
border-color: rgba(100, 100, 120, 255);
min-width: 6em;
padding: 4px;
padding-left:5px;
padding-right:5px;
border-radius: 2px;
}
QPushButton:pressed{
background-color: rgba(230, 230, 230, 255);
}
*:disabled{
color:rgba(100, 100, 120, 255);
}
QTabBar{
background-color:transparent;
}
QTabBar::tab{
background-color:qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 rgba(230, 230, 230, 255), stop:1 rgba(210, 210, 210, 255));
color: rgba(0, 0, 0, 255);
border-style:solid;
border-color:rgba(210, 210, 210 255);
border-bottom-color: transparent;
border-width:1px;
padding:5px;
}
QTabBar::tab:selected{
background-color:qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 rgba(255, 255, 255, 255), stop:1 rgba(245, 245, 245, 255));
color: rgba(0, 0, 0, 255);
border-style:solid;
border-color:rgba(245, 245, 245, 255);
border-bottom-color: transparent;
border-width:1px;
padding:5px;
}
QTabBar::tab:disabled{
background-color:qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 rgba(230, 230, 230, 255), stop:1 rgba(210, 210, 210, 255));
color: rgba(100, 100, 120, 255);
}
QTabWidget{
background-color:transparent;
}
QTabWidget::pane{
background-color:rgba(0, 0, 0, 255);
border-style:solid;
border-color:rgba(245, 245, 245, 255);
border-width:1px;
}
QTabWidget::tab{
background-color:rgba(255, 255, 255, 255);
}
QTabWidget > QWidget{
background-color: rgba(245, 245, 245, 255);
color: rgba(0, 0, 0, 255);
}
QScrollArea{
background: transparent;
}
QScrollArea>QWidget>QWidget{
background: transparent;
}
QLabel{
color: rgba(0, 0, 0, 255);
background-color: transparent;
}
QTextEdit{
color: rgba(0, 0, 0, 255);
background-color: rgba(255, 255, 255, 255);
}
QSpinBox{
color: rgba(0, 0, 0, 255);
background-color: rgba(255, 255, 255, 255);
}
QDoubleSpinBox{
color: rgba(0, 0, 0, 255);
background-color: rgba(255, 255, 255, 255);
}
QCheckBox{
background-color:transparent;
border:none;
}
QLineEdit{
background-color: rgba(255, 255, 255, 255);
border: 1px inset;
border-radius:0;
border-color: rgba(100, 100, 120, 255);
}
QLineEdit:disabled{
background-color: rgba(255, 255, 255, 255);
border: 1px inset;
border-radius:0;
border-color: rgba(200, 200, 200, 255);
}
QListWidget{
background-color:rgba(255, 255, 255, 255)
}
QProgressBar{
background-color:rgba(230, 230, 230, 255);
}
QProgressBar::chunk{
background-color:qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 rgba(0, 70, 180, 150), stop:1 transparent);
}

247
pylot/styles/dark.qss Normal file
View File

@ -0,0 +1,247 @@
QMainWindow{
background-color: qlineargradient(spread:reflect, x1:0, y1:0, x2:0, y2:0.5, stop:0 rgba(70, 70, 80, 255), stop:1 rgba(60, 60, 70, 255));
color: rgba(255, 255, 255, 255);
}
QWidget{
background-color: qlineargradient(spread:reflect, x1:0, y1:0, x2:0, y2:0.5, stop:0 rgba(70, 70, 80, 255), stop:1 rgba(60, 60, 70, 255));
color: rgba(255, 255, 255, 255);
}
QToolBar QWidget:checked{
background-color: transparent;
border-color: rgba(100, 100, 120, 255);
border-width: 2px;
border-style:inset;
}
QComboBox{
background-color: rgba(90, 90, 100, 255);
color: rgba(255, 255, 255, 255);
min-height: 1.5em;
selection-background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 rgba(0, 144, 180, 255), stop:1 rgba(0, 150, 190, 255));
}
QComboBox *{
background-color: rgba(90, 90, 100, 255);
color: rgba(255, 255, 255, 255);
selection-background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 rgba(0, 144, 180, 255), stop:1 rgba(0, 150, 190, 255));
selection-color: rgba(255, 255, 255, 255);
}
QMenuBar{
background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 rgba(70, 70, 80, 255), stop:1 rgba(60, 60, 70, 255));
padding:1px;
}
QMenuBar::item{
background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 rgba(70, 70, 80, 255), stop:1 rgba(60, 60, 70, 255));
color: rgba(255, 255, 255, 255);
padding:3px;
padding-left:5px;
padding-right:5px;
}
QMenu{
background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 rgba(70, 70, 80, 255), stop:1 rgba(60, 60, 70, 255));
color: rgba(255, 255, 255, 255);
padding:0;
}
*::item:selected{
color: rgba(255, 255, 255, 255);
background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 rgba(0, 144, 180, 255), stop:1 rgba(0, 150, 190, 255));
}
QToolBar{
background-color: qlineargradient(spread:reflect, x1:0, y1:0, x2:0, y2:0.5, stop:0 rgba(70, 70, 80, 255), stop:1 rgba(60, 60, 70, 255));
border-style:solid;
border-color:rgba(80, 80, 90, 255);
border-width:1px;
}
QToolBar *{
background-color: qlineargradient(spread:reflect, x1:0, y1:0, x2:0, y2:0.5, stop:0 rgba(70, 70, 80, 255), stop:1 rgba(60, 60, 70, 255));
}
QMessageBox{
background-color: rgba(60, 60, 70, 255);
color: rgba(255, 255, 255, 255);
}
QTableWidget{
background-color: rgba(80, 80, 90, 255);
color:rgba(255, 255, 255, 255);
border-color:rgba(255, 255, 255, 255);
selection-background-color: rgba(200, 210, 230, 255);
}
QTableCornerButton::section{
border: none;
background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 rgba(60, 60, 70, 255), stop:1 rgba(70, 70, 80, 255));
}
QHeaderView::section{
background-color:qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 rgba(60, 60, 70, 255), stop:1 rgba(70, 70, 80, 255));
border:none;
border-top-style:solid;
border-width:1px;
border-top-color:qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 rgba(60, 60, 70, 255), stop:1 rgba(70, 70, 80, 255));
color:rgba(255, 255, 255, 255);
padding:5px;
}
QHeaderView::section:checked{
background-color:qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 rgba(0, 120, 150, 255), stop:1 rgba(0, 150, 190, 255));
border-top-color:qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 rgba(0, 120, 150, 255), stop:1 rgba(0, 150, 190, 255));
}
QHeaderView{
background-color:qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 rgba(60, 60, 70, 255), stop:1 rgba(70, 70, 80, 255));
border:none;
border-top-style:solid;
border-width:1px;
border-top-color:rgba(70, 70, 80, 255);
color:rgba(255, 255, 255, 255);
}
QListWidget{
background-color:rgba(200, 200, 200, 255);
color:rgba(255, 255, 255, 255);
}
QStatusBar{
background-color:rgba(60, 60, 70, 255);
color:rgba(255, 255, 255, 255);
}
QPushButton{
background-color:qlineargradient(spread:reflect, x1:0, y1:0, x2:0, y2:0.5, stop:0 rgba(70, 70, 80, 255), stop:1 rgba(60, 60, 70, 255));
color:rgba(255, 255, 255, 255);
border-style: outset;
border-width: 2px;
border-color: rgba(50, 50, 60, 255);
min-width: 6em;
padding: 4px;
padding-left:5px;
padding-right:5px;
border-radius: 2px;
}
QPushButton:pressed{
background-color: qlineargradient(spread:reflect, x1:0, y1:0, x2:0, y2:0.5, stop:0 rgba(80, 80, 90, 255), stop:1 rgba(70, 70, 80, 255));
}
*:disabled{
color:rgba(100, 100, 120, 255);
}
QTabBar{
background-color:transparent;
}
QTabBar::tab{
background-color:qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 rgba(70, 70, 80, 255), stop:1 rgba(60, 60, 70, 255));
color: rgba(255, 255, 255, 255);
border-style:solid;
border-color:rgba(70, 70, 80, 255);
border-bottom-color: transparent;
border-width:1px;
padding:5px;
}
QTabBar::tab:selected{
background-color:qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 rgba(80, 80, 90, 255), stop:1 rgba(70, 70, 80, 255));
color: rgba(255, 255, 255, 255);
border-style:solid;
border-color:rgba(70, 70, 80, 255);
border-bottom-color: transparent;
border-width:1px;
padding:5px;
}
QTabBar::tab:disabled{
background-color:qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 rgba(70, 70, 80, 255), stop:1 rgba(60, 60, 70, 255));
color: rgba(100, 100, 120, 255);
}
QTabWidget{
background-color:transparent;
}
QTabWidget::pane{
background-color:rgba(70, 70, 80, 255);
border-style:solid;
border-color:rgba(70, 70, 80, 255);
border-width:1px;
}
QTabWidget::tab{
background-color:rgba(70, 70, 80, 255);
}
QTabWidget > QWidget{
background-color: rgba(70, 70, 80, 255);
color: rgba(255, 255, 255, 255);
}
QScrollArea{
background: transparent;
}
QScrollArea>QWidget>QWidget{
background: transparent;
}
QLabel{
color: rgba(255, 255, 255, 255);
background-color: transparent;
}
QTextEdit{
color: rgba(255, 255, 255, 255);
background-color: rgba(90, 90, 100, 255);
}
QSpinBox{
color: rgba(255, 255, 255, 255);
background-color: rgba(90, 90, 100, 255);
}
QDoubleSpinBox{
color: rgba(255, 255, 255, 255);
background-color: rgba(90, 90, 100, 255);
}
QCheckBox{
background-color:transparent;
border:none;
}
QLineEdit{
background-color: rgba(90, 90, 100, 255);
border: 1px inset;
border-radius:0;
border-color: rgba(100, 100, 120, 255);
}
QLineEdit:disabled{
background-color: rgba(90, 90, 100, 255);
border: 1px inset;
border-radius:0;
border-color: rgba(200, 200, 200, 255);
}
QListWidget{
background-color:rgba(60, 60, 70, 255)
}
QProgressBar{
background-color:rgba(60, 60, 70, 255);
}
QProgressBar::chunk{
background-color:qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 rgba(0, 150, 190, 255), stop:1 transparent);
}

View File

@ -0,0 +1,70 @@
# -*- coding: utf-8 -*-
# Set base phase colors for manual and automatic picks
# together with a modifier (r, g, or b) used to alternate
# the base color
phasecolors = {
'manual': {
'P':{
'rgba': (0, 0, 255, 255),
'modifier': 'g'},
'S':{
'rgba': (255, 0, 0, 255),
'modifier': 'b'}
},
'auto':{
'P':{
'rgba': (140, 0, 255, 255),
'modifier': 'g'},
'S':{
'rgba': (255, 140, 0, 255),
'modifier': 'b'}
}
}
# Set plot colors and stylesheet for each style
stylecolors = {
'default':{
'linecolor':{
'rgba': (0, 0, 0, 255)},
'background': {
'rgba': (255, 255, 255, 255)},
'multicursor': {
'rgba': (255, 190, 0, 255)},
'ref': {
'rgba': (200, 210, 230, 255)},
'test': {
'rgba': (200, 230, 200, 255)},
'stylesheet': {
'filename': None}
},
'dark': {
'linecolor': {
'rgba': (230, 230, 230, 255)},
'background': {
'rgba': (50, 50, 60, 255)},
'multicursor': {
'rgba': (0, 150, 190, 255)},
'ref': {
'rgba': (80, 110, 170, 255)},
'test': {
'rgba': (130, 190, 100, 255)},
'stylesheet': {
'filename': 'pylot/styles/dark.qss'}
},
'bright': {
'linecolor': {
'rgba': (0, 0, 0, 255)},
'background': {
'rgba': (255, 255, 255, 255)},
'multicursor': {
'rgba': (100, 100, 190, 255)},
'ref': {
'rgba': (200, 210, 230, 255)},
'test': {
'rgba': (200, 230, 200, 255)},
'stylesheet': {
'filename': 'pylot/styles/bright.qss'}
}
}