Skip to content

Commit

Permalink
Merge pull request #2840 from vpoughon/processing_plugin_otb_fixes
Browse files Browse the repository at this point in the history
[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 f55f5c6
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 17 deletions.
18 changes: 8 additions & 10 deletions python/plugins/processing/algs/otb/OTBAlgorithmProvider.py
Expand Up @@ -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(),
Expand Down
14 changes: 7 additions & 7 deletions python/plugins/processing/algs/otb/OTBUtils.py
Expand Up @@ -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")
Expand All @@ -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")
Expand All @@ -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


Expand Down Expand Up @@ -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")]
Expand Down

0 comments on commit f55f5c6

Please sign in to comment.