Skip to content
Permalink
Browse files

[processing] indentation fixes

  • Loading branch information
volaya committed Jan 8, 2016
1 parent b0a8c18 commit 931ca4d6d679a1594f96511f525a753eebe7aa78
@@ -77,7 +77,7 @@ def processAlgorithm(self, progress):
wld.write('%0.8f\n' % geotransform[2])
wld.write('%0.8f\n' % geotransform[5])
wld.write('%0.8f\n' % (geotransform[0] + 0.5 * geotransform[1] + 0.5
* geotransform[2]))
* geotransform[2]))
wld.write('%0.8f\n' % (geotransform[3] + 0.5 * geotransform[4] + 0.5
* geotransform[5]))
* geotransform[5]))
wld.close()
@@ -68,8 +68,7 @@ def commandLineName(self):
def defineCharacteristics(self):
self.name, self.i18n_name = self.trAlgorithm('Translate (convert format)')
self.group, self.i18n_group = self.trAlgorithm('[GDAL] Conversion')
self.addParameter(ParameterRaster(self.INPUT, self.tr('Input layer'),
False))
self.addParameter(ParameterRaster(self.INPUT, self.tr('Input layer'), False))
self.addParameter(ParameterNumber(self.OUTSIZE,
self.tr('Set the size of the output file (In pixels or %)'),
1, None, 100))
@@ -102,7 +102,7 @@ def defineCharacteristicsFromFile(self):
# An extent parameter that wraps 4 SAGA numerical parameters
self.extentParamNames = line[6:].strip().split(' ')
self.addParameter(ParameterExtent(self.OUTPUT_EXTENT,
'Output extent', '0,1,0,1'))
'Output extent', '0,1,0,1'))
else:
self.addOutput(getOutputFromString(line))
line = lines.readline().strip('\n').strip()
@@ -179,8 +179,7 @@ def processAlgorithm(self, progress):
for param in self.parameters:
if param.value is None:
continue
if isinstance(param, (ParameterRaster, ParameterVector,
ParameterTable)):
if isinstance(param, (ParameterRaster, ParameterVector, ParameterTable)):
value = param.value
if value in self.exportedLayers.keys():
command += ' -' + param.name + ' "' \
@@ -72,7 +72,7 @@ def initializeSettings(self):
self.tr('Log console output'), True))
ProcessingConfig.settingIcons["SAGA"] = self.getIcon()
ProcessingConfig.addSetting(Setting("SAGA", "ACTIVATE_SAGA",
self.tr('Activate'), self.activate))
self.tr('Activate'), self.activate))

def unload(self):
AlgorithmProvider.unload(self)
@@ -74,7 +74,7 @@ def initializeSettings(self):
ProcessingConfig.settingIcons[self.getDescription()] = self.getIcon()
name = 'ACTIVATE_' + self.getName().upper().replace(' ', '_')
ProcessingConfig.addSetting(Setting(self.getDescription(), name,
self.tr('Activate'), self.activate))
self.tr('Activate'), self.activate))

def unload(self):
"""Do here anything that you want to be done when the provider
@@ -219,8 +219,7 @@ def execute(self, progress=None, model=None):

def _checkParameterValuesBeforeExecuting(self):
for param in self.parameters:
if isinstance(param, (ParameterRaster, ParameterVector,
ParameterMultipleInput)):
if isinstance(param, (ParameterRaster, ParameterVector, ParameterMultipleInput)):
if param.value:
if isinstance(param, ParameterMultipleInput):
inputlayers = param.value.split(';')
@@ -368,8 +367,7 @@ def resolveTemporaryOutputs(self):
def setOutputCRS(self):
layers = dataobjects.getAllLayers()
for param in self.parameters:
if isinstance(param, (ParameterRaster, ParameterVector,
ParameterMultipleInput)):
if isinstance(param, (ParameterRaster, ParameterVector, ParameterMultipleInput)):
if param.value:
if isinstance(param, ParameterMultipleInput):
inputlayers = param.value.split(';')
@@ -395,7 +393,7 @@ def resolveDataObjects(self):
layers = dataobjects.getAllLayers()
for param in self.parameters:
if isinstance(param, (ParameterRaster, ParameterVector, ParameterTable,
ParameterMultipleInput)):
ParameterMultipleInput)):
if param.value:
if isinstance(param, ParameterMultipleInput):
inputlayers = param.value.split(';')
@@ -414,8 +412,7 @@ def checkInputCRS(self):
"""
crsList = []
for param in self.parameters:
if isinstance(param, (ParameterRaster, ParameterVector,
ParameterMultipleInput)):
if isinstance(param, (ParameterRaster, ParameterVector, ParameterMultipleInput)):
if param.value:
if isinstance(param, ParameterMultipleInput):
layers = param.value.split(';')
@@ -82,10 +82,10 @@ def openSettings():
self.fillTree()

def showDisabled(self):
self.txtDisabled.setVisible(False)
for providerName in self.disabledWithMatchingAlgs:
self.disabledProviderItems[providerName].setHidden(False)
self.algorithmTree.expandAll()
self.txtDisabled.setVisible(False)
for providerName in self.disabledWithMatchingAlgs:
self.disabledProviderItems[providerName].setHidden(False)
self.algorithmTree.expandAll()

def disabledProviders(self):
for providerName in Processing.algs.keys():
@@ -258,8 +258,8 @@ def saveAs(self):

def exportAsImage(self):
filename = unicode(QFileDialog.getSaveFileName(self,
self.tr('Save Model As Image'), '',
self.tr('PNG files (*.png *.PNG)')))
self.tr('Save Model As Image'), '',
self.tr('PNG files (*.png *.PNG)')))
if not filename:
return

@@ -284,8 +284,8 @@ def exportAsImage(self):

def exportAsPython(self):
filename = unicode(QFileDialog.getSaveFileName(self,
self.tr('Save Model As Python Script'), '',
self.tr('Python files (*.py *.PY)')))
self.tr('Save Model As Python Script'), '',
self.tr('Python files (*.py *.PY)')))
if not filename:
return

@@ -311,9 +311,9 @@ def saveModel(self, saveAs):
filename = self.alg.descriptionFile
else:
filename = unicode(QFileDialog.getSaveFileName(self,
self.tr('Save Model'),
ModelerUtils.modelsFolder(),
self.tr('Processing models (*.model)')))
self.tr('Save Model'),
ModelerUtils.modelsFolder(),
self.tr('Processing models (*.model)')))
if filename:
if not filename.endswith('.model'):
filename += '.model'
@@ -343,8 +343,8 @@ def saveModel(self, saveAs):

def openModel(self):
filename = unicode(QFileDialog.getOpenFileName(self,
self.tr('Open Model'), ModelerUtils.modelsFolder(),
self.tr('Processing models (*.model *.MODEL)')))
self.tr('Open Model'), ModelerUtils.modelsFolder(),
self.tr('Processing models (*.model *.MODEL)')))
if filename:
try:
alg = ModelerAlgorithm.fromFile(filename)
@@ -372,7 +372,7 @@ def openModel(self):
def repaintModel(self):
self.scene = ModelerScene()
self.scene.setSceneRect(QRectF(0, 0, ModelerAlgorithm.CANVAS_SIZE,
ModelerAlgorithm.CANVAS_SIZE))
ModelerAlgorithm.CANVAS_SIZE))
self.scene.paintModel(self.alg)
self.view.setScene(self.scene)

@@ -426,24 +426,24 @@ def addAlgorithm(self):
self._addAlgorithm(alg.getCopy())

def _addAlgorithm(self, alg, pos=None):
dlg = alg.getCustomModelerParametersDialog(self.alg)
if not dlg:
dlg = ModelerParametersDialog(alg, self.alg)
dlg.exec_()
if dlg.alg is not None:
if pos is None:
dlg.alg.pos = self.getPositionForAlgorithmItem()
else:
dlg.alg.pos = pos
if isinstance(dlg.alg.pos, QPoint):
dlg.alg.pos = QPointF(pos)
from processing.modeler.ModelerGraphicItem import ModelerGraphicItem
for i, out in enumerate(dlg.alg.outputs):
dlg.alg.outputs[out].pos = dlg.alg.pos + QPointF(ModelerGraphicItem.BOX_WIDTH, (i + 1.5)
* ModelerGraphicItem.BOX_HEIGHT)
self.alg.addAlgorithm(dlg.alg)
self.repaintModel()
self.hasChanged = True
dlg = alg.getCustomModelerParametersDialog(self.alg)
if not dlg:
dlg = ModelerParametersDialog(alg, self.alg)
dlg.exec_()
if dlg.alg is not None:
if pos is None:
dlg.alg.pos = self.getPositionForAlgorithmItem()
else:
dlg.alg.pos = pos
if isinstance(dlg.alg.pos, QPoint):
dlg.alg.pos = QPointF(pos)
from processing.modeler.ModelerGraphicItem import ModelerGraphicItem
for i, out in enumerate(dlg.alg.outputs):
dlg.alg.outputs[out].pos = dlg.alg.pos + QPointF(ModelerGraphicItem.BOX_WIDTH, (i + 1.5)
* ModelerGraphicItem.BOX_HEIGHT)
self.alg.addAlgorithm(dlg.alg)
self.repaintModel()
self.hasChanged = True

def getPositionForAlgorithmItem(self):
MARGIN = 20

0 comments on commit 931ca4d

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