[processing] fixed layer selector panel to use file filter

This commit is contained in:
Victor Olaya 2014-06-20 12:15:10 +02:00
parent 253f5a9603
commit 2e9a088e44
3 changed files with 9 additions and 10 deletions

View File

@ -156,8 +156,7 @@ class AlgorithmExecutionDialog(QtGui.QDialog):
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

View File

@ -31,8 +31,9 @@ from PyQt4 import QtGui, QtCore
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)
@ -61,8 +62,8 @@ class InputLayerSelectorPanel(QtGui.QWidget):
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)

View File

@ -197,10 +197,9 @@ class ParametersPanel(QtGui.QWidget):
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:
@ -220,7 +219,7 @@ class ParametersPanel(QtGui.QWidget):
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()
@ -242,7 +241,7 @@ class ParametersPanel(QtGui.QWidget):
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')