Skip to content

Commit 56af106

Browse files
committed
[processing] recover previous value of formula in modeler calculator
#fixes 11539
1 parent 3bb677e commit 56af106

3 files changed

Lines changed: 7 additions & 5 deletions

File tree

python/plugins/processing/algs/qgis/FieldsMapper.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ def defineCharacteristics(self):
6262
def getCustomParametersDialog(self):
6363
return FieldsMapperParametersDialog(self)
6464

65-
def getCustomModelerParametersDialog(self, modelAlg, algIndex=None):
66-
return FieldsMapperModelerParametersDialog(self, modelAlg, algIndex)
65+
def getCustomModelerParametersDialog(self, modelAlg, algName=None):
66+
return FieldsMapperModelerParametersDialog(self, modelAlg, algName)
6767

6868
def processAlgorithm(self, progress):
6969
layer = self.getParameterValue(self.INPUT_LAYER)

python/plugins/processing/core/GeoAlgorithm.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ def getCustomParametersDialog(self):
161161
"""
162162
return None
163163

164-
def getCustomModelerParametersDialog(self, modelAlg, algIndex=None):
164+
def getCustomModelerParametersDialog(self, modelAlg, algName=None):
165165
"""If the algorithm has a custom parameters dialog when called
166166
from the modeler, it should be returned here, ready to be
167167
executed.

python/plugins/processing/modeler/CalculatorModelerAlgorithm.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ def processAlgorithm(self, progress):
7171
raise GeoAlgorithmExecutionException(
7272
self.tr('Wrong formula: %s', 'CalculatorModelerAlgorithm') % formula)
7373

74-
def getCustomModelerParametersDialog(self, modelAlg, algIndex=None):
75-
return CalculatorModelerParametersDialog(self, modelAlg, algIndex)
74+
def getCustomModelerParametersDialog(self, modelAlg, algName=None):
75+
return CalculatorModelerParametersDialog(self, modelAlg, algName)
7676

7777

7878
class CalculatorModelerParametersDialog(ModelerParametersDialog):
@@ -101,6 +101,8 @@ def setupUi(self):
101101
self.formulaText = QLineEdit()
102102
if hasattr(self.formulaText, 'setPlaceholderText'):
103103
self.formulaText.setPlaceholderText(self.tr('[Enter your formula here]', 'CalculatorModelerParametersDialog'))
104+
alg = self.model.algs[self._algName]
105+
self.formulaText.setText(alg.params[FORMULA])
104106
self.setWindowTitle(self.tr('Calculator', 'CalculatorModelerParametersDialog'))
105107
self.verticalLayout = QVBoxLayout()
106108
self.verticalLayout.setSpacing(2)

0 commit comments

Comments
 (0)