mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-27 00:33:48 -05:00
Fix executing processing scripts through script editor
This commit is contained in:
parent
0cc29569f5
commit
54f9846eda
@ -274,7 +274,8 @@ class ScriptEditorDialog(BASE, WIDGET):
|
||||
|
||||
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 @@ class ScriptAlgorithm(QgsProcessingAlgorithm):
|
||||
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 @@ class ScriptAlgorithm(QgsProcessingAlgorithm):
|
||||
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()
|
||||
|
Loading…
x
Reference in New Issue
Block a user