Skip to content

Commit

Permalink
Expression parameters don't have to have parent layers
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Nov 11, 2016
1 parent 132e76a commit 5625d6e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
7 changes: 5 additions & 2 deletions python/plugins/processing/gui/wrappers.py
Expand Up @@ -36,7 +36,7 @@

from qgis.core import QgsCoordinateReferenceSystem, QgsVectorLayer
from qgis.PyQt.QtWidgets import QCheckBox, QComboBox, QLineEdit, QPlainTextEdit
from qgis.gui import QgsFieldExpressionWidget
from qgis.gui import QgsFieldExpressionWidget, QgsExpressionLineEdit
from qgis.PyQt.QtCore import pyqtSignal, QObject, QVariant

from processing.gui.NumberInputPanel import NumberInputPanel
Expand Down Expand Up @@ -714,7 +714,10 @@ class ExpressionWidgetWrapper(WidgetWrapper):

def createWidget(self):
if self.dialogType in (DIALOG_STANDARD, DIALOG_BATCH):
widget = QgsFieldExpressionWidget()
if self.param.parent_layer:
widget = QgsFieldExpressionWidget()
else:
widget = QgsExpressionLineEdit()
if self.param.default:
widget.setExpression(self.param.default)
else:
Expand Down
Expand Up @@ -210,7 +210,8 @@ def setupUi(self):

self.verticalLayout.addWidget(QLabel(self.tr('Parent layer')))
self.parentCombo = QComboBox()
idx = 0
self.parentCombo.addItem(self.tr("None"), None)
idx = 1
for param in list(self.alg.inputs.values()):
if isinstance(param.param, (ParameterVector, ParameterTable)):
self.parentCombo.addItem(param.param.description, param.param.name)
Expand Down

0 comments on commit 5625d6e

Please sign in to comment.