Skip to content
Permalink
Browse files

Merge pull request #2840 from vpoughon/processing_plugin_otb_fixes

[processing] allow to specify OTB path manually even if default version detected
  • Loading branch information
alexbruy committed Feb 27, 2016
2 parents 6800c8d + 716b17d commit f55f5c6f27fa2f7e90d7850cdd777db2a5707843
@@ -86,16 +86,14 @@ def _loadAlgorithms(self):

def initializeSettings(self):
AlgorithmProvider.initializeSettings(self)
if OTBUtils.findOtbPath() is None:
ProcessingConfig.addSetting(Setting(self.getDescription(),
OTBUtils.OTB_FOLDER,
self.tr("OTB command line tools folder"), OTBUtils.otbPath(),
valuetype=Setting.FOLDER))
if OTBUtils.findOtbLibPath() is None:
ProcessingConfig.addSetting(Setting(self.getDescription(),
OTBUtils.OTB_LIB_FOLDER,
self.tr("OTB applications folder"), OTBUtils.otbLibPath(),
valuetype=Setting.FOLDER))
ProcessingConfig.addSetting(Setting(self.getDescription(),
OTBUtils.OTB_FOLDER,
self.tr("OTB command line tools folder"), OTBUtils.findOtbPath(),
valuetype=Setting.FOLDER))
ProcessingConfig.addSetting(Setting(self.getDescription(),
OTBUtils.OTB_LIB_FOLDER,
self.tr("OTB applications folder"), OTBUtils.findOtbLibPath(),
valuetype=Setting.FOLDER))
ProcessingConfig.addSetting(Setting(self.getDescription(),
OTBUtils.OTB_SRTM_FOLDER,
self.tr("SRTM tiles folder"), OTBUtils.otbSRTMPath(),
@@ -49,7 +49,7 @@


def findOtbPath():
folder = None
folder = ""
#try to configure the path automatically
if isMac():
testfolder = os.path.join(unicode(QgsApplication.prefixPath()), "bin")
@@ -72,14 +72,14 @@ def findOtbPath():


def otbPath():
folder = findOtbPath()
folder = ProcessingConfig.getSetting(OTB_FOLDER)
if folder is None:
folder = ProcessingConfig.getSetting(OTB_FOLDER)
folder = ""
return folder


def findOtbLibPath():
folder = None
folder = ""
#try to configure the path automatically
if isMac():
testfolder = os.path.join(unicode(QgsApplication.prefixPath()), "lib/otb/applications")
@@ -101,9 +101,9 @@ def findOtbLibPath():


def otbLibPath():
folder = findOtbLibPath()
folder = ProcessingConfig.getSetting(OTB_LIB_FOLDER)
if folder is None:
folder = ProcessingConfig.getSetting(OTB_LIB_FOLDER)
folder = ""
return folder


@@ -135,7 +135,7 @@ def getInstalledVersion(runOtb=False):
if _installedVersionFound and not runOtb:
return _installedVersion

if otbPath() is None:
if otbPath() is None or otbLibPath() is None:
_installedVersionFound = False
return None
commands = [os.path.join(otbPath(), "otbcli_Smoothing")]

0 comments on commit f55f5c6

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