diff --git a/python/plugins/processing/gui/BatchOutputSelectionPanel.py b/python/plugins/processing/gui/BatchOutputSelectionPanel.py index 3a196105012..a108495ecc6 100644 --- a/python/plugins/processing/gui/BatchOutputSelectionPanel.py +++ b/python/plugins/processing/gui/BatchOutputSelectionPanel.py @@ -38,6 +38,7 @@ from processing.core.parameters import ParameterVector from processing.core.parameters import ParameterBoolean from processing.core.parameters import ParameterSelection from processing.core.parameters import ParameterFixedTable +from processing.core.outputs import OutputDirectory class BatchOutputSelectionPanel(QWidget): @@ -65,6 +66,10 @@ class BatchOutputSelectionPanel(QWidget): self.setLayout(self.horizontalLayout) def showSelectionDialog(self): + if isinstance(self.output, OutputDirectory): + self.selectDirectory() + return + filefilter = self.output.getFileFilter(self.alg) settings = QSettings() if settings.contains('/Processing/LastBatchOutputPath'): @@ -117,6 +122,21 @@ class BatchOutputSelectionPanel(QWidget): except: pass + def selectDirectory(self): + + settings = QSettings() + if settings.contains('/Processing/LastBatchOutputPath'): + lastDir = unicode(settings.value('/Processing/LastBatchOutputPath')) + else: + lastDir = '' + + dirName = QFileDialog.getExistingDirectory(self, + self.tr('Select directory'), lastDir, QFileDialog.ShowDirsOnly) + + if dirName: + self.table.cellWidget(self.row, self.col).setValue(dirName) + settings.setValue('/Processing/LastBatchOutputPath', dirName) + def setValue(self, text): return self.text.setText(text)