Skip to content

Commit

Permalink
Merge pull request #784 from ricardogsilva/sextante_issue_8407
Browse files Browse the repository at this point in the history
Fix for issue #8407 - Allow selecting between file or directory when using a File Parameter in the modeler
  • Loading branch information
volaya committed Aug 3, 2013
2 parents 0367182 + 4cb5d04 commit fe6dcf1
Showing 1 changed file with 4 additions and 2 deletions.
Expand Up @@ -204,9 +204,10 @@ def setupUi(self):
self.fileFolderCombo = QtGui.QComboBox()
self.fileFolderCombo.addItem("File")
self.fileFolderCombo.addItem("Folder")
self.horizontalLayout2.addWidget(self.fileFolderCombo)
if self.param is not None:
self.fileFolderCombo.setCurrentIndex(1 if self.param.isFolder else 0)
self.horizontalLayout2.addWidget(self.fileFolderCombo)
self.verticalLayout.addLayout(self.horizontalLayout2)

self.buttonBox = QtGui.QDialogButtonBox(self)
self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
Expand Down Expand Up @@ -268,7 +269,8 @@ def okPressed(self):
elif self.paramType == ModelerParameterDefinitionDialog.PARAMETER_EXTENT or isinstance(self.param, ParameterExtent):
self.param = ParameterExtent(name, description)
elif self.paramType == ModelerParameterDefinitionDialog.PARAMETER_FILE or isinstance(self.param, ParameterFile):
self.param = ParameterFile(name, description)
isFolder = self.fileFolderCombo.currentIndex() == 1
self.param = ParameterFile(name, description, isFolder=isFolder)
self.close()

def cancelPressed(self):
Expand Down

0 comments on commit fe6dcf1

Please sign in to comment.