Navigation Menu

Skip to content

Commit

Permalink
improvement in saga and grass algorithms loading
Browse files Browse the repository at this point in the history
git-svn-id: http://sextante.googlecode.com/svn/trunk/soft/bindings/qgis-plugin@256 881b9c09-3ef8-f3c2-ec3d-21d735c97f4d
  • Loading branch information
volayaf committed Jun 19, 2012
1 parent e0b6ab5 commit ef82ced
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 13 deletions.
15 changes: 8 additions & 7 deletions src/sextante/grass/GrassAlgorithmProvider.py
Expand Up @@ -49,14 +49,15 @@ def createAlgsList(self):
self.preloadedAlgs = []
folder = GrassUtils.grassDescriptionPath()
for descriptionFile in os.listdir(folder):
try:
alg = GrassAlgorithm(os.path.join(folder, descriptionFile))
if alg.name.strip() != "":
self.preloadedAlgs.append(alg)
else:
if descriptionFile.endswith("txt"):
try:
alg = GrassAlgorithm(os.path.join(folder, descriptionFile))
if alg.name.strip() != "":
self.preloadedAlgs.append(alg)
else:
SextanteLog.addToLog(SextanteLog.LOG_ERROR, "Could not open GRASS algorithm: " + descriptionFile)
except Exception,e:
SextanteLog.addToLog(SextanteLog.LOG_ERROR, "Could not open GRASS algorithm: " + descriptionFile)
except Exception:
SextanteLog.addToLog(SextanteLog.LOG_ERROR, "Could not open GRASS algorithm: " + descriptionFile)
#self.preloadedAlgs.append(nviz())
#self.createDescriptionFiles()

Expand Down
15 changes: 9 additions & 6 deletions src/sextante/saga/SagaAlgorithmProvider.py
Expand Up @@ -42,12 +42,15 @@ def createAlgsList(self):
self.preloadedAlgs = []
folder = SagaUtils.sagaDescriptionPath()
for descriptionFile in os.listdir(folder):
try:
alg = SagaAlgorithm(os.path.join(folder, descriptionFile))
if alg.name.strip() != "":
self.preloadedAlgs.append(alg)
except Exception:
SextanteLog.addToLog(SextanteLog.LOG_ERROR, "Could not open SAGA algorithm: " + descriptionFile)
if descriptionFile.endswith("txt"):
try:
alg = SagaAlgorithm(os.path.join(folder, descriptionFile))
if alg.name.strip() != "":
self.preloadedAlgs.append(alg)
else:
SextanteLog.addToLog(SextanteLog.LOG_ERROR, "Could not open SAGA algorithm: " + descriptionFile)
except Exception,e:
SextanteLog.addToLog(SextanteLog.LOG_ERROR, "Could not open SAGA algorithm: " + descriptionFile)

def _loadAlgorithms(self):
self.algs = self.preloadedAlgs
Expand Down

0 comments on commit ef82ced

Please sign in to comment.