started implementation of NLLoc properties selection into manualPyLoT; new utility routine to find indices throughout QComboBox' items
This commit is contained in:
parent
82089a6490
commit
386131e9f3
@ -771,7 +771,7 @@ class MainWindow(QMainWindow):
|
||||
extlocpath = settings.value("%s/binPath".format(loctool), None)
|
||||
locroot = settings.value("%s/rootPath".format(loctool), None)
|
||||
if extlocpath is None or locroot is None:
|
||||
pass
|
||||
self.PyLoTprefs()
|
||||
|
||||
def check4Loc(self):
|
||||
return self.picksNum() > 4
|
||||
|
@ -7,6 +7,9 @@ Created on Wed Feb 26 12:31:25 2014
|
||||
"""
|
||||
|
||||
import os
|
||||
from pylot.core.loc import nll
|
||||
from pylot.core.loc import hsat
|
||||
from pylot.core.loc import velest
|
||||
|
||||
def readFilterInformation(fname):
|
||||
def convert2FreqRange(*args):
|
||||
@ -41,3 +44,5 @@ FILTERDEFAULTS = readFilterInformation(os.path.join(os.path.expanduser('~'),
|
||||
OUTPUTFORMATS = {'.xml':'QUAKEML',
|
||||
'.cnv':'CNV',
|
||||
'.obs':'NLLOC_OBS'}
|
||||
|
||||
LOCTOOLS = dict(nll = nll, hsat = hsat, velest = velest)
|
||||
|
@ -365,6 +365,18 @@ def createAmplitude(pickID, amp, unit, category, cinfo):
|
||||
amplitude.pick_id = pickID
|
||||
return amplitude
|
||||
|
||||
def findComboBoxIndex(combo_box, val):
|
||||
"""
|
||||
Function findComboBoxIndex takes a QComboBox object and a string and
|
||||
returns either 0 or the index throughout all QComboBox items.
|
||||
:param combo_box: Combo box object.
|
||||
:type combo_box: QComboBox
|
||||
:param val: Name of a combo box to search for.
|
||||
:return: index value of item with name val or 0
|
||||
"""
|
||||
|
||||
return combo_box.findText(val) if combo_box.findText(val) is not -1 else 0
|
||||
|
||||
if __name__ == "__main__":
|
||||
import doctest
|
||||
doctest.testmod()
|
||||
|
@ -25,9 +25,9 @@ from obspy import Stream, UTCDateTime
|
||||
from pylot.core.read.inputs import FilterOptions
|
||||
from pylot.core.pick.utils import getSNR, earllatepicker, getnoisewin,\
|
||||
getResolutionWindow
|
||||
from pylot.core.util.defaults import OUTPUTFORMATS, FILTERDEFAULTS
|
||||
from pylot.core.util.defaults import OUTPUTFORMATS, FILTERDEFAULTS, LOCTOOLS
|
||||
from pylot.core.util.utils import prepTimeAxis, getGlobalTimes, scaleWFData, \
|
||||
demeanTrace, isSorted
|
||||
demeanTrace, isSorted, findComboBoxIndex
|
||||
|
||||
|
||||
def createAction(parent, text, slot=None, shortcut=None, icon=None,
|
||||
@ -886,10 +886,7 @@ class OutputsTab(PropTab):
|
||||
eventoutputformats = OUTPUTFORMATS.keys()
|
||||
self.eventOutputComboBox.addItems(eventoutputformats)
|
||||
|
||||
if curval is None:
|
||||
ind = 0
|
||||
else:
|
||||
ind = self.eventOutputComboBox.findText(curval)
|
||||
ind = findComboBoxIndex(self.eventOutputComboBox, curval)
|
||||
|
||||
self.eventOutputComboBox.setCurrentIndex(ind)
|
||||
layout = QGridLayout()
|
||||
@ -917,6 +914,25 @@ class GraphicsTab(PropTab):
|
||||
pass
|
||||
|
||||
|
||||
class LocalisationTab(PropTab):
|
||||
def __init__(self, parent=None):
|
||||
super(LocalisationTab, self).__init__(parent)
|
||||
|
||||
settings = QSettings()
|
||||
curtool = settings.value("loc/tool", None)
|
||||
|
||||
loctoollabel = QLabel("location tool")
|
||||
self.locToolComboBox = QComboBox()
|
||||
loctools = LOCTOOLS.keys()
|
||||
self.locToolComboBox.addItems(loctools)
|
||||
|
||||
toolind = findComboBoxIndex(self.locToolComboBox, curtool)
|
||||
|
||||
self.locToolComboBox.setCurrentIndex(toolind)
|
||||
|
||||
curroot = settings.value("loc/tool", None)
|
||||
|
||||
|
||||
class NewEventDlg(QDialog):
|
||||
def __init__(self, parent=None, titleString="Create a new event"):
|
||||
"""
|
||||
|
Loading…
Reference in New Issue
Block a user