mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-06 00:07:29 -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:
|
||||
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
|
||||
|
||||
|
||||
@ -64,6 +70,9 @@ def processCommand(alg, parameters, context, feedback):
|
||||
alg.removeParameter('txtrules')
|
||||
parameters['rules'] = tempRulesName
|
||||
|
||||
if alg.parameterAsEnum(parameters, 'color', context) == 0:
|
||||
alg.removeParameter('color')
|
||||
|
||||
alg.processCommand(parameters, context, feedback, True)
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user