Skip to content

Commit

Permalink
Fix #11951 - support for output directory in batch processing
Browse files Browse the repository at this point in the history
  • Loading branch information
wonder-sk committed Feb 20, 2015
1 parent efcbe2f commit c9682e5
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions python/plugins/processing/gui/BatchOutputSelectionPanel.py
Expand Up @@ -38,6 +38,7 @@
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):
Expand Down Expand Up @@ -65,6 +66,10 @@ def __init__(self, output, alg, row, col, panel):
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'):
Expand Down Expand Up @@ -117,6 +122,21 @@ def showSelectionDialog(self):
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)

Expand Down

0 comments on commit c9682e5

Please sign in to comment.