Skip to content
Permalink
Browse files

Filter params and output before use. Use Enurmerate to count rows

  • Loading branch information
NathanW2 committed Jan 3, 2014
1 parent 797bd32 commit 79447b92c1df97fefa251be7c4030962afc7ac6e
Showing with 8 additions and 13 deletions.
  1. +8 −13 python/plugins/processing/gui/ParametersPanel.py
@@ -185,6 +185,8 @@ def getExtendedLayerName(self, layer):
return layer.name()

def getWidgetFromParameter(self, param):
# TODO Create Parameter widget class that holds the logic
# for creating a widget that belongs to the parameter.
if isinstance(param, ParameterRaster):
layers = dataobjects.getRasterLayers()
items = []
@@ -334,28 +336,22 @@ def somethingDependsOnThisParameter(self, parent):
return False

def setTableContent(self):
params = self.alg.parameters
outputs = self.alg.outputs
numParams = count(p for p in params if not p.hidden)
numParams = count(o for o in outputs if not o.hidden)
params = [parm for parm in self.alg.parameters if not parm.hidden]
outputs = [output for output in self.alg.outputs if not output.hidden]
numParams = len(parms)
numOutputs = len(outputs)
self.tableWidget.setRowCount(numParams + numOutputs)

i = 0
for param in params:
if param.hidden:
continue
for i, param in enurmerate(params):
item = QtGui.QTableWidgetItem(param.description)
item.setFlags(QtCore.Qt.ItemIsEnabled)
self.tableWidget.setItem(i, 0, item)
item = self.getWidgetFromParameter(param)
self.valueItems[param.name] = item
self.tableWidget.setCellWidget(i, 1, item)
self.tableWidget.setRowHeight(i, 22)
i += 1

for output in outputs:
if output.hidden:
continue
for i, output in enurmerate(outputs):
item = QtGui.QTableWidgetItem(output.description + '<'
+ output.__module__.split('.')[-1] + '>')
item.setFlags(QtCore.Qt.ItemIsEnabled)
@@ -364,4 +360,3 @@ def setTableContent(self):
self.valueItems[output.name] = item
self.tableWidget.setCellWidget(i, 1, item)
self.tableWidget.setRowHeight(i, 22)
i += 1

0 comments on commit 79447b9

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