[refs #137] bugfix in widgets.py badly formatted string corrupted load of settings; added a functionality to utils' which function to also look for NLLoc installation in the settings' binary path
This commit is contained in:
parent
b29c7068e3
commit
30ccd331d4
@ -904,15 +904,16 @@ class MainWindow(QMainWindow):
|
|||||||
lt = locateTool[loctool]
|
lt = locateTool[loctool]
|
||||||
# get working directory
|
# get working directory
|
||||||
locroot = settings.value("{0}/rootPath".format(loctool), None)
|
locroot = settings.value("{0}/rootPath".format(loctool), None)
|
||||||
|
if locroot is None:
|
||||||
|
self.PyLoTprefs()
|
||||||
|
self.locateEvent()
|
||||||
infile = settings.value("{0}/inputFile".format(loctool), None)
|
infile = settings.value("{0}/inputFile".format(loctool), None)
|
||||||
outfile = settings.value("{0}/outputFile".format(loctool), None)
|
outfile = settings.value("{0}/outputFile".format(loctool), None)
|
||||||
phasepath = os.tempnam(os.path.join(locroot, 'obs'), loctool)
|
phasepath = os.tempnam(os.path.join(locroot, 'obs'), loctool)
|
||||||
|
phasefile = os.path.split(phasepath)[-1]
|
||||||
locpath = os.path.join(locroot, 'loc', outfile)
|
locpath = os.path.join(locroot, 'loc', outfile)
|
||||||
lt.export(self.getPicks(), phasepath)
|
lt.export(self.getPicks(), phasepath)
|
||||||
phasefile = os.path.split(phasepath)[-1]
|
lt.modify_inputs(infile, locroot, outfile, phasefile, )
|
||||||
args = lt.modify_inputs(infile, locroot, outfile, phasefile, )
|
|
||||||
if locroot is None:
|
|
||||||
self.PyLoTprefs()
|
|
||||||
try:
|
try:
|
||||||
lt.locate(infile)
|
lt.locate(infile)
|
||||||
except RuntimeError as e:
|
except RuntimeError as e:
|
||||||
|
@ -407,10 +407,18 @@ def runProgram(cmd, parameter=None):
|
|||||||
def which(program):
|
def which(program):
|
||||||
"""
|
"""
|
||||||
takes a program name and returns the full path to the executable or None
|
takes a program name and returns the full path to the executable or None
|
||||||
found on: http://stackoverflow.com/questions/377017/test-if-executable-exists-in-python
|
modified after: http://stackoverflow.com/questions/377017/test-if-executable-exists-in-python
|
||||||
:param program: name of the desired external program
|
:param program: name of the desired external program
|
||||||
:return: full path of the executable file
|
:return: full path of the executable file
|
||||||
"""
|
"""
|
||||||
|
try:
|
||||||
|
from PySide.QtCore import QSettings
|
||||||
|
settings = QSettings()
|
||||||
|
for key in settings.allKeys():
|
||||||
|
if 'binPath' in key:
|
||||||
|
os.environ['PATH'] += ':{0}'.format(settings.value(key))
|
||||||
|
except ImportError as e:
|
||||||
|
print(e.message)
|
||||||
|
|
||||||
def is_exe(fpath):
|
def is_exe(fpath):
|
||||||
return os.path.exists(fpath) and os.access(fpath, os.X_OK)
|
return os.path.exists(fpath) and os.access(fpath, os.X_OK)
|
||||||
|
@ -1337,8 +1337,8 @@ class LocalisationTab(PropTab):
|
|||||||
|
|
||||||
self.locToolComboBox.setCurrentIndex(toolind)
|
self.locToolComboBox.setCurrentIndex(toolind)
|
||||||
|
|
||||||
curroot = settings.value("%s/rootPath".format(curtool), None)
|
curroot = settings.value("{0}/rootPath".format(curtool), None)
|
||||||
curbin = settings.value("%s/binPath".format(curtool), None)
|
curbin = settings.value("{0}/binPath".format(curtool), None)
|
||||||
|
|
||||||
self.rootlabel = QLabel("root directory")
|
self.rootlabel = QLabel("root directory")
|
||||||
self.binlabel = QLabel("bin directory")
|
self.binlabel = QLabel("bin directory")
|
||||||
@ -1385,8 +1385,8 @@ class LocalisationTab(PropTab):
|
|||||||
|
|
||||||
def getValues(self):
|
def getValues(self):
|
||||||
loctool = self.locToolComboBox.currentText()
|
loctool = self.locToolComboBox.currentText()
|
||||||
values = {"%s/rootPath".format(loctool): self.rootedit.text(),
|
values = {"{0}/rootPath".format(loctool): self.rootedit.text(),
|
||||||
"%s/binPath".format(loctool): self.binedit.text(),
|
"{0}/binPath".format(loctool): self.binedit.text(),
|
||||||
"loc/tool": loctool}
|
"loc/tool": loctool}
|
||||||
return values
|
return values
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user