Skip to content

Commit

Permalink
indentation update and a few fixed typos
Browse files Browse the repository at this point in the history
  • Loading branch information
jef-n committed Oct 24, 2013
1 parent 8fb20f0 commit ec0f0be
Show file tree
Hide file tree
Showing 53 changed files with 240 additions and 231 deletions.
8 changes: 4 additions & 4 deletions python/console/console_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ def saveSettings(self):
settings.setValue("pythonConsole/caretLineColor", self.caretLineColor.color())
settings.setValue("pythonConsole/caretLineColorEditor", self.caretLineColorEditor.color())
settings.setValue("pythonConsole/stderrFontColor", self.stderrFontColor.color())

settings.setValue("pythonConsole/singleQuoteFontColor", self.singleQuoteFontColor.color())
settings.setValue("pythonConsole/singleQuoteFontColorEditor", self.singleQuoteFontColorEditor.color())
settings.setValue("pythonConsole/doubleQuoteFontColor", self.doubleQuoteFontColor.color())
Expand All @@ -215,7 +215,7 @@ def saveSettings(self):
settings.setValue("pythonConsole/tripleSingleQuoteFontColorEditor", self.tripleSingleQuoteFontColorEditor.color())
settings.setValue("pythonConsole/tripleDoubleQuoteFontColor", self.tripleDoubleQuoteFontColor.color())
settings.setValue("pythonConsole/tripleDoubleQuoteFontColorEditor", self.tripleDoubleQuoteFontColorEditor.color())

def restoreSettings(self):
settings = QSettings()
self.spinBox.setValue(settings.value("pythonConsole/fontsize", 10, type=int))
Expand Down Expand Up @@ -285,7 +285,7 @@ def restoreSettings(self):
self.cursorColor.setColor(QColor(settings.value("pythonConsole/cursorColor", QColor(Qt.black))))
self.cursorColorEditor.setColor(QColor(settings.value("pythonConsole/cursorColorEditor", QColor(Qt.black))))
self.stderrFontColor.setColor(QColor(settings.value("pythonConsole/stderrFontColor", QColor(Qt.red))))

self.singleQuoteFontColor.setColor(settings.value("pythonConsole/singleQuoteFontColor", QColor(Qt.blue)))
self.singleQuoteFontColorEditor.setColor(settings.value("pythonConsole/singleQuoteFontColorEditor", QColor(Qt.blue)))
self.doubleQuoteFontColor.setColor(settings.value("pythonConsole/doubleQuoteFontColor", QColor(Qt.blue)))
Expand All @@ -311,7 +311,7 @@ def _resetFontColor(self):
self.doubleQuoteFontColor.setColor(QColor(Qt.blue))
self.tripleSingleQuoteFontColor.setColor(QColor(Qt.blue))
self.tripleDoubleQuoteFontColor.setColor(QColor(Qt.blue))


def _resetFontColorEditor(self):
self.defaultFontColorEditor.setColor(QColor(Qt.black))
Expand Down
8 changes: 4 additions & 4 deletions python/plugins/processing/algs/SaveSelectedFeatures.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@ def processAlgorithm(self, progress):
# toolbox. The self.crs variable has to be changed in case this
# is not true, or in case there are no input layer from which
# the output crs can be infered


provider = vectorLayer.dataProvider()

writer = output.getVectorWriter(provider.fields(),
Expand All @@ -131,12 +131,12 @@ def processAlgorithm(self, progress):
# Now we take the selected features and add them to the output
# layer
features = vector.features(vectorLayer)
total = len(features)
total = len(features)
for (i, feat) in enumerate(features):
writer.addFeature(feat)

# We use the progress object to communicate with the user
progress.setPercentage(100 * i / float(total))
progress.setPercentage(100 * i / float(total))
del writer

# There is nothing more to do here. We do not have to open the
Expand Down
16 changes: 8 additions & 8 deletions python/plugins/processing/algs/ftools/ExtractByLocation.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@
class ExtractByLocation(GeoAlgorithm):

INPUT = 'INPUT'
INTERSECT = 'INTERSECT'
INTERSECT = 'INTERSECT'
OUTPUT = 'OUTPUT'

def defineCharacteristics(self):
def defineCharacteristics(self):
self.name = 'Extract by location'
self.group = 'Vector selection tools'
self.addParameter(ParameterVector(self.INPUT, 'Layer to select from',
Expand All @@ -55,7 +55,7 @@ def processAlgorithm(self, progress):
filename = self.getParameterValue(self.INTERSECT)
selectLayer = dataobjects.getObjectFromUri(filename)
index = vector.spatialindex(layer)

geom = QgsGeometry()
selectedSet = []
current = 0
Expand All @@ -70,15 +70,15 @@ def processAlgorithm(self, progress):
feat = layer.getFeatures(request).next()
tmpGeom = QgsGeometry(feat.geometry())
if geom.intersects(tmpGeom):
selectedSet.append(feat.id())
selectedSet.append(feat.id())
progress.setPercentage(int(current * total))

output = self.getOutputFromName(self.OUTPUT)
output = self.getOutputFromName(self.OUTPUT)
writer = output.getVectorWriter(layer.fields(),
layer.geometryType(), layer.crs())

for (i, feat) in enumerate(features):
if feat.id() in selectedSet:
writer.addFeature(feat)
progress.setPercentage(100 * i / float(featureCount))
writer.addFeature(feat)
progress.setPercentage(100 * i / float(featureCount))
del writer
12 changes: 6 additions & 6 deletions python/plugins/processing/algs/ftools/RandomExtract.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class RandomExtract(GeoAlgorithm):

METHODS = ['Number of selected features',
'Percentage of selected features']
def defineCharacteristics(self):
def defineCharacteristics(self):
self.name = 'Random extract'
self.group = 'Vector selection tools'

Expand All @@ -69,7 +69,7 @@ def processAlgorithm(self, progress):

features = vector.features(layer)
featureCount = len(features)
value = int(self.getParameterValue(self.NUMBER))
value = int(self.getParameterValue(self.NUMBER))

if method == 0:
if value > featureCount:
Expand All @@ -85,12 +85,12 @@ def processAlgorithm(self, progress):

selran = random.sample(xrange(0, featureCount), value)

output = self.getOutputFromName(self.OUTPUT)
output = self.getOutputFromName(self.OUTPUT)
writer = output.getVectorWriter(layer.fields(),
layer.geometryType(), layer.crs())

for (i, feat) in enumerate(features):
if i in selran:
writer.addFeature(feat)
progress.setPercentage(100 * i / float(featureCount))
writer.addFeature(feat)
progress.setPercentage(100 * i / float(featureCount))
del writer
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class RandomExtractWithinSubsets(GeoAlgorithm):
METHODS = ['Number of selected features',
'Percentage of selected features']

def defineCharacteristics(self):
def defineCharacteristics(self):
self.name = 'Random extract within subsets'
self.group = 'Vector selection tools'

Expand All @@ -72,12 +72,12 @@ def processAlgorithm(self, progress):
layer = dataobjects.getObjectFromUri(filename)
field = self.getParameterValue(self.FIELD)
method = self.getParameterValue(self.METHOD)

index = layer.fieldNameIndex(field)

features = vector.features(layer)
featureCount = len(features)
unique = vector.getUniqueValues(layer, index)
unique = vector.getUniqueValues(layer, index)
value = int(self.getParameterValue(self.NUMBER))
if method == 0:
if value > featureCount:
Expand All @@ -92,11 +92,11 @@ def processAlgorithm(self, progress):
value = value / 100.0


output = self.getOutputFromName(self.OUTPUT)
output = self.getOutputFromName(self.OUTPUT)
writer = output.getVectorWriter(layer.fields(),
layer.geometryType(), layer.crs())
selran = []

selran = []
current = 0
total = 100.0 / float(featureCount * len(unique))
features = vector.features(layer)
Expand Down Expand Up @@ -129,6 +129,6 @@ def processAlgorithm(self, progress):
features = vector.features(layer)
for (i, feat) in enumerate(features):
if i in selran:
writer.addFeature(feat)
progress.setPercentage(100 * i / float(featureCount))
writer.addFeature(feat)
progress.setPercentage(100 * i / float(featureCount))
del writer
2 changes: 1 addition & 1 deletion python/plugins/processing/algs/ftools/SelectByLocation.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def processAlgorithm(self, progress):

oldSelection = set(inputLayer.selectedFeaturesIds())
index = vector.spatialindex(inputLayer)

geom = QgsGeometry()
selectedSet = []
current = 0
Expand Down
18 changes: 9 additions & 9 deletions python/plugins/processing/algs/mmqgisx/MMQGISXAlgorithms.py
Original file line number Diff line number Diff line change
Expand Up @@ -1098,7 +1098,7 @@ def processAlgorithm(self, progress):

layer.setSelectedFeatures(selected)
self.setOutputValue(self.RESULT, filename)

class mmqgisx_extract_algorithm(GeoAlgorithm):

LAYERNAME = 'LAYERNAME'
Expand All @@ -1107,7 +1107,7 @@ class mmqgisx_extract_algorithm(GeoAlgorithm):
COMPARISON = 'COMPARISON'
RESULT = 'RESULT'

def defineCharacteristics(self):
def defineCharacteristics(self):
self.name = 'Extract by attribute'
self.group = 'Vector selection tools'

Expand Down Expand Up @@ -1142,19 +1142,19 @@ def processAlgorithm(self, progress):
comparisonvalue = self.getParameterValue(self.COMPARISONVALUE)

selected = select(layer, attribute, comparison, comparisonvalue, progress)

features = vector.features(layer)
featureCount = len(features)
output = self.getOutputFromName(self.OUTPUT)
output = self.getOutputFromName(self.OUTPUT)
writer = output.getVectorWriter(layer.fields(),
layer.geometryType(), layer.crs())
for (i, feat) in enumerate(features):
if feat.id() in selected:
writer.addFeature(feat)
progress.setPercentage(100 * i / float(featureCount))
del writer
writer.addFeature(feat)
progress.setPercentage(100 * i / float(featureCount))
del writer

def select(layer, attribute, comparison, comparisonvalue, progress):
def select(layer, attribute, comparison, comparisonvalue, progress):
selectindex = layer.dataProvider().fieldNameIndex(attribute)
selectType = layer.dataProvider().fields()[selectindex].type()
selectionError = False
Expand Down Expand Up @@ -1263,7 +1263,7 @@ def select(layer, attribute, comparison, comparisonvalue, progress):
selected.append(feature.id())

progress.setPercentage(float(readcount) / totalcount * 100)

return selected

class mmqgisx_text_to_float_algorithm(GeoAlgorithm):
Expand Down
4 changes: 2 additions & 2 deletions python/plugins/processing/core/GeoAlgorithm.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ def __init__(self):
# appear in the toolbox or modeler
self.showInToolbox = True
self.showInModeler = True
#if true, will show only loaded layers in parameters dialog.
#Also, if True, the algorithm does not run on the modeler
#if true, will show only loaded layers in parameters dialog.
#Also, if True, the algorithm does not run on the modeler
#or batch ptocessing interface
self.allowOnlyOpenedLayers = False

Expand Down
2 changes: 1 addition & 1 deletion python/plugins/processing/core/SilentProgress.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class SilentProgress:

def error(self, msg):
print msg

def setText(self, text):
pass

Expand Down
2 changes: 1 addition & 1 deletion python/plugins/processing/gdal/gdaladdo.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class gdaladdo(GeoAlgorithm):
def getIcon(self):
filepath = os.path.dirname(__file__) + '/icons/raster-overview.png'
return QtGui.QIcon(filepath)

def commandLineName(self):
return "gdalogr:overviews"

Expand Down
2 changes: 1 addition & 1 deletion python/plugins/processing/gdal/information.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class information(GeoAlgorithm):
def getIcon(self):
filepath = os.path.dirname(__file__) + '/icons/raster-info.png'
return QtGui.QIcon(filepath)

def commandLineName(self):
return "gdalorg:rasterinfo"

Expand Down
4 changes: 2 additions & 2 deletions python/plugins/processing/gdal/ogr2ogr.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,10 @@ def defineCharacteristics(self):
''))

self.addOutput(OutputVector(self.OUTPUT_LAYER, 'Output layer'))

def commandLineName(self):
return "gdalogr:ogr2ogr"


def processAlgorithm(self, progress):
if not gdalAvailable:
Expand Down
4 changes: 2 additions & 2 deletions python/plugins/processing/gdal/ogrinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ def defineCharacteristics(self):
[ParameterVector.VECTOR_TYPE_ANY], False))

self.addOutput(OutputHTML(self.OUTPUT, 'Layer information'))

def commandLineName(self):
return "gdalogr:vectorinfo"
return "gdalogr:vectorinfo"

def processAlgorithm(self, progress):

Expand Down
2 changes: 1 addition & 1 deletion python/plugins/processing/gdal/polygonize.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class polygonize(GeoAlgorithm):
def getIcon(self):
filepath = os.path.dirname(__file__) + '/icons/polygonize.png'
return QtGui.QIcon(filepath)

def commandLineName(self):
return "gdalogr:polygonize"

Expand Down
2 changes: 1 addition & 1 deletion python/plugins/processing/gdal/proximity.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class proximity(GeoAlgorithm):
def getIcon(self):
filepath = os.path.dirname(__file__) + '/icons/proximity.png'
return QtGui.QIcon(filepath)

def commandLineName(self):
return "gdalogr:proximity"

Expand Down
2 changes: 1 addition & 1 deletion python/plugins/processing/gdal/rasterize.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class rasterize(GeoAlgorithm):
def getIcon(self):
filepath = os.path.dirname(__file__) + '/icons/rasterize.png'
return QtGui.QIcon(filepath)

def commandLineName(self):
return "gdalogr:rasterize"

Expand Down
2 changes: 1 addition & 1 deletion python/plugins/processing/gdal/translate.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class translate(GeoAlgorithm):
def getIcon(self):
filepath = os.path.dirname(__file__) + '/icons/translate.png'
return QtGui.QIcon(filepath)

def commandLineName(self):
return "gdalogr:translate"

Expand Down
2 changes: 1 addition & 1 deletion python/plugins/processing/grass/GrassAlgorithm.py
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ def processAlgorithm(self, progress):
else:
command = 'r.out.gdal -c createopt="TFW=YES,COMPRESS=LZW"'
command += ' input='

if self.grassName == 'r.horizon':
command += out.name + uniqueSufix + '_0'
else:
Expand Down
4 changes: 2 additions & 2 deletions python/plugins/processing/gui/AlgorithmExecutionDialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,9 @@ def __init__(self, alg, mainWidget):
self.buttonBox.rejected.connect(self.close)
self.buttonBox.button(
QtGui.QDialogButtonBox.Cancel).clicked.connect(self.cancel)

self.showDebug = ProcessingConfig.getSetting(
ProcessingConfig.SHOW_DEBUG_IN_DIALOG)
ProcessingConfig.SHOW_DEBUG_IN_DIALOG)

def setParamValues(self):
params = self.alg.parameters
Expand Down
2 changes: 1 addition & 1 deletion python/plugins/processing/gui/HelpEditionDialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def updateHtmlView(self):

def getDescription(self, name):
if name in self.descriptions:
return self.descriptions[name].replace('\n', '<br>')
return self.descriptions[name].replace('\n', '<br>')
else:
return ''

Expand Down
4 changes: 2 additions & 2 deletions python/plugins/processing/gui/MessageBarProgress.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ def __init__(self):

def error(self, msg):
interface.iface.messageBar().clearWidgets()
interface.iface.messageBar().pushMessage("Error", msg,
interface.iface.messageBar().pushMessage("Error", msg,
level = QgsMessageBar.CRITICAL,
duration = 3)

def setText(self, text):
pass

Expand Down
Loading

0 comments on commit ec0f0be

Please sign in to comment.