Skip to content

Commit

Permalink
Always enable OTB settings modification
Browse files Browse the repository at this point in the history
  • Loading branch information
vpoughon committed Feb 25, 2016
1 parent 02cd0f0 commit 716b17d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 16 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
12 changes: 6 additions & 6 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

0 comments on commit 716b17d

Please sign in to comment.