Skip to content

Commit 2e9a088

Browse files
committed
[processing] fixed layer selector panel to use file filter
1 parent 253f5a9 commit 2e9a088

File tree

3 files changed

+9
-10
lines changed

3 files changed

+9
-10
lines changed

python/plugins/processing/gui/AlgorithmExecutionDialog.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,7 @@ def setParamValues(self):
156156
continue
157157
output.value = self.paramTable.valueItems[output.name].getValue()
158158
if isinstance(output, (OutputRaster, OutputVector, OutputTable)):
159-
output.open = \
160-
self.paramTable.checkBoxes[output.name].isChecked()
159+
output.open = self.paramTable.checkBoxes[output.name].isChecked()
161160

162161
return True
163162

python/plugins/processing/gui/InputLayerSelectorPanel.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,9 @@
3131

3232
class InputLayerSelectorPanel(QtGui.QWidget):
3333

34-
def __init__(self, options):
34+
def __init__(self, options, param):
3535
super(InputLayerSelectorPanel, self).__init__(None)
36+
self.param = param
3637
self.horizontalLayout = QtGui.QHBoxLayout(self)
3738
self.horizontalLayout.setSpacing(2)
3839
self.horizontalLayout.setMargin(0)
@@ -61,8 +62,8 @@ def showSelectionDialog(self):
6162
else:
6263
path = ''
6364

64-
filename = QtGui.QFileDialog.getOpenFileName(self, 'All files', path,
65-
'*.*')
65+
filename = QtGui.QFileDialog.getOpenFileName(self, self.param.description, path,
66+
self.param.getFileFilter())
6667
if filename:
6768
self.text.addItem(filename, filename)
6869
self.text.setCurrentIndex(self.text.count() - 1)

python/plugins/processing/gui/ParametersPanel.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -197,10 +197,9 @@ def getWidgetFromParameter(self, param):
197197
items.append((self.NOT_SELECTED, None))
198198
for layer in layers:
199199
items.append((self.getExtendedLayerName(layer), layer))
200-
item = InputLayerSelectorPanel(items)
200+
item = InputLayerSelectorPanel(items, param)
201201
elif isinstance(param, ParameterVector):
202-
if self.somethingDependsOnThisParameter(param) \
203-
or self.alg.allowOnlyOpenedLayers:
202+
if self.somethingDependsOnThisParameter(param) or self.alg.allowOnlyOpenedLayers:
204203
item = QtGui.QComboBox()
205204
layers = dataobjects.getVectorLayers(param.shapetype)
206205
if param.optional:
@@ -220,7 +219,7 @@ def getWidgetFromParameter(self, param):
220219
for i,(name,layer) in enumerate(items):
221220
if layer and layer.source() == param.value:
222221
items.insert(0, items.pop(i))
223-
item = InputLayerSelectorPanel(items)
222+
item = InputLayerSelectorPanel(items, param)
224223
elif isinstance(param, ParameterTable):
225224
if self.somethingDependsOnThisParameter(param):
226225
item = QtGui.QComboBox()
@@ -242,7 +241,7 @@ def getWidgetFromParameter(self, param):
242241
for i,(name,layer) in enumerate(items):
243242
if layer and layer.source() == param.value:
244243
items.insert(0, items.pop(i))
245-
item = InputLayerSelectorPanel(items)
244+
item = InputLayerSelectorPanel(items, param)
246245
elif isinstance(param, ParameterBoolean):
247246
item = QtGui.QComboBox()
248247
item.addItem('Yes')

0 commit comments

Comments
 (0)