Skip to content
Permalink
Browse files

indentation update

  • Loading branch information
jef-n committed Mar 26, 2013
1 parent 4d0be59 commit 250cc4ecb16172c3a2b694eea05507b4fd175501
Showing with 471 additions and 454 deletions.
  1. +2 −2 python/core/qgsgml.sip
  2. +1 −1 python/plugins/sextante/algs/FieldsCalculator.py
  3. +1 −1 python/plugins/sextante/algs/ftools/Intersection.py
  4. +7 −7 python/plugins/sextante/algs/ftools/MeanCoords.py
  5. +2 −2 python/plugins/sextante/algs/ftools/SumLines.py
  6. +2 −2 python/plugins/sextante/algs/ftools/Union.py
  7. +2 −2 python/plugins/sextante/core/GeoAlgorithm.py
  8. +4 −4 python/plugins/sextante/core/SextanteUtils.py
  9. +4 −4 python/plugins/sextante/gui/BatchInputSelectionPanel.py
  10. +8 −8 python/plugins/sextante/gui/BatchProcessingDialog.py
  11. +2 −2 python/plugins/sextante/gui/SextanteToolbox.py
  12. +5 −5 python/plugins/sextante/gui/TestTools.py
  13. +3 −3 python/plugins/sextante/modeler/ModelerParameterDefinitionDialog.py
  14. +2 −2 python/plugins/sextante/parameters/ParameterRaster.py
  15. +1 −1 python/plugins/sextante/parameters/ParameterTable.py
  16. +1 −1 python/plugins/sextante/parameters/ParameterVector.py
  17. +2 −2 python/plugins/sextante/r/EditRScriptDialog.py
  18. +9 −9 python/plugins/sextante/r/RAlgorithm.py
  19. +2 −2 python/plugins/sextante/saga/SagaAlgorithm.py
  20. +1 −1 python/plugins/sextante/saga/SplitRGBBands.py
  21. +46 −47 python/plugins/sextante/tests/AlgTests.py
  22. +7 −7 python/plugins/sextante/tests/GeoAlgorithmTest.py
  23. +12 −12 python/plugins/sextante/tests/ModelerAlgorithmTest.py
  24. +20 −20 python/plugins/sextante/tests/ParametersTest.py
  25. +5 −6 python/plugins/sextante/tools/help.py
  26. +5 −5 src/app/composer/qgscomposer.cpp
  27. +1 −1 src/app/main.cpp
  28. +2 −2 src/app/qgisappinterface.cpp
  29. +1 −1 src/app/qgisappinterface.h
  30. +9 −9 src/app/qgscustomization.cpp
  31. +1 −1 src/app/qgsdiagramproperties.cpp
  32. +1 −1 src/app/qgspluginregistry.cpp
  33. +102 −98 src/app/qtmain_android.cpp
  34. +2 −2 src/core/composer/qgscomposeritem.cpp
  35. +3 −3 src/core/qgsfeaturerequest.cpp
  36. +2 −2 src/core/qgsmaplayer.h
  37. +32 −17 src/core/qgsogcutils.cpp
  38. +73 −73 src/core/qgsogcutils.h
  39. +3 −3 src/core/symbology-ng/qgsgraduatedsymbolrendererv2.cpp
  40. +1 −1 src/core/symbology-ng/qgssymbolv2.cpp
  41. +8 −8 src/gui/qgscomposerview.cpp
  42. +2 −2 src/gui/qgscomposerview.h
  43. +1 −1 src/gui/symbology-ng/qgsgraduatedsymbolrendererv2widget.cpp
  44. +1 −1 src/mapserver/qgswfsserver.h
  45. +2 −2 src/plugins/heatmap/heatmap.cpp
  46. +1 −1 src/plugins/heatmap/heatmap.h
  47. +8 −8 src/providers/mssql/qgsmssqlgeometryparser.cpp
  48. +1 −1 src/providers/mssql/qgsmssqlnewconnection.cpp
  49. +7 −7 src/providers/mssql/qgsmssqlprovider.cpp
  50. +3 −3 tests/src/core/testqgsexpression.cpp
  51. +48 −48 tests/src/core/testqgsogcutils.cpp
@@ -1,12 +1,12 @@
class QgsGml: QObject
class QgsGml: QObject
{

%TypeHeaderCode
#include <qgsgml.h>
%End

public:

QgsGml(
const QString& typeName,
const QString& geometryAttribute,
@@ -83,7 +83,7 @@ def processAlgorithm(self, progress):
nElement += 1
inGeom = inFeat.geometry()
outFeat.setGeometry(inGeom)
attrs = inFeat.attributes()
attrs = inFeat.attributes()
attrs.append(QVariant(result))
outFeat.setAttributes(attrs)
writer.addFeature(outFeat)
@@ -66,7 +66,7 @@ def processAlgorithm(self, progress):
intersects = index.intersects( geom.boundingBox() )
for i in intersects:
request = QgsFeatureRequest().setFilterFid(i)
inFeatB = vlayerB.getFeatures(request).next()
inFeatB = vlayerB.getFeatures(request).next()
tmpGeom = QgsGeometry(inFeatB.geometry())
try:
if geom.intersects( tmpGeom ):
@@ -61,7 +61,7 @@ def processAlgorithm(self, progress):
uniqueField = self.getParameterValue(self.UID)

weightIndex = layer.fieldNameIndex(weightField)
uniqueIndex = layer.fieldNameIndex(uniqueField)
uniqueIndex = layer.fieldNameIndex(uniqueField)

fieldList = [QgsField("MEAN_X", QVariant.Double, "", 24, 15),
QgsField("MEAN_Y", QVariant.Double, "", 24, 15),
@@ -74,7 +74,7 @@ def processAlgorithm(self, progress):
current = 0
features = QGisLayers.features(layer)
total = 100.0 / float(len(features))

means = {}
for feat in features:
current += 1
@@ -89,7 +89,7 @@ def processAlgorithm(self, progress):
weight = 1.00
if clazz not in means:
means[clazz] = (0,0,0)

cx,cy, totalweight = means[clazz]
geom = QgsGeometry(feat.geometry())
geom = utils.extractPoints(geom)
@@ -98,13 +98,13 @@ def processAlgorithm(self, progress):
cy += i.y() * weight
totalweight += weight
means[clazz] = (cx, cy, totalweight)

for clazz, values in means.iteritems():
outFeat = QgsFeature()
outFeat = QgsFeature()
cx = values[0] / values[2]
cy = values[1] / values[2]
cy = values[1] / values[2]
meanPoint = QgsPoint(cx, cy)

outFeat.setGeometry(QgsGeometry.fromPoint(meanPoint))
outFeat.setAttributes([QVariant(cx), QVariant(cy), clazz])
writer.addFeature(outFeat)
@@ -70,7 +70,7 @@ def processAlgorithm(self, progress):
lengthFieldName = self.getParameterValue(self.LEN_FIELD)
countFieldName = self.getParameterValue(self.COUNT_FIELD)

polyProvider = polyLayer.dataProvider()
polyProvider = polyLayer.dataProvider()

idxLength, fieldList = utils.findOrCreateField(polyLayer, polyLayer.pendingFields(), lengthFieldName)
idxCount, fieldList = utils.findOrCreateField(polyLayer, fieldList, countFieldName)
@@ -104,7 +104,7 @@ def processAlgorithm(self, progress):
if hasIntersections:
for i in lines:
request = QgsFeatureRequest().setFilterFid(i)
ftLine = lineLayer.getFeatures(request).next()
ftLine = lineLayer.getFeatures(request).next()
tmpGeom = QgsGeometry(ftLine.geometry())
if inGeom.intersects(tmpGeom):
outGeom = inGeom.intersection(tmpGeom)
@@ -87,7 +87,7 @@ def processAlgorithm(self, progress):
for id in intersects:
count += 1
request = QgsFeatureRequest().setFilterFid(id)
inFeatB = vlayerB.getFeatures(request).next()
inFeatB = vlayerB.getFeatures(request).next()
atMapB = inFeatB.attributes()
tmpGeom = QgsGeometry( inFeatB.geometry() )

@@ -173,7 +173,7 @@ def processAlgorithm(self, progress):
else:
for id in intersects:
request = QgsFeatureRequest().setFilterFid(id)
inFeatB = vlayerA.getFeatures(request).next()
inFeatB = vlayerA.getFeatures(request).next()
atMapB = inFeatB.attributes()
tmpGeom = QgsGeometry( inFeatB.geometry() )
try:
@@ -64,7 +64,7 @@ def __init__(self):
self.provider = None

self.defineCharacteristics()

def getCopy(self):
'''returns a new instance of this algorithm, ready to be used for being executed'''
newone = copy.copy(self)
@@ -320,7 +320,7 @@ def getVisibleOutputsCount(self):
if not out.hidden:
i+=1
return i;

def getVisibleParametersCount(self):
'''returns the number of non-hidden parameters'''
i = 0;
@@ -78,12 +78,12 @@ def getTempFilename(ext):

@staticmethod
def getTempFilenameInTempFolder(basename):
'''returns a temporary filename for a given file, putting it into a temp folder but not changing its basename'''
path = SextanteUtils.tempFolder()
'''returns a temporary filename for a given file, putting it into a temp folder but not changing its basename'''
path = SextanteUtils.tempFolder()
tempFolder = os.path.join(path, str(uuid.uuid4()).replace("-",""))
mkdir(tempFolder)
mkdir(tempFolder)
filename = os.path.join(tempFolder, basename)
return filename
return filename

@staticmethod
def getNumExportedLayers():
@@ -49,7 +49,7 @@ def __init__(self, param, row, col, batchDialog, parent = None):
self.horizontalLayout.addWidget(self.pushButton)
self.setLayout(self.horizontalLayout)

def showSelectionDialog(self):
def showSelectionDialog(self):
settings = QtCore.QSettings()
text = str(self.text.text())
if os.path.isdir(text):
@@ -60,10 +60,10 @@ def showSelectionDialog(self):
path = str(settings.value( "/SextanteQGIS/LastInputPath",QtCore.QVariant("")).toString())
else:
path = ""

ret = QtGui.QFileDialog.getOpenFileNames(self, "Open file", path, self.param.getFileFilter())
if ret:
files = list(ret)
if ret:
files = list(ret)
if len(files) == 1:
settings.setValue("/SextanteQGIS/LastInputPath", os.path.dirname(str(files[0])))
self.text.setText(str(files[0]))
@@ -109,16 +109,16 @@ def headerDoubleClicked(self, col):
elif isinstance(widget, FileSelectionPanel):
widgetValue = widget.getValue()
for row in range(1, self.table.rowCount()):
self.table.cellWidget(row, col).setText(widgetValue)
self.table.cellWidget(row, col).setText(widgetValue)
elif isinstance(widget, QtGui.QLineEdit):
widgetValue = widget.text()
for row in range(1, self.table.rowCount()):
self.table.cellWidget(row, col).setText(widgetValue)
self.table.cellWidget(row, col).setText(widgetValue)
elif isinstance(widget, BatchInputSelectionPanel):
widgetValue = widget.getText()
for row in range(1, self.table.rowCount()):
self.table.cellWidget(row, col).setText(widgetValue)

else:
pass

@@ -207,13 +207,13 @@ def loadHTMLResults(self, alg, i):
def cancel(self):
self.algs = None
if self.algEx:
self.algEx.terminate()
self.table.setEnabled(True)
self.algEx.terminate()
self.table.setEnabled(True)
#self.close()

@pyqtSlot()
def finish(self, i):
if not self.stop:
if not self.stop:
if self.load[i]:
SextantePostprocessing.handleAlgorithmResults(self.algs[i], self, False)
i += 1
@@ -230,8 +230,8 @@ def error(self, msg):
QMessageBox.critical(self, "Error", msg)
SextanteLog.addToLog(SextanteLog.LOG_ERROR, msg)
if self.algEx:
self.algEx.terminate()
self.table.setEnabled(True)
self.algEx.terminate()
self.table.setEnabled(True)
#self.close()


@@ -146,9 +146,9 @@ def fillTree(self):
self.fillTreeUsingCategories()
else:
self.fillTreeUsingProviders()
self.algorithmTree.sortItems(0, Qt.AscendingOrder)
self.algorithmTree.sortItems(0, Qt.AscendingOrder)
self.addRecentAlgorithms(False)

def addRecentAlgorithms(self, updating):
showRecent = SextanteConfig.getSetting(SextanteConfig.SHOW_RECENT_ALGORITHMS)
if showRecent:
@@ -42,26 +42,26 @@ def createTest(text):
execcommand = "sextante.runalg("
i = 0
for token in tokens:
if i < alg.getVisibleParametersCount() + 1:
if i < alg.getVisibleParametersCount() + 1:
if os.path.exists(token[1:-1]):
token = os.path.basename(token[1:-1])[:-4] + "()"
token = os.path.basename(token[1:-1])[:-4] + "()"
execcommand += token + ","
else:
execcommand += "None,"
i+=1
s += "\toutputs=" + execcommand[:-1] + ")\n"

i = -1 * len(alg.outputs)
for out in alg.outputs:
for out in alg.outputs:
filename = tokens[i][1:-1]
if (filename == str(None)):
raise Exception("Cannot create unit test for that algorithm execution.\nThe output cannot be a temporary file")
raise Exception("Cannot create unit test for that algorithm execution.\nThe output cannot be a temporary file")
s+="\toutput=outputs['" + out.name + "']\n"
if isinstance(out, (OutputNumber, OutputString)):
s+="self.assertTrue(" + str(out) + ", output)\n"
if isinstance(out, OutputRaster):
dataset = gdal.Open(filename, GA_ReadOnly)
strhash = hash(str(dataset.ReadAsArray(0).tolist()))
strhash = hash(str(dataset.ReadAsArray(0).tolist()))
s+="\tself.assertTrue(os.path.isfile(output))\n"
s+="\tdataset=gdal.Open(output, GA_ReadOnly)\n"
s+="\tstrhash=hash(str(dataset.ReadAsArray(0).tolist()))\n"
@@ -204,9 +204,9 @@ def setupUi(self):
self.fileFolderCombo = QtGui.QComboBox()
self.fileFolderCombo.addItem("File")
self.fileFolderCombo.addItem("Folder")
self.horizontalLayout2.addWidget(self.fileFolderCombo)
self.horizontalLayout2.addWidget(self.fileFolderCombo)
if self.param is not None:
self.fileFolderCombo.setCurrentIndex(1 if self.param.isFolder else 0)
self.fileFolderCombo.setCurrentIndex(1 if self.param.isFolder else 0)

self.buttonBox = QtGui.QDialogButtonBox(self)
self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
@@ -267,7 +267,7 @@ def okPressed(self):
elif self.paramType == ModelerParameterDefinitionDialog.PARAMETER_EXTENT or isinstance(self.param, ParameterExtent):
self.param = ParameterExtent(name, description)
elif self.paramType == ModelerParameterDefinitionDialog.PARAMETER_FILE or isinstance(self.param, ParameterFile):
self.param = ParameterFile(name, description)
self.param = ParameterFile(name, description)
self.close()

def cancelPressed(self):
@@ -75,12 +75,12 @@ def setValue(self, obj):
self.value = unicode(layer.dataProvider().dataSourceUri())
return True
return os.path.exists(self.value)

def getFileFilter(self):
exts = QGisLayers.getSupportedOutputRasterLayerExtensions()
for i in range(len(exts)):
exts[i] = exts[i].upper() + " files(*." + exts[i].lower() + ")"
return ";;".join(exts)
return ";;".join(exts)

def serialize(self):
return self.__module__.split(".")[-1] + "|" + self.name + "|" + self.description +\
@@ -78,7 +78,7 @@ def getSafeExportedTable(self):
else:
self.exported = self.value
return self.exported

def getFileFilter(self,alg):
exts = ['csv', 'dbf']
for i in range(len(exts)):
@@ -83,7 +83,7 @@ def getSafeExportedLayer(self):
else:
self.exported = self.value
return self.exported

def getFileFilter(self):
exts = QGisLayers.getSupportedOutputVectorLayerExtensions()
for i in range(len(exts)):
@@ -46,7 +46,7 @@ def __init__(self, alg):
self.setupUi()
self.update = False
self.help = None

def setupUi(self):
self.resize(600,400)
self.setWindowTitle("Edit script")
@@ -82,7 +82,7 @@ def setupUi(self):

def editHelp(self):
if self.alg is None:
alg = RAlgorithm(None, unicode(self.text.toPlainText()))
alg = RAlgorithm(None, unicode(self.text.toPlainText()))
else:
alg = self.alg
dlg = HelpEditionDialog(alg)
@@ -75,29 +75,29 @@ def getIcon(self):
return QtGui.QIcon(os.path.dirname(__file__) + "/../images/r.png")

def defineCharacteristicsFromScript(self):
lines = self.script.split("\n")
lines = self.script.split("\n")
self.name = "[Unnamed algorithm]"
self.group = "User R scripts"
self.parseDescription(iter(lines))
def defineCharacteristicsFromFile(self):


def defineCharacteristicsFromFile(self):
filename = os.path.basename(self.descriptionFile)
self.name = filename[:filename.rfind(".")].replace("_", " ")
self.group = "User R scripts"
self.group = "User R scripts"
with open(self.descriptionFile, 'r') as f:
lines = [line.strip() for line in f]
self.parseDescription(iter(lines))
def parseDescription(self, lines):

def parseDescription(self, lines):
self.script = ""
self.commands=[]
self.showPlots = False
self.showConsoleOutput = False
self.useRasterPackage = True
self.passFileNames = False
self.verboseCommands = []
ender = 0
ender = 0
line = lines.next().strip("\n").strip("\r")
while ender < 10:
if line.startswith("##"):
@@ -285,7 +285,7 @@ def getImportCommands(self):
commands.append(
'tryCatch(find.package("raster"), error=function(e) install.packages("raster", dependencies=TRUE, lib="%s"))' % rLibDir)
commands.append("library(\"raster\")");

for param in self.parameters:
if isinstance(param, ParameterRaster):
value = param.value
@@ -351,12 +351,12 @@ def exportRasterLayer(self, layer):
def checkBeforeOpeningParametersDialog(self):
pass
#return SagaUtils.checkSagaIsInstalled()


def checkParameterValuesBeforeExecuting(self):
'''We check that there are no multiband layers, which are not supported by SAGA'''
for param in self.parameters:
if isinstance(param, ParameterRaster):
if isinstance(param, ParameterRaster):
value = param.value
layer = QGisLayers.getObjectFromUri(value)
if layer is not None and layer.bandCount() > 1:

0 comments on commit 250cc4e

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