Skip to content

Commit

Permalink
[processing] fixed layer selector panel to use file filter
Browse files Browse the repository at this point in the history
  • Loading branch information
volaya committed Jun 20, 2014
1 parent 253f5a9 commit 2e9a088
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
3 changes: 1 addition & 2 deletions python/plugins/processing/gui/AlgorithmExecutionDialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,7 @@ def setParamValues(self):
continue
output.value = self.paramTable.valueItems[output.name].getValue()
if isinstance(output, (OutputRaster, OutputVector, OutputTable)):
output.open = \
self.paramTable.checkBoxes[output.name].isChecked()
output.open = self.paramTable.checkBoxes[output.name].isChecked()

return True

Expand Down
7 changes: 4 additions & 3 deletions python/plugins/processing/gui/InputLayerSelectorPanel.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@

class InputLayerSelectorPanel(QtGui.QWidget):

def __init__(self, options):
def __init__(self, options, param):
super(InputLayerSelectorPanel, self).__init__(None)
self.param = param
self.horizontalLayout = QtGui.QHBoxLayout(self)
self.horizontalLayout.setSpacing(2)
self.horizontalLayout.setMargin(0)
Expand Down Expand Up @@ -61,8 +62,8 @@ def showSelectionDialog(self):
else:
path = ''

filename = QtGui.QFileDialog.getOpenFileName(self, 'All files', path,
'*.*')
filename = QtGui.QFileDialog.getOpenFileName(self, self.param.description, path,
self.param.getFileFilter())
if filename:
self.text.addItem(filename, filename)
self.text.setCurrentIndex(self.text.count() - 1)
Expand Down
9 changes: 4 additions & 5 deletions python/plugins/processing/gui/ParametersPanel.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,10 +197,9 @@ def getWidgetFromParameter(self, param):
items.append((self.NOT_SELECTED, None))
for layer in layers:
items.append((self.getExtendedLayerName(layer), layer))
item = InputLayerSelectorPanel(items)
item = InputLayerSelectorPanel(items, param)
elif isinstance(param, ParameterVector):
if self.somethingDependsOnThisParameter(param) \
or self.alg.allowOnlyOpenedLayers:
if self.somethingDependsOnThisParameter(param) or self.alg.allowOnlyOpenedLayers:
item = QtGui.QComboBox()
layers = dataobjects.getVectorLayers(param.shapetype)
if param.optional:
Expand All @@ -220,7 +219,7 @@ def getWidgetFromParameter(self, param):
for i,(name,layer) in enumerate(items):
if layer and layer.source() == param.value:
items.insert(0, items.pop(i))
item = InputLayerSelectorPanel(items)
item = InputLayerSelectorPanel(items, param)
elif isinstance(param, ParameterTable):
if self.somethingDependsOnThisParameter(param):
item = QtGui.QComboBox()
Expand All @@ -242,7 +241,7 @@ def getWidgetFromParameter(self, param):
for i,(name,layer) in enumerate(items):
if layer and layer.source() == param.value:
items.insert(0, items.pop(i))
item = InputLayerSelectorPanel(items)
item = InputLayerSelectorPanel(items, param)
elif isinstance(param, ParameterBoolean):
item = QtGui.QComboBox()
item.addItem('Yes')
Expand Down

0 comments on commit 2e9a088

Please sign in to comment.