Skip to content
Permalink
Browse files

fix indentation

Conflicts:
	python/plugins/processing/gui/BatchInputSelectionPanel.py
	python/plugins/processing/gui/wrappers.py
  • Loading branch information
alexbruy authored and volaya committed Oct 5, 2016
1 parent a20c86c commit 3407ced90e9c212a7a7b5dfe0bf60c99854df836
@@ -40,7 +40,7 @@ def __init__(self, alg):
AlgorithmDialogBase.__init__(self, alg)

self.alg = alg

self.setMainWidget(GdalParametersPanel(self, alg))

cornerWidget = QWidget()
@@ -55,6 +55,7 @@ def __init__(self, alg):

self.mainWidget.parametersHaveChanged()


class GdalParametersPanel(ParametersPanel):

def __init__(self, parent, alg):
@@ -166,11 +166,11 @@ def defineCharacteristicsFromFile(self):
" (raw output)", "txt"))
line = lines.readline().strip('\n').strip()
except Exception as e:

ProcessingLog.addToLog(
ProcessingLog.LOG_ERROR,
traceback.format_exc())
#self.tr('Could not open GRASS algorithm: %s.\n%s' % (self.descriptionFile, line)))
#self.tr('Could not open GRASS algorithm: %s.\n%s' % (self.descriptionFile, line)))
raise e
lines.close()

@@ -51,7 +51,7 @@ def defineCharacteristics(self):

def processAlgorithm(self, progress):
layer = dataobjects.getObjectFromUri(self.getParameterValue(self.INPUT))

toDelete = self.getParameterValue(self.COLUMNS)
fields = layer.fields()
idxs = []
@@ -63,7 +63,7 @@ def defineCharacteristics(self):
self.addParameter(ParameterBoolean(Dissolve.DISSOLVE_ALL,
self.tr('Dissolve all (do not use fields)'), True))
self.addParameter(ParameterTableField(Dissolve.FIELD,
self.tr('Unique ID fields'), Dissolve.INPUT, optional=True, multiple=True))
self.tr('Unique ID fields'), Dissolve.INPUT, optional=True, multiple=True))
self.addOutput(OutputVector(Dissolve.OUTPUT, self.tr('Dissolved')))

def processAlgorithm(self, progress):
@@ -187,7 +187,6 @@ def processParameterLine(self, line):
raise WrongScriptException(
self.tr('Could not load R script: %s.\n Problem with line %s' % (self.descriptionFile, line)))


def processAlgorithm(self, progress):
if isWindows():
path = RUtils.RFolder()
@@ -73,7 +73,6 @@ def __init__(self):
self.showInToolbox = True
self.showInModeler = True


# False if it should not be run a a batch process
self.canRunInBatchMode = True

@@ -333,7 +332,7 @@ def evaluateParameterValues(self):
except ValueError, e:
traceback.print_exc()
raise GeoAlgorithmExecutionException(str(e))

def resolveOutputs(self):
"""Sets temporary outputs (output.value = None) with a
temporary file instead. Resolves expressions as well.
@@ -343,7 +342,7 @@ def resolveOutputs(self):
out.resolveValue(self)
except ValueError, e:
raise GeoAlgorithmExecutionException(str(e))

def setOutputCRS(self):
layers = dataobjects.getAllLayers()
for param in self.parameters:
@@ -40,6 +40,7 @@

from qgis.core import QgsExpressionContext, QgsExpressionContextUtils, QgsExpression, QgsExpressionContextScope


def _expressionContext(alg):
context = QgsExpressionContext()
context.appendScope(QgsExpressionContextUtils.globalScope())
@@ -50,6 +51,7 @@ def _expressionContext(alg):
context.appendScope(processingScope)
return context


class Output(object):

def __init__(self, name='', description='', hidden=False):
@@ -93,17 +95,17 @@ def setValue(self, value):
return True
except:
return False

def _resolveTemporary(self, alg):
ext = self.getDefaultFileExtension()
return getTempFilenameInTempFolder(self.name + '.' + ext)

def _supportedExtensions(self):
return []

def resolveValue(self, alg):
if not self.hidden and not bool(self.value):
self.value = self._resolveTemporary(alg)
self.value = self._resolveTemporary(alg)
else:
exp = QgsExpression(self.value)
if not exp.hasParserError():
@@ -113,7 +115,7 @@ def resolveValue(self, alg):

if ":" not in self.value:
if not os.path.isabs(self.value):
self.value = os.path.join(ProcessingConfig.getSetting(ProcessingConfig.OUTPUT_FOLDER),
self.value = os.path.join(ProcessingConfig.getSetting(ProcessingConfig.OUTPUT_FOLDER),
self.value)
supported = self._supportedExtensions()
if supported:
@@ -138,7 +140,7 @@ def tr(self, string, context=''):


class OutputDirectory(Output):

def resolveValue(self, alg):
self.value = getTempDirInTempFolder()

@@ -330,7 +332,6 @@ def getDefaultFileExtension(self):
default = 'dbf'
return default


def getCompatibleFileName(self, alg):
"""Returns a filename that is compatible with the algorithm
that is going to generate this output.
@@ -389,7 +390,7 @@ def _resolveTemporary(self, alg):
else:
ext = self.getDefaultFileExtension()
return getTempFilenameInTempFolder(self.name + '.' + ext)


def getOutputFromString(s):
try:
@@ -402,7 +403,7 @@ def getOutputFromString(s):
tokens = s.split("=")
token = tokens[1].strip()[len('output') + 1:]
out = None

if token.lower().strip().startswith('raster'):
out = OutputRaster()
elif token.lower().strip() == 'vector':
@@ -430,7 +431,7 @@ def getOutputFromString(s):
out = OutputString()
elif token.lower().strip().startswith('extent'):
out = OutputExtent()

return out
except:
return None
return None

0 comments on commit 3407ced

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