Skip to content
Permalink
Browse files

[processing] prevent otb algorithms being run if otb not configured

fixes #13215
  • Loading branch information
volaya committed Sep 30, 2015
1 parent 1d67ce7 commit ea712c6c231ab98a5ce47fdf9ab56574e9105d57
@@ -166,15 +166,17 @@ def defineCharacteristicsFromFile(self):
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 @@ def executeOtb(commands, progress):

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 == '':

0 comments on commit ea712c6

Please sign in to comment.
You can’t perform that action at this time.