Skip to content

Commit

Permalink
Merge pull request #1134 from CS-SI/otb_processing_update
Browse files Browse the repository at this point in the history
OTB processing update
  • Loading branch information
volaya committed Mar 25, 2014
2 parents e2d01e2 + 7abca16 commit 3b7b2b4
Show file tree
Hide file tree
Showing 308 changed files with 11,418 additions and 4,221 deletions.
15 changes: 15 additions & 0 deletions python/plugins/processing/gui/AlgorithmExecutionDialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
(C) 2013 by CS Systemes d'information (CS SI)
Email : volayaf at gmail dot com
otb at c-s dot fr (CS SI)
Contributors : Victor Olaya
Alexia Mondot (CS SI) - managing the new parameter ParameterMultipleExternalInput
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
Expand Down Expand Up @@ -50,6 +54,7 @@
from processing.parameters.ParameterCrs import ParameterCrs
from processing.parameters.ParameterExtent import ParameterExtent
from processing.parameters.ParameterString import ParameterString
from processing.parameters.ParameterMultipleExternalInput import ParameterMultipleExternalInput
from processing.outputs.OutputRaster import OutputRaster
from processing.outputs.OutputVector import OutputVector
from processing.outputs.OutputTable import OutputTable
Expand Down Expand Up @@ -162,6 +167,13 @@ def setParamValues(self):
return True

def setParamValue(self, param, widget):
"""
set the .value of the parameter according to the given widget
the way to get the value is different for each value,
so there is a code for each kind of parameter
param : -il <ParameterMultipleInput> or -method <ParameterSelection> ...
"""
if isinstance(param, ParameterRaster):
return param.setValue(widget.getValue())
elif isinstance(param, (ParameterVector, ParameterTable)):
Expand All @@ -188,6 +200,9 @@ def setParamValue(self, param, widget):
for index in widget.selectedoptions:
value.append(options[index])
return param.setValue(value)
elif isinstance(param, ParameterMultipleExternalInput):
value = widget.selectedoptions
return param.setValue(value)
elif isinstance(param, (ParameterNumber, ParameterFile, ParameterCrs,
ParameterExtent)):
return param.setValue(widget.getValue())
Expand Down
111 changes: 111 additions & 0 deletions python/plugins/processing/gui/MultipleExternalInputDialog.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
# -*- coding: utf-8 -*-

"""
***************************************************************************
MultipleExternalInputDialog.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
(C) 2013 by CS Systemes d'information (CS SI)
Email : volayaf at gmail dot com
otb at c-s dot fr (CS SI)
Contributors : Victor Olaya - basis from MultipleInputDialog
Alexia Mondot (CS SI) - new parameter
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************
"""

__author__ = 'Victor Olaya'
__date__ = 'August 2012'
__copyright__ = '(C) 2012, Victor Olaya'
# This will get replaced with a git SHA1 when you do a git archive
__revision__ = '$Format:%H$'

from PyQt4 import QtCore, QtGui
import os

class MultipleExternalInputDialog(QtGui.QDialog):
def __init__(self, selectedoptions):
self.selectedoptions = selectedoptions
self.options=selectedoptions
QtGui.QDialog.__init__(self)
self.setModal(True)
self.setupUi()
self.selectedoptions = None

def setupUi(self):
self.resize(381, 320)
self.setWindowTitle("Multiple selection")
self.horizontalLayout = QtGui.QHBoxLayout(self)
self.horizontalLayout.setSpacing(2)
self.horizontalLayout.setMargin(0)
self.buttonBox = QtGui.QDialogButtonBox()
self.buttonBox.setOrientation(QtCore.Qt.Vertical)
self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok)
self.buttonPlus = QtGui.QPushButton("+")
self.buttonBox.addButton(self.buttonPlus, QtGui.QDialogButtonBox.ActionRole)
self.buttonMoins = QtGui.QPushButton("-")
self.buttonBox.addButton(self.buttonMoins, QtGui.QDialogButtonBox.ActionRole)
self.table = QtGui.QTableWidget()
self.table.setColumnCount(1)
self.table.setColumnWidth(0,270)
self.table.verticalHeader().setVisible(False)
self.table.horizontalHeader().setVisible(False)
self.table.horizontalHeader().setResizeMode(QtGui.QHeaderView.Stretch)
self.horizontalLayout.addWidget(self.table)
self.horizontalLayout.addWidget(self.buttonBox)
self.setLayout(self.horizontalLayout)
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("accepted()"), self.okPressed)
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("rejected()"), self.cancelPressed)
QtCore.QObject.connect(self.buttonPlus, QtCore.SIGNAL("clicked()"), self.addFile)
QtCore.QObject.connect(self.buttonMoins, QtCore.SIGNAL("clicked()"), self.removeFile)