Skip to content

Commit

Permalink
Use set for getFields
Browse files Browse the repository at this point in the history
  • Loading branch information
NathanW2 committed Jan 3, 2014
1 parent 8aa6a4d commit 44d9682
Showing 1 changed file with 5 additions and 12 deletions.
17 changes: 5 additions & 12 deletions python/plugins/processing/gui/ParametersPanel.py
Expand Up @@ -320,18 +320,11 @@ def getFields(self, layer, datatype):
elif datatype == ParameterTableField.DATA_TYPE_NUMBER:
fieldTypes = [QtCore.QVariant.Int, QtCore.QVariant.Double]

fieldNames = []
fields = layer.pendingFields()
if len(fieldTypes) == 0:
for field in fields:
if not field.name() in fieldNames:
fieldNames.append(unicode(field.name()))
else:
for field in fields:
if field.type() in fieldTypes and not field.name() \
in fieldNames:
fieldNames.append(unicode(field.name()))
return sorted(fieldNames, cmp=locale.strcoll)
fieldNames = set()
for field in layer.pendingFields():
if not fieldTypes or field.type() in fieldTypes:
fieldNames.add(unicode(field.name()))
return sorted(list(fieldNames), cmp=locale.strcoll)

def somethingDependsOnThisParameter(self, parent):
for param in self.alg.parameters:
Expand Down

0 comments on commit 44d9682

Please sign in to comment.