Skip to content
Permalink
Browse files

Fix executing processing scripts through script editor

  • Loading branch information
nyalldawson committed Jan 24, 2018
1 parent 0cc2956 commit 54f9846edab1d42b43be24c626e38d142f557b37
@@ -274,7 +274,8 @@ def setHasChanged(self, hasChanged):

def runAlgorithm(self):
if self.algType == self.SCRIPT_PYTHON:
alg = ScriptAlgorithm(None, self.editor.text())
alg = ScriptAlgorithm(None, script=self.editor.text())
alg.setProvider(QgsApplication.processingRegistry().providerById('script'))

dlg = alg.createCustomParametersWidget(self)
if not dlg:
@@ -79,7 +79,10 @@ def __init__(self, descriptionFile, script=None):
self.results = {}

def createInstance(self):
return ScriptAlgorithm(self.descriptionFile)
if self.descriptionFile is not None:
return ScriptAlgorithm(self.descriptionFile)
else:
return ScriptAlgorithm(descriptionFile=None, script=self.script)

def initAlgorithm(self, config=None):
pass
@@ -120,7 +123,7 @@ def defineCharacteristicsFromFile(self):
try:
self.processParameterLine(line.strip('\n'))
except:
self.error = self.tr('This script has a syntax errors.\n'
self.error = self.tr('This script has a syntax error.\n'
'Problem with line: {0}', 'ScriptAlgorithm').format(line)
self.script += line
line = lines.readline()

0 comments on commit 54f9846

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