Skip to content

Commit

Permalink
fix indentation
Browse files Browse the repository at this point in the history
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 3407ced
Show file tree
Hide file tree
Showing 22 changed files with 114 additions and 113 deletions.
3 changes: 2 additions & 1 deletion python/plugins/processing/algs/gdal/GdalAlgorithmDialog.py
Expand Up @@ -40,7 +40,7 @@ def __init__(self, alg):
AlgorithmDialogBase.__init__(self, alg)

self.alg = alg

self.setMainWidget(GdalParametersPanel(self, alg))

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

self.mainWidget.parametersHaveChanged()


class GdalParametersPanel(ParametersPanel):

def __init__(self, parent, alg):
Expand Down
4 changes: 2 additions & 2 deletions python/plugins/processing/algs/grass/GrassAlgorithm.py
Expand Up @@ -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()

Expand Down
2 changes: 1 addition & 1 deletion python/plugins/processing/algs/qgis/DeleteColumn.py
Expand Up @@ -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 = []
Expand Down
2 changes: 1 addition & 1 deletion python/plugins/processing/algs/qgis/Dissolve.py
Expand Up @@ -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):
Expand Down
1 change: 0 additions & 1 deletion python/plugins/processing/algs/r/RAlgorithm.py
Expand Up @@ -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()
Expand Down
5 changes: 2 additions & 3 deletions python/plugins/processing/core/GeoAlgorithm.py
Expand Up @@ -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

Expand Down Expand Up @@ -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.
Expand All @@ -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:
Expand Down
23 changes: 12 additions & 11 deletions python/plugins/processing/core/outputs.py
Expand Up @@ -40,6 +40,7 @@

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


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


class Output(object):

def __init__(self, name='', description='', hidden=False):
Expand Down Expand Up @@ -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():
Expand All @@ -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:
Expand All @@ -138,7 +140,7 @@ def tr(self, string, context=''):


class OutputDirectory(Output):

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

Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -389,7 +390,7 @@ def _resolveTemporary(self, alg):
else:
ext = self.getDefaultFileExtension()
return getTempFilenameInTempFolder(self.name + '.' + ext)


def getOutputFromString(s):
try:
Expand All @@ -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':
Expand Down Expand Up @@ -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.