mirror of
https://github.com/qgis/QGIS.git
synced 2025-12-15 00:07:25 -05:00
[processing] Search for description files also in the sub-directories of the script/model directory
This commit is contained in:
parent
8499b4d07c
commit
3799f115b4
@ -88,16 +88,17 @@ class RAlgorithmProvider(AlgorithmProvider):
|
||||
def loadFromFolder(self, folder):
|
||||
if not os.path.exists(folder):
|
||||
return
|
||||
for descriptionFile in os.listdir(folder):
|
||||
if descriptionFile.endswith('rsx'):
|
||||
try:
|
||||
fullpath = os.path.join(folder, descriptionFile)
|
||||
alg = RAlgorithm(fullpath)
|
||||
if alg.name.strip() != '':
|
||||
self.algs.append(alg)
|
||||
except WrongScriptException, e:
|
||||
ProcessingLog.addToLog(ProcessingLog.LOG_ERROR, e.msg)
|
||||
except Exception, e:
|
||||
ProcessingLog.addToLog(ProcessingLog.LOG_ERROR,
|
||||
'Could not load R script:' + descriptionFile + '\n'
|
||||
+ unicode(e))
|
||||
for path, subdirs, files in os.walk(folder):
|
||||
for descriptionFile in files:
|
||||
if descriptionFile.endswith('rsx'):
|
||||
try:
|
||||
fullpath = os.path.join(path, descriptionFile)
|
||||
alg = RAlgorithm(fullpath)
|
||||
if alg.name.strip() != '':
|
||||
self.algs.append(alg)
|
||||
except WrongScriptException, e:
|
||||
ProcessingLog.addToLog(ProcessingLog.LOG_ERROR, e.msg)
|
||||
except Exception, e:
|
||||
ProcessingLog.addToLog(ProcessingLog.LOG_ERROR,
|
||||
'Could not load R script:' + descriptionFile + '\n'
|
||||
+ unicode(e))
|
||||
|
||||
@ -80,16 +80,17 @@ class ModelerAlgorithmProvider(AlgorithmProvider):
|
||||
def loadFromFolder(self, folder):
|
||||
if not os.path.exists(folder):
|
||||
return
|
||||
for descriptionFile in os.listdir(folder):
|
||||
if descriptionFile.endswith('model'):
|
||||
try:
|
||||
alg = ModelerAlgorithm()
|
||||
fullpath = os.path.join(folder, descriptionFile)
|
||||
alg.openModel(fullpath)
|
||||
if alg.name.strip() != '':
|
||||
alg.provider = self
|
||||
self.algs.append(alg)
|
||||
except WrongModelException, e:
|
||||
ProcessingLog.addToLog(ProcessingLog.LOG_ERROR,
|
||||
'Could not load model ' + descriptionFile + '\n'
|
||||
+ e.msg)
|
||||
for path, subdirs, files in os.walk(folder):
|
||||
for descriptionFile in files:
|
||||
if descriptionFile.endswith('model'):
|
||||
try:
|
||||
alg = ModelerAlgorithm()
|
||||
fullpath = os.path.join(path, descriptionFile)
|
||||
alg.openModel(fullpath)
|
||||
if alg.name.strip() != '':
|
||||
alg.provider = self
|
||||
self.algs.append(alg)
|
||||
except WrongModelException, e:
|
||||
ProcessingLog.addToLog(ProcessingLog.LOG_ERROR,
|
||||
'Could not load model ' + descriptionFile + '\n'
|
||||
+ e.msg)
|
||||
|
||||
@ -82,16 +82,17 @@ class ScriptAlgorithmProvider(AlgorithmProvider):
|
||||
def loadFromFolder(self, folder):
|
||||
if not os.path.exists(folder):
|
||||
return
|
||||
for descriptionFile in os.listdir(folder):
|
||||
if descriptionFile.endswith('py'):
|
||||
try:
|
||||
fullpath = os.path.join(folder, descriptionFile)
|
||||
alg = ScriptAlgorithm(fullpath)
|
||||
if alg.name.strip() != '':
|
||||
self.algs.append(alg)
|
||||
except WrongScriptException, e:
|
||||
ProcessingLog.addToLog(ProcessingLog.LOG_ERROR, e.msg)
|
||||
except Exception, e:
|
||||
ProcessingLog.addToLog(ProcessingLog.LOG_ERROR,
|
||||
'Could not load script:' + descriptionFile + '\n'
|
||||
+ unicode(e))
|
||||
for path, subdirs, files in os.walk(folder):
|
||||
for descriptionFile in files:
|
||||
if descriptionFile.endswith('py'):
|
||||
try:
|
||||
fullpath = os.path.join(path, descriptionFile)
|
||||
alg = ScriptAlgorithm(fullpath)
|
||||
if alg.name.strip() != '':
|
||||
self.algs.append(alg)
|
||||
except WrongScriptException, e:
|
||||
ProcessingLog.addToLog(ProcessingLog.LOG_ERROR, e.msg)
|
||||
except Exception, e:
|
||||
ProcessingLog.addToLog(ProcessingLog.LOG_ERROR,
|
||||
'Could not load script:' + descriptionFile + '\n'
|
||||
+ unicode(e))
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user