Skip to content

Commit 50a785b

Browse files
alexbruyvolaya
authored andcommitted
[processing] indentation update
1 parent f002321 commit 50a785b

File tree

6 files changed

+35
-36
lines changed

6 files changed

+35
-36
lines changed

python/plugins/processing/algs/qgis/FieldsMapper.py

-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ def setValue(self, value):
8686
return False
8787
return False
8888

89-
9089
self.addParameter(ParameterFieldsMapping(self.FIELDS_MAPPING,
9190
self.tr('Fields mapping'),
9291
self.INPUT_LAYER))

python/plugins/processing/algs/qgis/RasterCalculator.py

+16-13
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
from processing.core.GeoAlgorithmExecutionException import GeoAlgorithmExecutionException
4040
from processing.algs.qgis.ui.RasterCalculatorWidgets import LayersListWidgetWrapper, ExpressionWidgetWrapper
4141

42+
4243
class RasterCalculator(GeoAlgorithm):
4344

4445
LAYERS = 'LAYERS'
@@ -52,11 +53,13 @@ def defineCharacteristics(self):
5253
self.group, self.i18n_group = self.trAlgorithm('Raster')
5354

5455
self.addParameter(ParameterMultipleInput(self.LAYERS,
55-
self.tr('Input layers'),
56-
datatype=dataobjects.TYPE_RASTER,
57-
optional=True,
58-
metadata={'widget_wrapper': LayersListWidgetWrapper}))
56+
self.tr('Input layers'),
57+
datatype=dataobjects.TYPE_RASTER,
58+
optional=True,
59+
metadata={'widget_wrapper': LayersListWidgetWrapper}))
60+
5961
class ParameterRasterCalculatorExpression(ParameterString):
62+
6063
def evaluateForModeler(self, value, model):
6164
# print value
6265
for i in list(model.inputs.values()):
@@ -76,8 +79,8 @@ def evaluateForModeler(self, value, model):
7679
return value
7780

7881
self.addParameter(ParameterRasterCalculatorExpression(self.EXPRESSION, self.tr('Expression'),
79-
multiline=True,
80-
metadata={'widget_wrapper': ExpressionWidgetWrapper}))
82+
multiline=True,
83+
metadata={'widget_wrapper': ExpressionWidgetWrapper}))
8184
self.addParameter(ParameterNumber(self.CELLSIZE,
8285
self.tr('Cellsize (use 0 or empty to set it automatically)'),
8386
minValue=0.0, default=0.0, optional=True))
@@ -86,7 +89,6 @@ def evaluateForModeler(self, value, model):
8689
optional=True))
8790
self.addOutput(OutputRaster(self.OUTPUT, self.tr('Output')))
8891

89-
9092
def processAlgorithm(self, progress):
9193
expression = self.getParameterValue(self.EXPRESSION)
9294
layersValue = self.getParameterValue(self.LAYERS)
@@ -123,19 +125,20 @@ def processAlgorithm(self, progress):
123125
bbox.combineExtentWith(lyr.extent())
124126
else:
125127
raise GeoAlgorithmExecutionException(self.tr("No layers selected"))
128+
126129
def _cellsize(layer):
127130
return (layer.extent().xMaximum() - layer.extent().xMinimum()) / layer.width()
128131
cellsize = self.getParameterValue(self.CELLSIZE) or min([_cellsize(lyr) for lyr in layersDict.values()])
129132
width = math.floor((bbox.xMaximum() - bbox.xMinimum()) / cellsize)
130133
height = math.floor((bbox.yMaximum() - bbox.yMinimum()) / cellsize)
131134
driverName = GdalUtils.getFormatShortNameFromFilename(output)
132135
calc = QgsRasterCalculator(expression,
133-
output,
134-
driverName,
135-
bbox,
136-
width,
137-
height,
138-
entries)
136+
output,
137+
driverName,
138+
bbox,
139+
width,
140+
height,
141+
entries)
139142

140143
res = calc.processCalculation()
141144
if res == QgsRasterCalculator.ParserError:

python/plugins/processing/algs/qgis/ui/RasterCalculatorWidgets.py

+10-13
Original file line numberDiff line numberDiff line change
@@ -20,37 +20,38 @@ class ExpressionWidget(BASE, WIDGET):
2020
def __init__(self, options):
2121
super(ExpressionWidget, self).__init__(None)
2222
self.setupUi(self)
23-
23+
2424
self.setList(options)
25-
25+
2626
def doubleClicked(item):
2727
self.text.insertPlainText(self.options[item.text()])
28+
2829
def addButtonText(text):
2930
if any(c for c in text if c.islower()):
3031
self.text.insertPlainText(" %s()" % text)
3132
self.text.moveCursor(QTextCursor.PreviousCharacter, QTextCursor.MoveAnchor)
3233
else:
33-
self.text.insertPlainText(" %s " % text)
34+
self.text.insertPlainText(" %s " % text)
3435
buttons = [b for b in self.buttonsGroupBox.children()if isinstance(b, QPushButton)]
3536
for button in buttons:
3637
button.clicked.connect(partial(addButtonText, button.text()))
3738
self.listWidget.itemDoubleClicked.connect(doubleClicked)
38-
39+
3940
def setList(self, options):
4041
self.options = options
4142
self.listWidget.clear()
4243
for opt in options.keys():
4344
self.listWidget.addItem(opt)
44-
45+
4546
def setValue(self, value):
4647
self.text.setPlainText(value)
47-
48+
4849
def value(self):
4950
return self.text.toPlainText()
5051

51-
52+
5253
class ExpressionWidgetWrapper(WidgetWrapper):
53-
54+
5455
def _panel(self, options):
5556
return ExpressionWidget(options)
5657

@@ -61,7 +62,7 @@ def createWidget(self):
6162
for lyr in layers:
6263
for n in xrange(lyr.bandCount()):
6364
name = '%s@%i' % (lyr.name(), n + 1)
64-
options[name] = name
65+
options[name] = name
6566
return self._panel(options)
6667
elif self.dialogType == DIALOG_BATCH:
6768
return QLineEdit()
@@ -109,7 +110,6 @@ def setValue(self, value):
109110
if self.dialogType == DIALOG_BATCH:
110111
return self.widget.setText(value)
111112

112-
113113
def value(self):
114114
if self.dialogType == DIALOG_STANDARD:
115115
if self.param.datatype == dataobjects.TYPE_FILE:
@@ -130,6 +130,3 @@ def value(self):
130130
if len(values) == 0 and not self.param.optional:
131131
raise InvalidParameterValue()
132132
return values
133-
134-
135-

python/plugins/processing/core/GeoAlgorithm.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
from processing.tools import dataobjects, vector
4949
from processing.algs.help import shortHelp
5050

51+
5152
class GeoAlgorithm(object):
5253

5354
def __init__(self):
@@ -132,10 +133,9 @@ def defineCharacteristics(self):
132133
"""
133134
pass
134135

135-
136136
def getParametersPanel(self, parent):
137-
return ParametersPanel(parent, self)
138-
137+
return ParametersPanel(parent, self)
138+
139139
def getCustomParametersDialog(self):
140140
"""If the algorithm has a custom parameters dialog, it should
141141
be returned here, ready to be executed.
@@ -185,12 +185,12 @@ def checkParameterValuesBeforeExecuting(self):
185185
calling from the console.
186186
"""
187187
return None
188-
188+
189189
def processBeforeAddingToModeler(self, alg, model):
190190
"""Add here any task that has to be performed before adding an algorithm
191191
to a model, such as changing the value of a parameter depending on value
192-
of another one"""
193-
pass
192+
of another one"""
193+
pass
194194

195195
# =========================================================
196196

python/plugins/processing/gui/ParametersPanel.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -119,10 +119,10 @@ def initWidgets(self):
119119
button.toggled.connect(self.buttonToggled)
120120
widget = QWidget()
121121
widget.setLayout(layout)
122-
122+
123123
tooltips = self.alg.getParameterDescriptions()
124124
widget.setToolTip(tooltips.get(param.name, param.description))
125-
125+
126126
label = QLabel(desc)
127127
# label.setToolTip(tooltip)
128128
self.labels[param.name] = label

python/plugins/processing/modeler/ModelerParametersDialog.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ def setupUi(self):
158158
label.setVisible(self.showAdvanced)
159159
widget.setVisible(self.showAdvanced)
160160
self.widgets[param.name] = widget
161-
161+
162162
self.verticalLayout.addWidget(label)
163163
self.verticalLayout.addWidget(widget)
164164

0 commit comments

Comments
 (0)