Skip to content
Permalink
Browse files

[processing] multiple band selection wrapper should return list of ints

  • Loading branch information
nirvn committed Sep 4, 2018
1 parent 1664ef1 commit 97adef21bdbfc7aefc30a1d723ed5d1725515339
@@ -119,10 +119,7 @@ def getConsoleCommands(self, parameters, context, feedback, executing=True):

bands = self.parameterAsFields(parameters, self.BANDS, context)
for band in bands:
match = re.search('(?:\A|[^0-9])([0-9]+)(?:\Z|[^0-9]|)', band)
if match:
band_nb = match.group(1)
arguments.append('-b {}'.format(band_nb))
arguments.append('-b {}'.format(band))

arguments.append('-ot')
arguments.append(self.TYPES[self.parameterAsEnum(parameters, self.DATA_TYPE, context)])
@@ -28,6 +28,7 @@

import locale
import os
import re
from functools import cmp_to_key
from inspect import isclass
from copy import deepcopy
@@ -1726,10 +1727,8 @@ def setValue(self, value):

for v in value:
for i, opt in enumerate(options):
if opt == v:
selected.append(i)
# case insensitive check - only do if matching case value is not present
elif v not in options and opt.lower() == v.lower():
match = re.search('(?:\A|[^0-9]){}(?:\Z|[^0-9]|)'.format(v), opt)
if match:
selected.append(i)

self.widget.setSelectedItems(selected)
@@ -1741,7 +1740,12 @@ def setValue(self, value):
def value(self):
if self.dialogType in (DIALOG_STANDARD, DIALOG_BATCH):
if self.param.allowMultiple():
return [self.widget.options[i] for i in self.widget.selectedoptions]
bands = []
for i in self.widget.selectedoptions:
match = re.search('(?:\A|[^0-9])([0-9]+)(?:\Z|[^0-9]|)', self.widget.options[i])
if match:
bands.append(match.group(1))
return bands
else:
f = self.widget.currentBand()
if self.param.flags() & QgsProcessingParameterDefinition.FlagOptional and not f:

0 comments on commit 97adef2

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