Skip to content

Commit

Permalink
indentation update
Browse files Browse the repository at this point in the history
  • Loading branch information
jef-n committed Feb 7, 2013
1 parent 76d1403 commit cb7f7bf
Show file tree
Hide file tree
Showing 85 changed files with 777 additions and 768 deletions.
2 changes: 1 addition & 1 deletion python/console/console.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ def openSettings(self):
def prefChanged(self):
self.edit.refreshLexerProperties()
self.textEditOut.refreshLexerProperties()

def callWidgetMessageBar(self, text):
self.textEditOut.widgetMessageBar(iface, text)

Expand Down
2 changes: 1 addition & 1 deletion python/console/console_sci.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def __init__(self, parent=None):
code.InteractiveInterpreter.__init__(self, locals=None)

self.parent = parent

# Enable non-ascii chars for editor
self.setUtf8(True)

Expand Down
4 changes: 2 additions & 2 deletions python/plugins/sextante/algs/AddTableField.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def processAlgorithm(self, progress):
fields[len(fields)] = QgsField(fieldname, self.TYPES[fieldtype])
writer = output.getVectorWriter(fields, vprovider.geometryType(), vprovider.crs() )
outFeat = QgsFeature()
inGeom = QgsGeometry()
inGeom = QgsGeometry()
nElement = 0
features = QGisLayers.features(vlayer)
nFeat = len(features)
Expand All @@ -77,7 +77,7 @@ def processAlgorithm(self, progress):
inGeom = inFeat.geometry()
outFeat.setGeometry( inGeom )
atMap = inFeat.attributeMap()
atMap.append(QVariant())
atMap.append(QVariant())
outFeat.addAttribute( len(vprovider.fields()), QVariant() )
writer.addFeature( outFeat )
del writer
Expand Down
2 changes: 1 addition & 1 deletion python/plugins/sextante/algs/AutoincrementalField.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def processAlgorithm(self, progress):
outFeat.setGeometry( inGeom )
atMap = inFeat.attributeMap()
atMap.append(QVariant(nElement))
outFeat.setAttributeMap( atMap )
outFeat.setAttributeMap( atMap )
writer.addFeature( outFeat )
del writer

Expand Down
2 changes: 1 addition & 1 deletion python/plugins/sextante/algs/CreateConstantRaster.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def processAlgorithm(self, progress):
value = self.getOutputValue(self.NUMBER)
layer = QGisLayers.getObjectFromUri(self.getParameterValue(self.INPUT))
cellsize = (layer.extent().xMaximum() - layer.extent().xMinimum())/layer.width()
w = SextanteRasterWriter(output.getCompatibleFileName(self), layer.extent().xMinimum(), layer.extent().yMinimum(), layer.extent().xMaximum(),
w = SextanteRasterWriter(output.getCompatibleFileName(self), layer.extent().xMinimum(), layer.extent().yMinimum(), layer.extent().xMaximum(),
layer.extent().yMaximum(), cellsize, 1, self.crs)
w.matrix[:] = value
w.close()
Expand Down
8 changes: 4 additions & 4 deletions python/plugins/sextante/algs/EquivalentNumField.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@ def processAlgorithm(self, progress):
output = self.getOutputFromName(self.OUTPUT)
vlayer = QGisLayers.getObjectFromUri(self.getParameterValue(self.INPUT))
vprovider = vlayer.dataProvider()
fieldindex = vlayer.fieldNameIndex(fieldname)
fieldindex = vlayer.fieldNameIndex(fieldname)
fields = vprovider.fields()
fields.append(QgsField("NUM_FIELD", QVariant.Int))
writer = output.getVectorWriter(fields, vprovider.geometryType(), vprovider.crs() )
writer = output.getVectorWriter(fields, vprovider.geometryType(), vprovider.crs() )
outFeat = QgsFeature()
inGeom = QgsGeometry()
inGeom = QgsGeometry()
nElement = 0
classes = {}
features = QGisLayers.features(vlayer)
Expand All @@ -67,7 +67,7 @@ def processAlgorithm(self, progress):
if clazz not in classes:
classes[clazz] = len(classes.keys())
atMap.append(QVariant(classes[clazz]))
outFeat.setAttributes(atMap)
outFeat.setAttributes(atMap)
writer.addFeature( outFeat )
del writer

Expand Down
2 changes: 1 addition & 1 deletion python/plugins/sextante/algs/Explode.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def processAlgorithm(self, progress):
fields = vprovider.fields()
writer = output.getVectorWriter(fields, QGis.WKBLineString, vprovider.crs() )
outFeat = QgsFeature()
inGeom = QgsGeometry()
inGeom = QgsGeometry()
nElement = 0
features = QGisLayers.features(layer)
nFeat = len(features)
Expand Down
4 changes: 2 additions & 2 deletions python/plugins/sextante/algs/FieldPyculator.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ def processAlgorithm(self, progress):
new_ns['__geom'] = geom

if need_attrs:
pyattrs = [self.Qvar2py(a) for a in attrMap]
pyattrs = [self.Qvar2py(a) for a in attrMap]
new_ns['__attr'] = pyattrs

#clear old result
Expand Down Expand Up @@ -158,7 +158,7 @@ def processAlgorithm(self, progress):
nElement += 1
outFeat.setGeometry( feat.geometry() )
attrMap.append(QVariant(new_ns[self.RESULT_VAR_NAME]))
outFeat.setAttributeMap( attrMap )
outFeat.setAttributeMap( attrMap )
writer.addFeature(outFeat)

del writer
Expand Down
2 changes: 1 addition & 1 deletion python/plugins/sextante/algs/FieldsCalculator.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def processAlgorithm(self, progress):
outFeat.setGeometry(inGeom)
atMap = inFeat.attributeMap()
atMap.append(QVariant(result))
outFeat.setAttributeMap(atMap)
outFeat.setAttributeMap(atMap)
writer.addFeature(outFeat)
del writer

Expand Down
6 changes: 3 additions & 3 deletions python/plugins/sextante/algs/JoinAttributes.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,16 +83,16 @@ def processAlgorithm(self, progress):
for inFeat in features:
inGeom = inFeat.geometry()
atMap = inFeat.attributes()
join_value1 = atMap[join_field1_index].toString()
join_value1 = atMap[join_field1_index].toString()
while provider2.nextFeature(inFeat2):
## Maybe it should cache this entries...
atMap2 = inFeat2.attributeMap()
join_value2 = atMap2[join_field2_index].toString()
if join_value1 == join_value2:
# create the new feature
outFeat.setGeometry(inGeom)
outFeat.setGeometry(inGeom)
atMap.extend(atMap2)
break;
break;
outFeat.setAttributes(atMap)
writer.addFeature(outFeat)

Expand Down
12 changes: 6 additions & 6 deletions python/plugins/sextante/algs/PointsLayerFromTable.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,15 @@ def processAlgorithm(self, progress):
fields = vprovider.fields()
writer = output.getVectorWriter(fields, QGis.WKBPoint, self.crs)
xfieldindex = vlayer.fieldNameIndex(self.getParameterValue(self.XFIELD))
yfieldindex = vlayer.fieldNameIndex(self.getParameterValue(self.YFIELD))
outFeat = QgsFeature()
yfieldindex = vlayer.fieldNameIndex(self.getParameterValue(self.YFIELD))

outFeat = QgsFeature()
nElement = 0
features = QGisLayers.features(vlayer)
nFeat = len(features)
for feature in features:
nElement += 1
progress.setPercentage((nElement*100)/nFeat)
progress.setPercentage((nElement*100)/nFeat)
attrs = feature.attributes()
try:
x = float(attrs[xfieldindex].toString())
Expand All @@ -70,9 +70,9 @@ def processAlgorithm(self, progress):
continue
pt = QgsPoint(x, y)
outFeat.setGeometry(QgsGeometry.fromPoint(pt))
outFeat.setAttributes(attrs)
outFeat.setAttributes(attrs)
writer.addFeature(outFeat)

del writer


Expand Down
4 changes: 2 additions & 2 deletions python/plugins/sextante/algs/QGISAlgorithmProvider.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
mmqgisx_geometry_convert_algorithm,
mmqgisx_grid_algorithm, mmqgisx_gridify_algorithm,
mmqgisx_hub_distance_algorithm, mmqgisx_hub_lines_algorithm,
mmqgisx_merge_algorithm, mmqgisx_select_algorithm,
mmqgisx_merge_algorithm, mmqgisx_select_algorithm,
mmqgisx_text_to_float_algorithm)
from sextante.algs.EquivalentNumField import EquivalentNumField
from sextante.core.AlgorithmProvider import AlgorithmProvider
Expand Down Expand Up @@ -116,7 +116,7 @@ def __init__(self):
mmqgisx_hub_distance_algorithm(),
mmqgisx_hub_lines_algorithm(),
mmqgisx_merge_algorithm(),
mmqgisx_select_algorithm(),
mmqgisx_select_algorithm(),
mmqgisx_text_to_float_algorithm(),
#raster
CreateConstantRaster()]
Expand Down
6 changes: 3 additions & 3 deletions python/plugins/sextante/algs/ftools/Clip.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def processAlgorithm(self, progress):
vproviderB = vlayerB.dataProvider()
#allAttrsB = vproviderB.attributeIndexes()
#vproviderB.select( allAttrsB )

# check for crs compatibility
crsA = vproviderA.crs()
crsB = vproviderB.crs()
Expand All @@ -75,9 +75,9 @@ def processAlgorithm(self, progress):
outFeat = QgsFeature()
index = utils.createSpatialIndex(vlayerB)
#vproviderA.rewind()
nElement = 0
nElement = 0
selectionA = QGisLayers.features(vlayerA)
nFeat = len(selectionA)
nFeat = len(selectionA)
for inFeatA in selectionA:
nElement += 1
progress.setPercentage(nElement/float(nFeat) * 100)
Expand Down
4 changes: 2 additions & 2 deletions python/plugins/sextante/algs/ftools/Delaunay.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def defineCharacteristics(self):

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


fields = [ QgsField("POINTA", QVariant.Double, "", 24, 15),
QgsField("POINTB", QVariant.Double, "", 24, 15),
Expand Down Expand Up @@ -105,7 +105,7 @@ def processAlgorithm(self, progress):
point = QgsPoint(geom.asPoint())
polygon.append(point)
if step <= 3:
attrs.append(QVariant(ids[index]))
attrs.append(QVariant(ids[index]))
step += 1
feat.setAttributes(attrs)
geometry = QgsGeometry().fromPolygon([polygon])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def processAlgorithm(self, progress):
layer = QGisLayers.getObjectFromUri(self.getParameterValue(self.INPUT))
interval = self.getParameterValue(self.INTERVAL)

isPolygon = layer.geometryType() == QGis.Polygon
isPolygon = layer.geometryType() == QGis.Polygon

writer = self.getOutputFromName(self.OUTPUT).getVectorWriter(layer.pendingFields(),
layer.wkbType(), layer.crs())
Expand Down
12 changes: 6 additions & 6 deletions python/plugins/sextante/algs/ftools/Difference.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ class Difference(GeoAlgorithm):

def processAlgorithm(self, progress):
vlayerA = QGisLayers.getObjectFromUri(self.getParameterValue(Difference.INPUT))
vlayerB = QGisLayers.getObjectFromUri(self.getParameterValue(Difference.INPUT2))
vlayerB = QGisLayers.getObjectFromUri(self.getParameterValue(Difference.INPUT2))
GEOS_EXCEPT = True
FEATURE_EXCEPT = True
vproviderA = vlayerA.dataProvider()
vproviderB = vlayerB.dataProvider()
vproviderB = vlayerB.dataProvider()
fields = vproviderA.fields()
# check for crs compatibility
crsA = vproviderA.crs()
Expand All @@ -67,8 +67,8 @@ def processAlgorithm(self, progress):
outFeat = QgsFeature()
index = utils.createSpatialIndex(vlayerB)
nElement = 0
selectionA = QGisLayers.features(vlayerA)
nFeat = len(selectionA)
selectionA = QGisLayers.features(vlayerA)
nFeat = len(selectionA)
for inFeatA in selectionA:
nElement += 1
progress.setPercentage(nElement/float(nFeat) * 100)
Expand All @@ -77,7 +77,7 @@ def processAlgorithm(self, progress):
diff_geom = QgsGeometry( geom )
atMap = inFeatA.attributes()
intersects = index.intersects( geom.boundingBox() )
for id in intersects:
for id in intersects:
vlayerB.featureAtId( int( id ), inFeatB , True, allAttrsB )
tmpGeom = QgsGeometry( inFeatB.geometry() )
try:
Expand All @@ -96,7 +96,7 @@ def processAlgorithm(self, progress):
FEATURE_EXCEPT = False
continue


del writer
if not GEOS_EXCEPT:
SextanteLog.addToLog(SextanteLog.LOG_WARNING, "Geometry exception while computing difference")
Expand Down
4 changes: 2 additions & 2 deletions python/plugins/sextante/algs/ftools/Dissolve.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ def processAlgorithm(self, progress):
vlayerA = QGisLayers.getObjectFromUri(self.getParameterValue(Dissolve.INPUT))
field = vlayerA.fieldNameIndex(fieldname)
GEOS_EXCEPT = True
vproviderA = vlayerA.dataProvider()
vproviderA = vlayerA.dataProvider()
fields = vproviderA.fields()
writer = self.getOutputFromName(Dissolve.OUTPUT).getVectorWriter(fields, vproviderA.geometryType(), vproviderA.crs() )
#inFeat = QgsFeature()
outFeat = QgsFeature()
outFeat = QgsFeature()
nElement = 0
nFeat = vproviderA.featureCount()
if not useField:
Expand Down
8 changes: 4 additions & 4 deletions python/plugins/sextante/algs/ftools/ExportGeometryInfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@ def processAlgorithm(self, progress):

if geometryType == QGis.Polygon:
fields.append(QgsField(QString("area"), QVariant.Double))
fields.append(QgsField(QString("perimeter"), QVariant.Double))
fields.append(QgsField(QString("perimeter"), QVariant.Double))
elif geometryType == QGis.Line:
fields.append(QgsField(QString("length"), QVariant.Double))
fields.append(QgsField(QString("length"), QVariant.Double))
else:
fields.append(QgsField(QString("xcoords"), QVariant.Double))
fields.append(QgsField(QString("ycoords"), QVariant.Double))
Expand Down Expand Up @@ -113,10 +113,10 @@ def processAlgorithm(self, progress):

outFeat.setGeometry(inGeom)
atMap = inFeat.attributes()
atMap.append(QVariant(attr1))
atMap.append(QVariant(attr1))
if attr2 is not None:
atMap.append(QVariant(attr2))
outFeat.setAttributes(atMap)
outFeat.setAttributes(atMap)
writer.addFeature(outFeat)

current += 1
Expand Down
12 changes: 6 additions & 6 deletions python/plugins/sextante/algs/ftools/ExtentFromLayer.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,10 @@ def processAlgorithm(self, progress):
self.featureExtent(layer, writer, progress)
else:
self.layerExtent(layer, writer, progress)

del writer

def layerExtent(self, layer, writer, progress):
del writer

def layerExtent(self, layer, writer, progress):
rect = layer.extent()
minx = rect.xMinimum()
miny = rect.yMinimum()
Expand All @@ -97,10 +97,10 @@ def layerExtent(self, layer, writer, progress):
QgsPoint(maxx, maxy),
QgsPoint(maxx, miny),
QgsPoint(minx, miny)
]
]
geometry = QgsGeometry().fromPolygon([rect])
feat = QgsFeature()
feat.setGeometry(geometry)
feat.setGeometry(geometry)
attrs = [QVariant(minx),
QVariant(miny),
QVariant(maxx),
Expand Down Expand Up @@ -153,7 +153,7 @@ def featureExtent(self, layer, writer, progress):
QVariant(height),
QVariant(width) ]
feat.setAttributes(attrs)

writer.addFeature(feat)
current += 1
progress.setPercentage(int(current * total))
12 changes: 6 additions & 6 deletions python/plugins/sextante/algs/ftools/FToolsUtils.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
from qgis.core import *

def createSpatialIndex(layer):
idx = QgsSpatialIndex()
idx = QgsSpatialIndex()
features = QGisLayers.features(layer)
for ft in features:
idx.insertFeature(ft)
Expand Down Expand Up @@ -61,12 +61,12 @@ def createUniqueFieldName(fieldName, fieldList):

def findOrCreateField(layer, fieldList, fieldName, fieldLen=24, fieldPrec=15):
idx = layer.fieldNameIndex(fieldName)
if idx == -1:
if idx == -1:
fn = createUniqueFieldName(fieldName, fieldList)
field = QgsField(fn, QVariant.Double, "", fieldLen, fieldPrec)
idx = len(fieldList)
fieldList.append(field)

return idx, fieldList

def extractPoints( geom ):
Expand Down Expand Up @@ -96,13 +96,13 @@ def extractPoints( geom ):

return points

def getUniqueValues(layer, fieldIndex):
def getUniqueValues(layer, fieldIndex):
values = []
layer.select([fieldIndex], QgsRectangle(), False)
features = QGisLayers.features(layer)
for feat in features:
if feat.attributes()[fieldIndex] not in values:
values.append(feat.attributes()[fieldIndex])
values.append(feat.attributes()[fieldIndex])
return values

def getUniqueValuesCount(layer, fieldIndex):
Expand All @@ -114,7 +114,7 @@ def combineVectorFields( layerA, layerB ):