Skip to content
Permalink
Browse files

[processing] allow raster options widget accept string parameters and…

… outputs in modeler
  • Loading branch information
alexbruy committed Jan 7, 2017
1 parent 85d4093 commit 29d108f38fd40260ae23d52db72c8d445e2ac017
@@ -25,20 +25,48 @@

__revision__ = '$Format:%H$'

from qgis.PyQt.QtWidgets import QLineEdit, QComboBox
from qgis.gui import QgsRasterFormatSaveOptionsWidget

from processing.gui.wrappers import WidgetWrapper
from processing.core.parameters import ParameterString
from processing.core.outputs import OutputString
from processing.gui.wrappers import WidgetWrapper, DIALOG_MODELER, DIALOG_BATCH


class RasterOptionsWidgetWrapper(WidgetWrapper):

def createWidget(self):
return QgsRasterFormatSaveOptionsWidget()
if self.dialogType == DIALOG_MODELER:
widget = QComboBox()
widget.setEditable(True)
strings = self.dialog.getAvailableValuesOfType(ParameterString, OutputString)
options = [(self.dialog.resolveValueDescription(s), s) for s in strings]
for desc, val in options:
widget.addItem(desc, val)
widget.setEditText(self.param.default or '')
return widget
elif self.dialogType == DIALOG_BATCH:
widget = QLineEdit()
if self.param.default:
widget.setText(self.param.default)
else:
return QgsRasterFormatSaveOptionsWidget()

def setValue(self, value):
if value is None:
value = ''
self.widget.setValue(value)

if self.dialogType == DIALOG_MODELER:
self.setComboValue(value)
elif self.dialogType == DIALOG_BATCH:
self.widget.setText(value)
else:
self.widget.setValue(value)

def value(self):
return ' '.join(self.widget.options())
if self.dialogType == DIALOG_MODELER:
return self.comboValue()
elif self.dialogType == DIALOG_BATCH:
return self.widget.text()
else:
return ' '.join(self.widget.options())
@@ -1,7 +1,6 @@
# See ../README.md for a description of the file format

tests:

- algorithm: gdal:gdalinfo
name: gdalinfo
params:

0 comments on commit 29d108f

Please sign in to comment.
You can’t perform that action at this time.