Skip to content
Permalink
Browse files

improved model edition in modeler

git-svn-id: http://sextante.googlecode.com/svn/trunk/soft/bindings/qgis-plugin@190 881b9c09-3ef8-f3c2-ec3d-21d735c97f4d
  • Loading branch information
volayaf@gmail.com
volayaf@gmail.com committed May 25, 2012
1 parent debbe5d commit a4bc5faf920863cd5502d46b08ab152ca19c5ca6
@@ -239,6 +239,7 @@ def getDependentAlgorithms(self, algIndex):
if aap.alg == algIndex:
dependent.append(index)
break

return dependent

def getPositionForAlgorithmItem(self):
@@ -484,3 +485,6 @@ def name(self):
return self.paramName + " from algorithm " + str(self.alg) + "(" + self.algName + ")"
else:
return self.paramName

def __str__(self):
return str(self.alg) + "|" + str(self.param)
@@ -331,7 +331,7 @@ def setTableContent(self):
i+=1


def setComboBoxValue(self, combo, value):
def setComboBoxValue(self, combo, value, param):
items = [combo.itemData(i).toPyObject() for i in range(combo.count())]
idx = 0
for item in items:
@@ -343,7 +343,17 @@ def setComboBoxValue(self, combo, value):
if combo.isEditable():
value = self.model.getValueFromAlgorithmAndParameter(value)
if value:
combo.setCurrentText(str(value))
combo.setEditText(str(value))
elif isinstance(param, ParameterSelection):
value = self.model.getValueFromAlgorithmAndParameter(value)
combo.setCurrentIndex(int(value))
elif isinstance(param, ParameterBoolean):
value = self.model.getValueFromAlgorithmAndParameter(value) == str(True)
if value:
combo.setCurrentIndex(0)
else:
combo.setCurrentIndex(1)


def setPreviousValues(self):
if self.algIndex is not None:
@@ -352,16 +362,9 @@ def setPreviousValues(self):
param = self.alg.getParameterFromName(name)
if isinstance(param, (ParameterRaster, ParameterVector,
ParameterTable, ParameterTableField,
ParameterSelection)):
self.setComboBoxValue(widget, value)
elif isinstance(param, ParameterBoolean):
ret = self.model.getValueFromAlgorithmAndParameter(value)
if ret is not None:
if ret:
widget.setCurrentIndex(0)
else:
widget.setCurrentIndex(1)
self.setComboBoxValue(widget, value)
ParameterSelection, ParameterNumber,
ParameterString,ParameterBoolean)):
self.setComboBoxValue(widget, value, param)
elif isinstance(param, ParameterFixedTable):
pass
elif isinstance(param, ParameterMultipleInput):
@@ -11,7 +11,7 @@ def setValue(self, value):
if value is None:
self.value = self.default
return True
self.value = value
self.value = str(value) == str(True)
return True

def serialize(self):

0 comments on commit a4bc5fa

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