mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-13 00:03:09 -04:00
[processing] prevent otb algorithms being run if otb not configured
fixes #13215
This commit is contained in:
parent
1d67ce7ca7
commit
ea712c6c23
@ -166,15 +166,17 @@ class OTBAlgorithm(GeoAlgorithm):
|
||||
self.tr('Could not open OTB algorithm: %s\n%s' % (self.descriptionFile, line)))
|
||||
raise e
|
||||
|
||||
def checkBeforeOpeningParametersDialog(self):
|
||||
return OTBUtils.checkOtbConfiguration()
|
||||
|
||||
def processAlgorithm(self, progress):
|
||||
currentOs = os.name
|
||||
|
||||
msg = OTBUtils.checkOtbConfiguration()
|
||||
if msg:
|
||||
raise GeoAlgorithmExecutionException(msg)
|
||||
|
||||
path = OTBUtils.otbPath()
|
||||
libpath = OTBUtils.otbLibPath()
|
||||
if path == "" or libpath == "":
|
||||
raise GeoAlgorithmExecutionException(
|
||||
self.tr('OTB folder is not configured. Please configure it '
|
||||
'before running OTB algorithms.'))
|
||||
|
||||
commands = []
|
||||
commands.append(path + os.sep + self.cliName)
|
||||
|
@ -144,6 +144,16 @@ class OTBUtils:
|
||||
|
||||
ProcessingLog.addToLog(ProcessingLog.LOG_INFO, loglines)
|
||||
|
||||
|
||||
@staticmethod
|
||||
def checkOtbConfiguration():
|
||||
path = OTBUtils.otbPath()
|
||||
libpath = OTBUtils.otbLibPath()
|
||||
configurationOk = bool(path) and bool(libpath)
|
||||
if not configurationOk:
|
||||
return OTBUtils.tr('OTB folder is not configured. Please configure it '
|
||||
'before running OTB algorithms.')
|
||||
|
||||
@staticmethod
|
||||
def tr(string, context=''):
|
||||
if context == '':
|
||||
|
Loading…
x
Reference in New Issue
Block a user