Skip to content

Commit c9682e5

Browse files
committedFeb 20, 2015
Fix #11951 - support for output directory in batch processing
1 parent efcbe2f commit c9682e5

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed
 

‎python/plugins/processing/gui/BatchOutputSelectionPanel.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
from processing.core.parameters import ParameterBoolean
3939
from processing.core.parameters import ParameterSelection
4040
from processing.core.parameters import ParameterFixedTable
41+
from processing.core.outputs import OutputDirectory
4142

4243

4344
class BatchOutputSelectionPanel(QWidget):
@@ -65,6 +66,10 @@ def __init__(self, output, alg, row, col, panel):
6566
self.setLayout(self.horizontalLayout)
6667

6768
def showSelectionDialog(self):
69+
if isinstance(self.output, OutputDirectory):
70+
self.selectDirectory()
71+
return
72+
6873
filefilter = self.output.getFileFilter(self.alg)
6974
settings = QSettings()
7075
if settings.contains('/Processing/LastBatchOutputPath'):
@@ -117,6 +122,21 @@ def showSelectionDialog(self):
117122
except:
118123
pass
119124

125+
def selectDirectory(self):
126+
127+
settings = QSettings()
128+
if settings.contains('/Processing/LastBatchOutputPath'):
129+
lastDir = unicode(settings.value('/Processing/LastBatchOutputPath'))
130+
else:
131+
lastDir = ''
132+
133+
dirName = QFileDialog.getExistingDirectory(self,
134+
self.tr('Select directory'), lastDir, QFileDialog.ShowDirsOnly)
135+
136+
if dirName:
137+
self.table.cellWidget(self.row, self.col).setValue(dirName)
138+
settings.setValue('/Processing/LastBatchOutputPath', dirName)
139+
120140
def setValue(self, text):
121141
return self.text.setText(text)
122142

0 commit comments

Comments
 (0)
Please sign in to comment.