[processing] more complete scope for expressions in outputs

This commit is contained in:
volaya 2016-04-25 14:19:26 +02:00
parent 7805c64208
commit e9a3089670

View File

@ -108,12 +108,18 @@ class OutputSelectionPanel(BASE, WIDGET):
def showExpressionsBuilder(self):
context = QgsExpressionContext()
context.appendScope(QgsExpressionContextUtils.projectScope())
context.appendScope(QgsExpressionContextUtils.globalScope())
scope = QgsExpressionContextUtils.projectScope()
self.addVariablesToScope(scope)
dlg = QgsExpressionBuilderDialog(None, self.leText.text(), self, "generic", context)
dlg.setWindowTitle(self.tr("Expression based output"));
if dlg.exec_() == QDialog.Accepted:
self.leText.setText(dlg.expressionText())
def addVariablesToScope(self, scope):
for param in self.ag.parameters:
scope.setVariable("%s_value" % param.name, "")
def saveToTemporaryFile(self):
self.leText.setText('')