Skip to content
Permalink
Browse files
[processing] enable temporary outputs in QGIS Field Calculator (fix #…
  • Loading branch information
alexbruy committed Mar 26, 2014
1 parent aefc892 commit e484500
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
@@ -37,7 +37,7 @@
from processing.parameters.ParameterBoolean import ParameterBoolean
from processing.parameters.ParameterSelection import ParameterSelection
from processing.outputs.OutputVector import OutputVector
from processing.tools import dataobjects, vector
from processing.tools import dataobjects, vector, system

from processing.algs.ui.FieldsCalculatorDialog import FieldsCalculatorDialog

@@ -85,6 +85,10 @@ def processAlgorithm(self, progress):

output = self.getOutputFromName(self.OUTPUT_LAYER)

if output.value == '':
ext = output.getDefaultFileExtension(self)
output.value = system.getTempFilenameInTempFolder(output.name + '.' + ext)

provider = layer.dataProvider()
fields = layer.pendingFields()
if newField:
@@ -143,7 +147,6 @@ def processAlgorithm(self, progress):
'An error occured while evaluating the calculation '
'string:\n' + error)


def checkParameterValuesBeforeExecuting(self):
newField = self.getParameterValue(self.NEW_FIELD)
fieldName = self.getParameterValue(self.FIELD_NAME)
@@ -156,6 +159,5 @@ def checkParameterValuesBeforeExecuting(self):
raise GeoAlgorithmExecutionException('Output is not set. '
'Please specify valid filename')


def getCustomParametersDialog(self):
return FieldsCalculatorDialog(self)
@@ -71,6 +71,10 @@ def __init__(self, alg):
self.manageGui()

def manageGui(self):
if hasattr(self.leOutputFile, 'setPlaceholderText'):
self.leOutputFile.setPlaceholderText(
self.tr('[Save to temporary file]'))

self.mOutputFieldTypeComboBox.blockSignals(True)
for t in self.alg.TYPE_NAMES:
self.mOutputFieldTypeComboBox.addItem(t)

0 comments on commit e484500

Please sign in to comment.