Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Indentation
  • Loading branch information
nyalldawson committed Apr 7, 2017
1 parent 11d71d9 commit 837ee29
Showing 1 changed file with 21 additions and 12 deletions.
33 changes: 21 additions & 12 deletions python/plugins/processing/core/Processing.py 100644 → 100755
Expand Up @@ -20,7 +20,6 @@
from builtins import str
from builtins import object


__author__ = 'Victor Olaya'
__date__ = 'August 2012'
__copyright__ = '(C) 2012, Victor Olaya'
Expand Down Expand Up @@ -63,7 +62,6 @@


class Processing(object):

BASIC_PROVIDERS = []

@staticmethod
Expand Down Expand Up @@ -121,7 +119,6 @@ def removeScripts(folder):
provider.externalAlgs.remove(alg)
provider.refreshAlgorithms()


@staticmethod
def runAlgorithm(algOrName, onFinish, *args, **kwargs):
if isinstance(algOrName, GeoAlgorithm):
Expand All @@ -131,7 +128,8 @@ def runAlgorithm(algOrName, onFinish, *args, **kwargs):
if alg is None:
# fix_print_with_import
print('Error: Algorithm not found\n')
QgsMessageLog.logMessage(Processing.tr('Error: Algorithm {0} not found\n').format(algOrName), Processing.tr("Processing"))
QgsMessageLog.logMessage(Processing.tr('Error: Algorithm {0} not found\n').format(algOrName),
Processing.tr("Processing"))
return
alg = alg.getCopy()

Expand All @@ -149,7 +147,9 @@ def runAlgorithm(algOrName, onFinish, *args, **kwargs):
continue
# fix_print_with_import
print('Error: Wrong parameter value %s for parameter %s.' % (value, name))
QgsMessageLog.logMessage(Processing.tr('Error: Wrong parameter value {0} for parameter {1}.').format(value, name), Processing.tr("Processing"))
QgsMessageLog.logMessage(
Processing.tr('Error: Wrong parameter value {0} for parameter {1}.').format(value, name),
Processing.tr("Processing"))
ProcessingLog.addToLog(
ProcessingLog.LOG_ERROR,
Processing.tr('Error in {0}. Wrong parameter value {1} for parameter {2}.').format(
Expand All @@ -163,7 +163,9 @@ def runAlgorithm(algOrName, onFinish, *args, **kwargs):
if not param.setDefaultValue():
# fix_print_with_import
print('Error: Missing parameter value for parameter %s.' % param.name)
QgsMessageLog.logMessage(Processing.tr('Error: Missing parameter value for parameter {0}.').format(param.name), Processing.tr("Processing"))
QgsMessageLog.logMessage(
Processing.tr('Error: Missing parameter value for parameter {0}.').format(param.name),
Processing.tr("Processing"))
ProcessingLog.addToLog(
ProcessingLog.LOG_ERROR,
Processing.tr('Error in {0}. Missing parameter value for parameter {1}.').format(
Expand All @@ -174,7 +176,8 @@ def runAlgorithm(algOrName, onFinish, *args, **kwargs):
if len(args) != alg.getVisibleParametersCount() + alg.getVisibleOutputsCount():
# fix_print_with_import
print('Error: Wrong number of parameters')
QgsMessageLog.logMessage(Processing.tr('Error: Wrong number of parameters'), Processing.tr("Processing"))
QgsMessageLog.logMessage(Processing.tr('Error: Wrong number of parameters'),
Processing.tr("Processing"))
processing.algorithmHelp(algOrName)
return
i = 0
Expand All @@ -183,7 +186,8 @@ def runAlgorithm(algOrName, onFinish, *args, **kwargs):
if not param.setValue(args[i]):
# fix_print_with_import
print('Error: Wrong parameter value: ' + str(args[i]))
QgsMessageLog.logMessage(Processing.tr('Error: Wrong parameter value: ') + str(args[i]), Processing.tr("Processing"))
QgsMessageLog.logMessage(Processing.tr('Error: Wrong parameter value: ') + str(args[i]),
Processing.tr("Processing"))
return
i = i + 1

Expand All @@ -192,21 +196,25 @@ def runAlgorithm(algOrName, onFinish, *args, **kwargs):
if not output.setValue(args[i]):
# fix_print_with_import
print('Error: Wrong output value: ' + str(args[i]))
QgsMessageLog.logMessage(Processing.tr('Error: Wrong output value: ') + str(args[i]), Processing.tr("Processing"))
QgsMessageLog.logMessage(Processing.tr('Error: Wrong output value: ') + str(args[i]),
Processing.tr("Processing"))
return
i = i + 1

msg = alg._checkParameterValuesBeforeExecuting()
if msg:
# fix_print_with_import
print('Unable to execute algorithm\n' + str(msg))
QgsMessageLog.logMessage(Processing.tr('Unable to execute algorithm\n{0}').format(msg), Processing.tr("Processing"))
QgsMessageLog.logMessage(Processing.tr('Unable to execute algorithm\n{0}').format(msg),
Processing.tr("Processing"))
return

if not alg.checkInputCRS():
print('Warning: Not all input layers use the same CRS.\n' +
'This can cause unexpected results.')
QgsMessageLog.logMessage(Processing.tr('Warning: Not all input layers use the same CRS.\nThis can cause unexpected results.'), Processing.tr("Processing"))
QgsMessageLog.logMessage(
Processing.tr('Warning: Not all input layers use the same CRS.\nThis can cause unexpected results.'),
Processing.tr("Processing"))

# Don't set the wait cursor twice, because then when you
# restore it, it will still be a wait cursor.
Expand All @@ -231,7 +239,8 @@ def runAlgorithm(algOrName, onFinish, *args, **kwargs):
if onFinish is not None:
onFinish(alg, feedback)
else:
QgsMessageLog.logMessage(Processing.tr("There were errors executing the algorithm."), Processing.tr("Processing"))
QgsMessageLog.logMessage(Processing.tr("There were errors executing the algorithm."),
Processing.tr("Processing"))

if overrideCursor:
QApplication.restoreOverrideCursor()
Expand Down

0 comments on commit 837ee29

Please sign in to comment.