mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-07 00:15:48 -04:00
[processing][grass] Fix r.colors (color or rules or raster parameter)
Allow to use either the color parameter or the rules parameter or the raster parameter
This commit is contained in:
parent
893da91e32
commit
b80bd0afa0
@ -31,6 +31,12 @@ def checkParameterValuesBeforeExecuting(alg, parameters, context):
|
|||||||
if txtRules and rules:
|
if txtRules and rules:
|
||||||
return False, alg.tr("You need to set either inline rules or a rules file!")
|
return False, alg.tr("You need to set either inline rules or a rules file!")
|
||||||
|
|
||||||
|
rules_or_txtRules = bool(txtRules or rules)
|
||||||
|
color = bool(alg.parameterAsEnum(parameters, 'color', context))
|
||||||
|
raster = bool(alg.parameterAsString(parameters, 'raster', context))
|
||||||
|
if not sum([rules_or_txtRules, color, raster]) == 1:
|
||||||
|
return False, alg.tr("The color table, color rules and raster map parameters are mutually exclusive. You need to set one and only one of them!")
|
||||||
|
|
||||||
return True, None
|
return True, None
|
||||||
|
|
||||||
|
|
||||||
@ -64,6 +70,9 @@ def processCommand(alg, parameters, context, feedback):
|
|||||||
alg.removeParameter('txtrules')
|
alg.removeParameter('txtrules')
|
||||||
parameters['rules'] = tempRulesName
|
parameters['rules'] = tempRulesName
|
||||||
|
|
||||||
|
if alg.parameterAsEnum(parameters, 'color', context) == 0:
|
||||||
|
alg.removeParameter('color')
|
||||||
|
|
||||||
alg.processCommand(parameters, context, feedback, True)
|
alg.processCommand(parameters, context, feedback, True)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user