Skip to content
Permalink
Browse files

Use set for getFields

  • Loading branch information
NathanW2 committed Jan 3, 2014
1 parent 8aa6a4d commit 44d96825a3186aca71e47e4f98446ecb999969d8
Showing with 5 additions and 12 deletions.
  1. +5 −12 python/plugins/processing/gui/ParametersPanel.py
@@ -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:

0 comments on commit 44d9682

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