Skip to content

Commit 9a89408

Browse files
committedNov 10, 2015
indentation update
1 parent b57d5ab commit 9a89408

26 files changed

+218
-200
lines changed
 

‎python/gui/qgsactionmenu.sip

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,5 +64,5 @@ class QgsActionMenu : QMenu
6464

6565
signals:
6666
void reinit();
67-
67+
6868
};

‎python/gui/qgsadvanceddigitizingcanvasitem.sip

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* @brief The QgsAdvancedDigitizingCanvasItem class draws the graphical elements of the CAD tools (@see QgsAdvancedDigitizingDock) on the map canvas.
33
*/
4-
4+
55
class QgsAdvancedDigitizingCanvasItem : QgsMapCanvasItem
66
{
77
%TypeHeaderCode

‎python/plugins/processing/algs/otb/OTBSpecific_XMLLoading.py

Lines changed: 25 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,14 @@
3939

4040
try:
4141
import processing
42-
except ImportError, e:
42+
except ImportError as e:
4343
raise Exception("Processing must be installed and available in PYTHONPATH")
4444

4545
from processing.core.ProcessingConfig import ProcessingConfig
4646

4747
from OTBUtils import OTBUtils
4848

4949

50-
5150
def adaptBinaryMorphologicalOperation(commands_list):
5251
val = commands_list[commands_list.index("-filter") + 1]
5352

@@ -105,7 +104,7 @@ def adaptSplitImage(commands_list):
105104
item = item.replace(".file", ".tif")
106105
if item == "-out":
107106
index = commands_list.index(item)
108-
if "." not in os.path.basename(commands_list[index + 1] ):
107+
if "." not in os.path.basename(commands_list[index + 1]):
109108
commands_list[index + 1] = commands_list[index + 1][:-1] + ".tif" + commands_list[index + 1][-1]
110109
commands_list2.append(item)
111110
return commands_list2
@@ -122,12 +121,13 @@ def adaptLSMSVectorization(commands_list):
122121
item = item.replace(".file", ".shp")
123122
if item == "-out":
124123
index = commands_list.index(item)
125-
if "." not in os.path.basename(commands_list[index + 1] ):
124+
if "." not in os.path.basename(commands_list[index + 1]):
126125
commands_list[index + 1] = commands_list[index + 1][:-1] + ".shp" + commands_list[index + 1][-1]
127126
commands_list2.append(item)
128127

129128
return commands_list2
130129

130+
131131
def adaptComputeImagesStatistics(commands_list):
132132
"""
133133
Ran by default, the extension of output file is .file. Replace it with ".xml"
@@ -140,7 +140,7 @@ def adaptComputeImagesStatistics(commands_list):
140140
commands_list2.append(item)
141141
if item == "-out":
142142
index = commands_list.index(item)
143-
if "." not in os.path.basename(commands_list[index + 1] ):
143+
if "." not in os.path.basename(commands_list[index + 1]):
144144
commands_list[index + 1] = commands_list[index + 1][:-1] + ".xml" + commands_list[index + 1][-1]
145145

146146
return commands_list2
@@ -159,7 +159,7 @@ def adaptKmzExport(commands_list):
159159
item = item.replace(".file", ".kmz")
160160
if item == "-out":
161161
index = commands_list.index(item)
162-
if "." not in os.path.basename(commands_list[index + 1] ):
162+
if "." not in os.path.basename(commands_list[index + 1]):
163163
commands_list[index + 1] = commands_list[index + 1][:-1] + ".kmz" + commands_list[index + 1][-1]
164164

165165
commands_list2.append(item)
@@ -171,11 +171,10 @@ def adaptColorMapping(commands_list):
171171
The output of this algorithm must be in uint8.
172172
"""
173173
indexInput = commands_list.index("-out")
174-
commands_list[indexInput+1] = commands_list[indexInput+1] + " uint8"
174+
commands_list[indexInput + 1] = commands_list[indexInput + 1] + " uint8"
175175
return commands_list
176176

177177

178-
179178
def adaptStereoFramework(commands_list):
180179
"""
181180
Remove parameter and user value instead of giving None.
@@ -186,7 +185,7 @@ def adaptStereoFramework(commands_list):
186185
for item in commands_list:
187186
if "None" in item:
188187
index = commands_list2.index(item)
189-
argumentToRemove = commands_list2[index-1]
188+
argumentToRemove = commands_list2[index - 1]
190189
commands_list2.remove(item)
191190
commands_list2.remove(argumentToRemove)
192191
#commands_list2.append(item)
@@ -204,7 +203,7 @@ def adaptComputeConfusionMatrix(commands_list):
204203
item = item.replace(".file", ".csv")
205204
if item == "-out":
206205
index = commands_list.index(item)
207-
if "." not in os.path.basename(commands_list[index + 1] ):
206+
if "." not in os.path.basename(commands_list[index + 1]):
208207
commands_list[index + 1] = commands_list[index + 1][:-1] + ".csv" + commands_list[index + 1][-1]
209208

210209
commands_list2.append(item)
@@ -222,12 +221,12 @@ def adaptRadiometricIndices(commands_list):
222221
"ri" : "Soil:RI", "ci" : "Soil:CI", "bi" : "Soil:BI", "bi2" : "Soil:BI2"}
223222
"""
224223
# "laindvilog" : , "lairefl" : , "laindviformo" : ,
225-
indices = {"ndvi" : "Vegetation:NDVI", "tndvi" : "Vegetation:TNDVI", "rvi" : "Vegetation:RVI", "savi" : "Vegetation:SAVI",
226-
"tsavi" : "Vegetation:TSAVI", "msavi" : "Vegetation:MSAVI", "msavi2" : "Vegetation:MSAVI2", "gemi" : "Vegetation:GEMI",
227-
"ipvi" : "Vegetation:IPVI",
228-
"ndwi" : "Water:NDWI", "ndwi2" : "Water:NDWI2", "mndwi" :"Water:MNDWI" , "ndpi" : "Water:NDPI",
229-
"ndti" : "Water:NDTI",
230-
"ri" : "Soil:RI", "ci" : "Soil:CI", "bi" : "Soil:BI", "bi2" : "Soil:BI2"}
224+
indices = {"ndvi": "Vegetation:NDVI", "tndvi": "Vegetation:TNDVI", "rvi": "Vegetation:RVI", "savi": "Vegetation:SAVI",
225+
"tsavi": "Vegetation:TSAVI", "msavi": "Vegetation:MSAVI", "msavi2": "Vegetation:MSAVI2", "gemi": "Vegetation:GEMI",
226+
"ipvi": "Vegetation:IPVI",
227+
"ndwi": "Water:NDWI", "ndwi2": "Water:NDWI2", "mndwi": "Water:MNDWI", "ndpi": "Water:NDPI",
228+
"ndti": "Water:NDTI",
229+
"ri": "Soil:RI", "ci": "Soil:CI", "bi": "Soil:BI", "bi2": "Soil:BI2"}
231230
for item in commands_list:
232231
if item in indices:
233232
commands_list[commands_list.index(item)] = indices[item]
@@ -251,7 +250,7 @@ def adaptConnectedComponentSegmentation(commands_list):
251250
for item in commands_list:
252251
if "None" in item:
253252
index = commands_list2.index(item)
254-
argumentToRemove = commands_list2[index-1]
253+
argumentToRemove = commands_list2[index - 1]
255254
commands_list2.remove(item)
256255
commands_list2.remove(argumentToRemove)
257256
#commands_list2.append(item)
@@ -289,25 +288,25 @@ def adaptTrainImagesClassifier(commands_list):
289288
adaptGeoidSrtm(commands_list)
290289
return commands_list
291290

291+
292292
def adaptGeoidSrtm(commands_list):
293293
"""
294294
Check geoid file, srtm folder and given elevation and manage arguments.
295295
"""
296296
srtm, geoid = ckeckGeoidSrtmSettings()
297297

298-
299-
if srtm :
300-
if commands_list[0].endswith("ExtractROI") :
298+
if srtm:
299+
if commands_list[0].endswith("ExtractROI"):
301300
commands_list.append("-mode.fit.elev.dem")
302301
commands_list.append(srtm)
303-
else :
302+
else:
304303
commands_list.append("-elev.dem")
305304
commands_list.append(srtm)
306-
if geoid :
307-
if commands_list[0].endswith("ExtractROI") :
305+
if geoid:
306+
if commands_list[0].endswith("ExtractROI"):
308307
commands_list.append("-mode.fit.elev.geoid")
309308
commands_list.append(geoid)
310-
else :
309+
else:
311310
commands_list.append("-elev.geoid")
312311
commands_list.append(geoid)
313312

@@ -349,10 +348,10 @@ def adaptComputeOGRLayersFeaturesStatistics(commands_list):
349348
def ckeckGeoidSrtmSettings():
350349
folder = ProcessingConfig.getSetting(OTBUtils.OTB_SRTM_FOLDER)
351350
if folder is None:
352-
folder =""
351+
folder = ""
353352

354353
filepath = ProcessingConfig.getSetting(OTBUtils.OTB_GEOID_FILE)
355354
if filepath is None:
356-
filepath =""
355+
filepath = ""
357356

358357
return folder, filepath

‎python/plugins/processing/algs/otb/maintenance/OTBHelper.py

Lines changed: 78 additions & 59 deletions
Large diffs are not rendered by default.

‎python/plugins/processing/algs/otb/maintenance/OTBSpecific_XMLcreation.py

Lines changed: 15 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,14 @@
3333
import copy
3434

3535
from processing.algs.otb.OTBUtils import (renameValueField,
36-
remove_dependant_choices,
37-
remove_other_choices,
38-
remove_parameter_by_key,
39-
defaultSplit,
40-
split_by_choice,
41-
defaultWrite,
42-
remove_choice,
43-
remove_independant_choices )
36+
remove_dependant_choices,
37+
remove_other_choices,
38+
remove_parameter_by_key,
39+
defaultSplit,
40+
split_by_choice,
41+
defaultWrite,
42+
remove_choice,
43+
remove_independant_choices)
4444

4545

4646
def getBinaryMorphologicalOperation(available_app, original_dom_document):
@@ -128,9 +128,6 @@ def getOrthoRectification(available_app, original_dom_document):
128128
remove_independant_choices(the_root, 'outputs.mode', 'orthofit')
129129
merged = copy.deepcopy(the_root)
130130

131-
132-
133-
134131
split = split_by_choice(the_root, 'map')
135132
the_list = []
136133

@@ -399,6 +396,7 @@ def getSmoothing(available_app, original_dom_document):
399396
# the_list.append(split[key])
400397
#return the_list
401398

399+
402400
def getColorMapping(available_app, original_dom_document):
403401
"""
404402
Remove the option colortolabel
@@ -454,7 +452,6 @@ def getColorMapping(available_app, original_dom_document):
454452
return the_list
455453

456454

457-
458455
def getFusionOfClassifications(available_app, original_dom_document):
459456
"""
460457
Split by method of fusion of classification (dempstershafer, majorityvoting)
@@ -484,7 +481,6 @@ def getTrainImagesClassifier(available_app, original_dom_document):
484481
return the_list
485482

486483

487-
488484
def getLineSegmentDetection(available_app, original_dom_document):
489485
"""
490486
Delete GEOID and DEM parameter as they are not updated at the creation of the otb algorithms when you launch QGIS.
@@ -498,7 +494,6 @@ def getLineSegmentDetection(available_app, original_dom_document):
498494
return [the_root]
499495

500496

501-
502497
def getImageEnvelope(available_app, original_dom_document):
503498
"""
504499
Delete GEOID and DEM parameter as they are not updated at the creation of the otb algorithms when you launch QGIS.
@@ -553,7 +548,6 @@ def getReadImageInfo(available_app, original_dom_document):
553548
return [the_root]
554549

555550

556-
557551
def getComputeModulusAndPhase(available_app, original_dom_document):
558552
"""
559553
Split the application according the field nbinput.
@@ -570,7 +564,7 @@ def getComputeModulusAndPhase(available_app, original_dom_document):
570564
the_doc.find('longname').text = '%s (%s)' % (old_app_name, 'OneEntry')
571565
defaultWrite('%s-%s' % (available_app, 'OneEntry'), the_doc)
572566
the_list.append(the_doc)
573-
else :
567+
else:
574568
the_doc = split[key]
575569
old_app_name = the_doc.find('key').text
576570
the_doc.find('key').text = '%s-%s' % (old_app_name, 'TwoEntries')
@@ -610,7 +604,7 @@ def getConnectedComponentSegmentation(available_app, original_dom_document):
610604
The values are picked from the settings.
611605
"""
612606
the_root = original_dom_document
613-
deleteGeoidSrtm( the_root )
607+
deleteGeoidSrtm(the_root)
614608
defaultWrite(available_app, the_root)
615609
return [the_root]
616610

@@ -621,7 +615,7 @@ def getKmzExport(available_app, original_dom_document):
621615
The values are picked from the settings.
622616
"""
623617
the_root = original_dom_document
624-
deleteGeoidSrtm( the_root )
618+
deleteGeoidSrtm(the_root)
625619
defaultWrite(available_app, the_root)
626620
return [the_root]
627621

@@ -632,7 +626,7 @@ def getSuperimpose(available_app, original_dom_document):
632626
The values are picked from the settings.
633627
"""
634628
the_root = original_dom_document
635-
deleteGeoidSrtm( the_root )
629+
deleteGeoidSrtm(the_root)
636630
defaultWrite(available_app, the_root)
637631
return [the_root]
638632

@@ -643,7 +637,7 @@ def getStereoFramework(available_app, original_dom_document):
643637
The values are picked from the settings.
644638
"""
645639
the_root = original_dom_document
646-
deleteGeoidSrtm( the_root )
640+
deleteGeoidSrtm(the_root)
647641
defaultWrite(available_app, the_root)
648642
return [the_root]
649643

@@ -725,7 +719,7 @@ def getDespeckle(available_app, original_dom_document):
725719
return the_list
726720

727721

728-
def deleteGeoidSrtm(doc) :
722+
def deleteGeoidSrtm(doc):
729723
"""
730724
Delete GEOID and DEM parameter as they are not updated at the creation of the otb algorithms when you launch QGIS.
731725
The values are picked from the settings.

‎python/plugins/processing/algs/qgis/spatialite_utils.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727

2828
from pyspatialite import dbapi2 as sqlite
2929

30+
3031
class DbError(Exception):
3132

3233
def __init__(self, message, query=None):
@@ -36,19 +37,20 @@ def __init__(self, message, query=None):
3637

3738
def __str__(self):
3839
return 'MESSAGE: %s\nQUERY: %s' % (self.message, self.query)
39-
40+
41+
4042
class GeoDB:
4143

4244
def __init__(self, uri=None):
4345
self.uri = uri
4446
self.dbname = uri.database()
45-
47+
4648
try:
4749
self.con = sqlite.connect(self.con_info())
4850

4951
except (sqlite.InterfaceError, sqlite.OperationalError) as e:
5052
raise DbError(e.message)
51-
53+
5254
self.has_spatialite = self.check_spatialite()
5355
if not self.has_spatialite:
5456
self.has_spatialite = self.init_spatialite()
@@ -77,15 +79,15 @@ def init_spatialite(self):
7779
return False
7880
finally:
7981
self.con.close()
80-
82+
8183
try:
8284
self.con = sqlite.connect(self.con_info())
8385

8486
except (sqlite.InterfaceError, sqlite.OperationalError) as e:
8587
raise DbError(e.message)
86-
88+
8789
return self.check_spatialite()
88-
90+
8991
def check_spatialite(self):
9092
try:
9193
c = self.con.cursor()
@@ -99,13 +101,13 @@ def check_spatialite(self):
99101

100102
self.has_geometry_columns_access = self.has_geometry_columns
101103
return self.has_geometry_columns
102-
104+
103105
def _exec_sql(self, cursor, sql):
104106
try:
105107
cursor.execute(sql)
106108
except (sqlite.Error, sqlite.ProgrammingError, sqlite.Warning, sqlite.InterfaceError, sqlite.OperationalError) as e:
107109
raise DbError(e.message, sql)
108-
110+
109111
def _exec_sql_and_commit(self, sql):
110112
"""Tries to execute and commit some action, on error it rolls
111113
back the change.

‎python/plugins/processing/core/Processing.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -357,10 +357,10 @@ def runAlgorithm(algOrName, onFinish, *args, **kwargs):
357357

358358
progress = None
359359
if kwargs is not None and "progress" in kwargs.keys():
360-
progress = kwargs["progress"]
361-
elif iface is not None :
360+
progress = kwargs["progress"]
361+
elif iface is not None:
362362
progress = MessageBarProgress()
363-
363+
364364
ret = runalg(alg, progress)
365365
if ret:
366366
if onFinish is not None:

‎python/plugins/processing/core/parameters.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ def getValueAsCommandLineParameter(self):
160160
def getAsScriptCode(self):
161161
return '##' + self.name + '=crs ' + str(self.default)
162162

163+
163164
class ParameterDataObject(Parameter):
164165

165166
def getValueAsCommandLineParameter(self):
@@ -206,6 +207,7 @@ def getValueAsCommandLineParameter(self):
206207
def getAsScriptCode(self):
207208
return '##' + self.name + '=extent'
208209

210+
209211
class ParameterFile(Parameter):
210212

211213
def __init__(self, name='', description='', isFolder=False, optional=True, ext=None):
@@ -428,6 +430,7 @@ def getAsScriptCode(self):
428430
else:
429431
return '##' + self.name + '=multiple vector'
430432

433+
431434
class ParameterNumber(Parameter):
432435

433436
def __init__(self, name='', description='', minValue=None, maxValue=None,
@@ -471,10 +474,10 @@ def setValue(self, n):
471474
except:
472475
return False
473476

474-
475477
def getAsScriptCode(self):
476478
return '##' + self.name + '=number ' + str(self.default)
477479

480+
478481
class ParameterRange(Parameter):
479482

480483
def __init__(self, name='', description='', default='0,1', optional=False):
@@ -634,12 +637,13 @@ def setValue(self, obj):
634637

635638
def getValueAsCommandLineParameter(self):
636639
return ('"' + unicode(self.value.replace(ParameterString.NEWLINE,
637-
ParameterString.ESCAPED_NEWLINE)) + '"'
638-
if self.value is not None else unicode(None))
640+
ParameterString.ESCAPED_NEWLINE)) + '"'
641+
if self.value is not None else unicode(None))
639642

640643
def getAsScriptCode(self):
641644
return '##' + self.name + '=string ' + self.default
642645

646+
643647
class ParameterTable(ParameterDataObject):
644648

645649
def __init__(self, name='', description='', optional=False):

‎python/plugins/processing/gui/ConfigDialog.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,9 +144,9 @@ def accept(self):
144144
else:
145145
try:
146146
setting.setValue(unicode(self.items[setting].text()))
147-
except ValueError, e:
147+
except ValueError as e:
148148
QMessageBox.warning(self, self.tr('Wrong value'),
149-
self.tr('Wrong value for parameter "%s":\n\n%s' %(setting.description, unicode(e))))
149+
self.tr('Wrong value for parameter "%s":\n\n%s' % (setting.description, unicode(e))))
150150
return
151151
setting.save()
152152
Processing.updateAlgsList()
@@ -228,7 +228,6 @@ def setModelData(self, editor, model, index):
228228
else:
229229
model.setData(index, editor.value(), Qt.EditRole)
230230

231-
232231
def sizeHint(self, option, index):
233232
return QSpinBox().sizeHint()
234233

‎python/plugins/processing/gui/GetScriptsAndModels.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
WIDGET, BASE = uic.loadUiType(
5151
os.path.join(pluginPath, 'ui', 'DlgGetScriptsAndModels.ui'))
5252

53+
5354
class GetScriptsAction(ToolboxAction):
5455

5556
def __init__(self):
@@ -115,9 +116,9 @@ class GetScriptsAndModelsDialog(BASE, WIDGET):
115116
SCRIPTS = 1
116117
RSCRIPTS = 2
117118

118-
tr_disambiguation = { 0: 'GetModelsAction',
119-
1: 'GetScriptsAction',
120-
2: 'GetRScriptsAction' }
119+
tr_disambiguation = {0: 'GetModelsAction',
120+
1: 'GetScriptsAction',
121+
2: 'GetRScriptsAction'}
121122

122123
def __init__(self, resourceType):
123124
super(GetScriptsAndModelsDialog, self).__init__(iface.mainWindow())
@@ -144,7 +145,7 @@ def __init__(self, resourceType):
144145
self.buttonBox.accepted.connect(self.okPressed)
145146
self.buttonBox.rejected.connect(self.cancelPressed)
146147
self.tree.currentItemChanged.connect(self.currentItemChanged)
147-
148+
148149
def popupError(self, error=None, url=None):
149150
"""Popups an Error message bar for network errors."""
150151
disambiguation = self.tr_disambiguation[self.resourceType]
@@ -156,7 +157,7 @@ def popupError(self, error=None, url=None):
156157
widget.layout().addWidget(button)
157158

158159
iface.messageBar().pushWidget(widget, level=QgsMessageBar.CRITICAL, duration=5)
159-
160+
160161
def grabHTTP(self, url, loadFunction, arguments=None):
161162
"""Grab distant content via QGIS internal classes and QtNetwork."""
162163
QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))
@@ -166,7 +167,7 @@ def grabHTTP(self, url, loadFunction, arguments=None):
166167
reply.finished.connect(partial(loadFunction, reply, arguments))
167168
else:
168169
reply.finished.connect(partial(loadFunction, reply))
169-
170+
170171
def populateTree(self):
171172
self.uptodateItem = QTreeWidgetItem()
172173
self.uptodateItem.setText(0, self.tr('Installed'))
@@ -181,7 +182,7 @@ def populateTree(self):
181182

182183
def treeLoaded(self, reply):
183184
"""
184-
update the tree of scripts/models whenever
185+
update the tree of scripts/models whenever
185186
HTTP request is finished
186187
"""
187188
QApplication.restoreOverrideCursor()
@@ -219,7 +220,7 @@ def setHelp(self, reply, item):
219220
html += self.tr('<p><b>Version:</b> %s') % getDescription(ALG_VERSION, descriptions)
220221
reply.deleteLater()
221222
self.webView.setHtml(html)
222-
223+
223224
def currentItemChanged(self, item, prev):
224225
if isinstance(item, TreeItem):
225226
url = self.urlBase + item.filename.replace(' ', '%20') + '.help'
@@ -283,7 +284,7 @@ def okPressed(self):
283284
QCoreApplication.processEvents()
284285
url = self.urlBase + filename.replace(' ', '%20')
285286
self.grabHTTP(url, self.storeFile, filename)
286-
287+
287288
url += '.help'
288289
self.grabHTTP(url, self.storeFile, filename + '.help')
289290

‎python/plugins/processing/gui/OutputSelectionPanel.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -117,14 +117,14 @@ def saveToPostGIS(self):
117117
uri.setConnection(host, str(port), dbname, user, password)
118118
uri.setDataSource(dlg.schema, dlg.table, "the_geom")
119119
connInfo = uri.connectionInfo()
120-
(success, user, passwd ) = QgsCredentials.instance().get(connInfo, None, None)
120+
(success, user, passwd) = QgsCredentials.instance().get(connInfo, None, None)
121121
if success:
122122
QgsCredentials.instance().put(connInfo, user, passwd)
123123
self.leText.setText("postgis:" + uri.uri())
124124

125125
def saveToSpatialite(self):
126126
fileFilter = self.output.tr('Spatialite files(*.sqlite)', 'OutputFile')
127-
127+
128128
settings = QSettings()
129129
if settings.contains('/Processing/LastOutputPath'):
130130
path = settings.value('/Processing/LastOutputPath')
@@ -152,7 +152,7 @@ def saveToSpatialite(self):
152152
settings.setValue('/Processing/LastOutputPath',
153153
os.path.dirname(fileName))
154154
settings.setValue('/Processing/encoding', encoding)
155-
155+
156156
uri = QgsDataSourceURI()
157157
uri.setDatabase(fileName)
158158
uri.setDataSource('', self.output.name.lower(), 'the_geom')
@@ -195,7 +195,7 @@ def selectFile(self):
195195

196196
def selectDirectory(self):
197197
lastDir = ''
198-
dirName = QFileDialog.getExistingDirectory(self,self.tr('Select directory'),
198+
dirName = QFileDialog.getExistingDirectory(self, self.tr('Select directory'),
199199
lastDir, QFileDialog.ShowDirsOnly)
200200
self.leText.setText(dirName)
201201

@@ -215,6 +215,4 @@ def getValue(self):
215215
else:
216216
value = fileName
217217

218-
219-
220218
return value

‎python/plugins/processing/gui/PostgisTableSelector.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ def okPressed(self):
5454
self.connection = item.parent().text(0)
5555
self.close()
5656

57+
5758
class ConnectionItem(QtGui.QTreeWidgetItem):
5859

5960
connIcon = QtGui.QIcon(os.path.dirname(__file__) + '/../images/postgis.png')
@@ -79,7 +80,7 @@ def populateSchemas(self):
7980
uri = QgsDataSourceURI()
8081
uri.setConnection(host, str(port), database, user, passwd)
8182
connInfo = uri.connectionInfo()
82-
(success, user, passwd ) = QgsCredentials.instance().get(connInfo, None, None)
83+
(success, user, passwd) = QgsCredentials.instance().get(connInfo, None, None)
8384
if success:
8485
QgsCredentials.instance().put(connInfo, user, passwd)
8586
geodb = GeoDB(host, int(port), database, user, passwd)
@@ -89,4 +90,3 @@ def populateSchemas(self):
8990
item.setText(0, name)
9091
item.setIcon(0, self.schemaIcon)
9192
self.addChild(item)
92-

‎python/plugins/processing/modeler/ModelerAlgorithm.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ def toPython(self):
128128
params = []
129129
for param in self.algorithm.parameters:
130130
value = self.params[param.name]
131+
131132
def _toString(v):
132133
if isinstance(v, (ValueFromInput, ValueFromOutput)):
133134
return v.asPythonParameter()
@@ -167,6 +168,7 @@ def __eq__(self, other):
167168
def asPythonParameter(self):
168169
return self.name
169170

171+
170172
class ValueFromOutput():
171173

172174
def __init__(self, alg="", output=""):
@@ -687,7 +689,6 @@ def _tr(s):
687689
else:
688690
raise WrongModelException(_tr('Error in model definition line: ') + '%s\n%s' % (line.strip(), traceback.format_exc()))
689691

690-
691692
def toPython(self):
692693
s = ['##%s=name' % self.name]
693694
for param in self.inputs.values():
@@ -713,6 +714,7 @@ def toPython(self):
713714

714715
return '\n'.join(s)
715716

717+
716718
def safeName(name):
717719
validChars = 'abcdefghijklmnopqrstuvwxyz'
718-
return ''.join(c for c in name.lower() if c in validChars)
720+
return ''.join(c for c in name.lower() if c in validChars)

‎python/plugins/processing/modeler/ModelerDialog.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -296,8 +296,7 @@ def exportAsPython(self):
296296
with codecs.open(filename, 'w', encoding='utf-8') as fout:
297297
fout.write(text)
298298
QMessageBox.information(self, self.tr('Model exported'),
299-
self.tr('Model was correctly exported.'))
300-
299+
self.tr('Model was correctly exported.'))
301300

302301
def saveModel(self, saveAs):
303302
if unicode(self.textGroup.text()).strip() == '' \

‎python/plugins/processing/script/ScriptAlgorithm.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,6 @@ def processParameterLine(self, line):
159159
else:
160160
param = self.processInputParameterToken(tokens[1], tokens[0])
161161

162-
163162
if param is not None:
164163
self.addParameter(param)
165164
elif out is not None:

‎python/plugins/processing/tools/system.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ def userFolder():
4545

4646
return unicode(QDir.toNativeSeparators(userDir))
4747

48+
4849
def defaultOutputFolder():
4950
folder = os.path.join(os.path.dirname(QgsApplication.qgisUserDbFilePath()),
5051
"processing", "outputs")
@@ -53,6 +54,7 @@ def defaultOutputFolder():
5354

5455
return unicode(QDir.toNativeSeparators(folder))
5556

57+
5658
def isWindows():
5759
return os.name == 'nt'
5860

‎python/plugins/processing/tools/vector.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -464,15 +464,15 @@ def __init__(self, destination, encoding, fields, geometryType,
464464
self.isNotFileBased = True
465465
uri = QgsDataSourceURI(self.destination[len(self.POSTGIS_LAYER_PREFIX):])
466466
connInfo = uri.connectionInfo()
467-
(success, user, passwd ) = QgsCredentials.instance().get(connInfo, None, None)
467+
(success, user, passwd) = QgsCredentials.instance().get(connInfo, None, None)
468468
if success:
469469
QgsCredentials.instance().put(connInfo, user, passwd)
470470
else:
471471
raise GeoAlgorithmExecutionException("Couldn't connect to database")
472472
print uri.uri()
473473
try:
474474
db = postgis_utils.GeoDB(host=uri.host(), port=int(uri.port()),
475-
dbname=uri.database(), user=user, passwd=passwd)
475+
dbname=uri.database(), user=user, passwd=passwd)
476476
except postgis_utils.DbError as e:
477477
raise GeoAlgorithmExecutionException(
478478
"Couldn't connect to database:\n%s" % e.message)
@@ -486,12 +486,12 @@ def _runSQL(sql):
486486

487487
fields = [_toQgsField(f) for f in fields]
488488
fieldsdesc = ",".join('%s %s' % (f.name(),
489-
TYPE_MAP_POSTGIS_LAYER.get(f.type(), "VARCHAR"))
489+
TYPE_MAP_POSTGIS_LAYER.get(f.type(), "VARCHAR"))
490490
for f in fields)
491491

492492
_runSQL("CREATE TABLE %s.%s (%s)" % (uri.schema(), uri.table().lower(), fieldsdesc))
493493
_runSQL("SELECT AddGeometryColumn('{schema}', '{table}', 'the_geom', {srid}, '{typmod}', 2)".format(
494-
table=uri.table().lower(), schema=uri.schema(), srid=crs.authid().split(":")[-1],
494+
table=uri.table().lower(), schema=uri.schema(), srid=crs.authid().split(":")[-1],
495495
typmod=GEOM_TYPE_MAP[geometryType].upper()))
496496

497497
self.layer = QgsVectorLayer(uri.uri(), uri.table(), "postgres")
@@ -515,13 +515,13 @@ def _runSQL(sql):
515515

516516
fields = [_toQgsField(f) for f in fields]
517517
fieldsdesc = ",".join('%s %s' % (f.name(),
518-
TYPE_MAP_SPATIALITE_LAYER.get(f.type(), "VARCHAR"))
518+
TYPE_MAP_SPATIALITE_LAYER.get(f.type(), "VARCHAR"))
519519
for f in fields)
520520

521521
_runSQL("DROP TABLE IF EXISTS %s" % uri.table().lower())
522522
_runSQL("CREATE TABLE %s (%s)" % (uri.table().lower(), fieldsdesc))
523523
_runSQL("SELECT AddGeometryColumn('{table}', 'the_geom', {srid}, '{typmod}', 2)".format(
524-
table=uri.table().lower(), srid=crs.authid().split(":")[-1],
524+
table=uri.table().lower(), srid=crs.authid().split(":")[-1],
525525
typmod=GEOM_TYPE_MAP[geometryType].upper()))
526526

527527
self.layer = QgsVectorLayer(uri.uri(), uri.table(), "spatialite")
@@ -545,7 +545,7 @@ def _runSQL(sql):
545545
qgsfields.append(_toQgsField(field))
546546

547547
self.writer = QgsVectorFileWriter(self.destination, encoding,
548-
qgsfields, geometryType, crs, OGRCodes[extension])
548+
qgsfields, geometryType, crs, OGRCodes[extension])
549549

550550
def addFeature(self, feature):
551551
if self.isNotFileBased:

‎src/app/composer/qgscomposerlegendwidget.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ class QgsComposerLegendWidget: public QgsComposerItemBaseWidget, private Ui::Qgs
9999
/** Sets GUI according to state of mLegend*/
100100
void setGuiElements();
101101

102-
/** update the enabling state of the filter by atlas button */
102+
/** Update the enabling state of the filter by atlas button */
103103
void updateFilterLegendByAtlasButton();
104104

105105
private:

‎src/core/qgsvectorlayerfeatureiterator.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -238,13 +238,13 @@ bool QgsVectorLayerFeatureIterator::fetchFeature( QgsFeature& f )
238238

239239
if ( mRequest.filterType() == QgsFeatureRequest::FilterExpression && mProviderRequest.filterType() != QgsFeatureRequest::FilterExpression )
240240
{
241-
//filtering by expression, and couldn't do it on the provider side
242-
mRequest.expressionContext()->setFeature( f );
243-
if ( !mRequest.filterExpression()->evaluate( mRequest.expressionContext() ).toBool() )
244-
{
245-
//feature did not match filter
246-
continue;
247-
}
241+
//filtering by expression, and couldn't do it on the provider side
242+
mRequest.expressionContext()->setFeature( f );
243+
if ( !mRequest.filterExpression()->evaluate( mRequest.expressionContext() ).toBool() )
244+
{
245+
//feature did not match filter
246+
continue;
247+
}
248248
}
249249

250250
// update geometry

‎src/gui/qgsexpressionbuilderwidget.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ QgsExpressionBuilderWidget::QgsExpressionBuilderWidget( QWidget *parent )
101101
QModelIndex firstItem = mProxyModel->index( 0, 0, QModelIndex() );
102102
expressionTree->setCurrentIndex( firstItem );
103103

104-
lblAutoSave->setText("");
104+
lblAutoSave->setText( "" );
105105
}
106106

107107

@@ -208,7 +208,7 @@ void QgsExpressionBuilderWidget::updateFunctionFileList( const QString& path )
208208
{
209209
QFileInfo info( mFunctionsPath + QDir::separator() + name );
210210
if ( info.baseName() == "__init__" ) continue;
211-
QListWidgetItem* item = new QListWidgetItem( QgsApplication::getThemeIcon("console/iconTabEditorConsole.png"), info.baseName() );
211+
QListWidgetItem* item = new QListWidgetItem( QgsApplication::getThemeIcon( "console/iconTabEditorConsole.png" ), info.baseName() );
212212
cmbFileNames->addItem( item );
213213
}
214214
if ( !cmbFileNames->currentItem() )

‎src/gui/qgsmapcanvassnapper.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ int QgsMapCanvasSnapper::snapToCurrentLayer( const QPoint& p, QList<QgsSnappingR
7474
int topologicalEditing = QgsProject::instance()->readNumEntry( "Digitizing", "/TopologicalEditing", 0 );
7575
if ( allResutInTolerance )
7676
{
77-
mSnapper->setSnapMode( QgsSnapper::SnapWithResultsWithinTolerances);
77+
mSnapper->setSnapMode( QgsSnapper::SnapWithResultsWithinTolerances );
7878
}
7979
else if ( topologicalEditing == 0 )
8080
{

‎src/gui/symbology-ng/qgssymbolslistwidget.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ QgsSymbolsListWidget::QgsSymbolsListWidget( QgsSymbolV2* symbol, QgsStyleV2* sty
7373
groupsCombo->addItem( "" );
7474
populateGroups();
7575
QStringList groups = style->smartgroupNames();
76-
Q_FOREACH( const QString& group, groups )
76+
Q_FOREACH ( const QString& group, groups )
7777
{
7878
groupsCombo->addItem( group, QVariant( "smart" ) );
7979
}
@@ -130,11 +130,11 @@ QgsSymbolsListWidget::~QgsSymbolsListWidget()
130130
void QgsSymbolsListWidget::setMapCanvas( QgsMapCanvas* canvas )
131131
{
132132
mMapCanvas = canvas;
133-
Q_FOREACH( QgsUnitSelectionWidget* unitWidget, findChildren<QgsUnitSelectionWidget*>() )
133+
Q_FOREACH ( QgsUnitSelectionWidget* unitWidget, findChildren<QgsUnitSelectionWidget*>() )
134134
{
135135
unitWidget->setMapCanvas( canvas );
136136
}
137-
Q_FOREACH( QgsDataDefinedButton* ddButton, findChildren<QgsDataDefinedButton*>() )
137+
Q_FOREACH ( QgsDataDefinedButton* ddButton, findChildren<QgsDataDefinedButton*>() )
138138
{
139139
if ( ddButton->assistant() )
140140
ddButton->assistant()->setMapCanvas( mMapCanvas );
@@ -429,7 +429,7 @@ void QgsSymbolsListWidget::updateSymbolInfo()
429429
{
430430
updateSymbolColor();
431431

432-
Q_FOREACH( QgsDataDefinedButton* button, findChildren< QgsDataDefinedButton* >() )
432+
Q_FOREACH ( QgsDataDefinedButton* button, findChildren< QgsDataDefinedButton* >() )
433433
{
434434
button->registerGetExpressionContextCallback( &_getExpressionContext, this );
435435
}

‎src/providers/grass/qgsgrassundocommand.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,28 +19,28 @@
1919
#include "qgslogger.h"
2020

2121
QgsGrassUndoCommandChangeAttribute::QgsGrassUndoCommandChangeAttribute( QgsGrassProvider * provider, int fid, int lid, int field, int cat, bool deleteCat, bool deleteRecord )
22-
: mProvider( provider )
23-
, mFid(fid)
24-
, mLid(lid)
25-
, mField(field)
26-
, mCat(cat)
27-
, mDeleteCat(deleteCat)
28-
, mDeleteRecord( deleteRecord )
22+
: mProvider( provider )
23+
, mFid( fid )
24+
, mLid( lid )
25+
, mField( field )
26+
, mCat( cat )
27+
, mDeleteCat( deleteCat )
28+
, mDeleteRecord( deleteRecord )
2929
{
30-
Q_UNUSED(mField);
30+
Q_UNUSED( mField );
3131
}
3232

3333
void QgsGrassUndoCommandChangeAttribute::undo()
3434
{
35-
QgsDebugMsg( QString("mLid = %1 mField = %2, mCat = %3").arg(mLid).arg(mField).arg(mCat) );
35+
QgsDebugMsg( QString( "mLid = %1 mField = %2, mCat = %3" ).arg( mLid ).arg( mField ).arg( mCat ) );
3636
if ( mDeleteCat )
3737
{
3838
int realLine = mLid;
3939
if ( mProvider->mLayer->map()->newLids().contains( mLid ) )
4040
{
4141
realLine = mProvider->mLayer->map()->newLids().value( mLid );
4242
}
43-
QgsDebugMsg( QString("realLine = %1").arg(realLine) );
43+
QgsDebugMsg( QString( "realLine = %1" ).arg( realLine ) );
4444

4545
int type = mProvider->readLine( mProvider->mPoints, mProvider->mCats, realLine );
4646
if ( type <= 0 )
@@ -59,7 +59,7 @@ void QgsGrassUndoCommandChangeAttribute::undo()
5959
mProvider->mLayer->map()->lockReadWrite();
6060
int newLid = mProvider->rewriteLine( realLine, type, mProvider->mPoints, mProvider->mCats );
6161
Q_UNUSED( newLid );
62-
mProvider->mLayer->map()->newCats().remove(mFid);
62+
mProvider->mLayer->map()->newCats().remove( mFid );
6363
mProvider->mLayer->map()->unlockReadWrite();
6464
}
6565
}

‎src/server/qgsconfigparserutils.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ void QgsConfigParserUtils::appendLayerBoundingBoxes( QDomElement& layerElem, QDo
154154
layerElem.appendChild( ExGeoBBoxElement );
155155
//layerElem.appendChild( bBoxElement );
156156
}
157-
157+
158158
//In case the number of advertised CRS is constrained
159159
if ( constrainedCrsList.size() > 0 )
160160
{
@@ -179,15 +179,15 @@ void QgsConfigParserUtils::appendLayerBoundingBox( QDomElement& layerElem, QDomD
179179
{
180180
return;
181181
}
182-
182+
183183
QString version = doc.documentElement().attribute( "version" );
184-
184+
185185
const QgsCoordinateReferenceSystem& crs = QgsCRSCache::instance()->crsByAuthId( crsText );
186-
186+
187187
//transform the layers native CRS into CRS
188188
QgsCoordinateTransform crsTransform( layerCRS, crs );
189189
QgsRectangle crsExtent = crsTransform.transformBoundingBox( layerExtent );
190-
190+
191191
//BoundingBox element
192192
QDomElement bBoxElement = doc.createElement( "BoundingBox" );
193193
if ( crs.isValid() )

‎src/server/qgsconfigparserutils.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class QgsConfigParserUtils
3838
const QgsCoordinateReferenceSystem& layerCRS, const QStringList &crsList,
3939
const QStringList& constrainedCrsList );
4040
static void appendLayerBoundingBox( QDomElement& layerElem, QDomDocument& doc, const QgsRectangle& layerExtent,
41-
const QgsCoordinateReferenceSystem& layerCRS, const QString& crsText );
41+
const QgsCoordinateReferenceSystem& layerCRS, const QString& crsText );
4242
/** Returns a list of supported EPSG coordinate system numbers from a layer*/
4343
static QStringList createCRSListForLayer( QgsMapLayer* theMapLayer );
4444

‎tests/src/python/test_qgsatlascomposition.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -293,32 +293,32 @@ def legend_test(self):
293293
f1.initAttributes(2)
294294
f1.setAttribute(0, 1)
295295
f1.setAttribute(1, "Test label 1")
296-
f1.setGeometry( QgsGeometry.fromPoint(QgsPoint(-0.638,48.954)) )
296+
f1.setGeometry(QgsGeometry.fromPoint(QgsPoint(-0.638, 48.954)))
297297
f2 = QgsFeature(2)
298298
f2.initAttributes(2)
299299
f2.setAttribute(0, 2)
300300
f2.setAttribute(1, "Test label 2")
301-
f2.setGeometry( QgsGeometry.fromPoint(QgsPoint(-1.682,48.550)) )
302-
pr.addFeatures([f1,f2])
301+
f2.setGeometry(QgsGeometry.fromPoint(QgsPoint(-1.682, 48.550)))
302+
pr.addFeatures([f1, f2])
303303

304304
# categorized symbology
305-
r = QgsCategorizedSymbolRendererV2( "attr", [ QgsRendererCategoryV2( 1, QgsMarkerSymbolV2.createSimple( {"color": "255,0,0"} ), "red" ),
306-
QgsRendererCategoryV2( 2, QgsMarkerSymbolV2.createSimple( {"color": "0,0,255"} ), "blue" ) ] )
307-
ptLayer.setRendererV2( r )
305+
r = QgsCategorizedSymbolRendererV2("attr", [QgsRendererCategoryV2(1, QgsMarkerSymbolV2.createSimple({"color": "255,0,0"}), "red"),
306+
QgsRendererCategoryV2(2, QgsMarkerSymbolV2.createSimple({"color": "0,0,255"}), "blue")])
307+
ptLayer.setRendererV2(r)
308308

309309
QgsMapLayerRegistry.instance().addMapLayer(ptLayer)
310310

311311
# add the point layer to the map settings
312312
layers = self.mapSettings.layers()
313-
layers = [ ptLayer.id() ] + layers
314-
self.mapSettings.setLayers( layers )
313+
layers = [ptLayer.id()] + layers
314+
self.mapSettings.setLayers(layers)
315315

316316
# add a legend
317-
legend = QgsComposerLegend( self.mComposition )
318-
legend.moveBy( 200, 100 )
317+
legend = QgsComposerLegend(self.mComposition)
318+
legend.moveBy(200, 100)
319319
# sets the legend filter parameter
320-
legend.setComposerMap( self.mAtlasMap )
321-
legend.setLegendFilterOutAtlas( True )
320+
legend.setComposerMap(self.mAtlasMap)
321+
legend.setLegendFilterOutAtlas(True)
322322
self.mComposition.addComposerLegend(legend)
323323

324324
self.mAtlas.beginRender()
@@ -333,8 +333,8 @@ def legend_test(self):
333333
self.mAtlas.endRender()
334334

335335
# restore state
336-
self.mapSettings.setLayers( [layers[1]] )
337-
self.mComposition.removeComposerItem( legend )
336+
self.mapSettings.setLayers([layers[1]])
337+
self.mComposition.removeComposerItem(legend)
338338
QgsMapLayerRegistry.instance().removeMapLayer(ptLayer.id())
339339

340340

0 commit comments

Comments
 (0)
Please sign in to comment.