Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[processing] rename AlgorithmExecutor's runalg() and runalgIterating()
to avoid overlapping with general functions and improve readability
  • Loading branch information
alexbruy committed Mar 22, 2017
1 parent 79566f7 commit c1e6ba0
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 18 deletions.
Expand Up @@ -40,7 +40,7 @@

from processing.core.ProcessingConfig import ProcessingConfig
from processing.core.ProcessingLog import ProcessingLog
from processing.gui.AlgorithmExecutor import runalg
from processing.gui.AlgorithmExecutor import execute
from processing.tools import dataobjects
from processing.gui.Postprocessing import handleAlgorithmResults

Expand Down Expand Up @@ -232,7 +232,7 @@ def accept(self):
ProcessingLog.addToLog(ProcessingLog.LOG_ALGORITHM,
self.alg.getAsCommand())

self.executed = runalg(self.alg, self.feedback)
self.executed = execute(self.alg, self.feedback)
if self.executed:
handleAlgorithmResults(self.alg,
self.feedback,
Expand Down
4 changes: 2 additions & 2 deletions python/plugins/processing/core/Processing.py
Expand Up @@ -49,7 +49,7 @@
from processing.gui.MessageBarProgress import MessageBarProgress
from processing.gui.RenderingStyles import RenderingStyles
from processing.gui.Postprocessing import handleAlgorithmResults
from processing.gui.AlgorithmExecutor import runalg
from processing.gui.AlgorithmExecutor import execute
from processing.tools import dataobjects
from processing.core.alglist import algList

Expand Down Expand Up @@ -298,7 +298,7 @@ def runAlgorithm(algOrName, onFinish, *args, **kwargs):
elif iface is not None:
feedback = MessageBarProgress(alg.name)

ret = runalg(alg, feedback)
ret = execute(alg, feedback)
if ret:
if onFinish is not None:
onFinish(alg, feedback)
Expand Down
2 changes: 1 addition & 1 deletion python/plugins/processing/core/ProcessingLog.py
Expand Up @@ -69,7 +69,7 @@ def addToLog(msgtype, msg):
with codecs.open(ProcessingLog.logFilename(), 'a',
encoding='utf-8') as logfile:
logfile.write(line)
algname = msg[len('Processing.runalg("'):]
algname = msg[len('processing.runalg("'):]
algname = algname[:algname.index('"')]
if algname not in ProcessingLog.recentAlgs:
ProcessingLog.recentAlgs.append(algname)
Expand Down
2 changes: 1 addition & 1 deletion python/plugins/processing/core/parameters.py
Expand Up @@ -160,7 +160,7 @@ def getValueAsCommandLineParameter(self):
"""
Returns the value of this parameter as it should have been
entered in the console if calling an algorithm using the
Processing.runalg() method.
processing.runalg() method.
"""
return str(self.value)

Expand Down
6 changes: 3 additions & 3 deletions python/plugins/processing/gui/AlgorithmDialog.py
Expand Up @@ -39,7 +39,7 @@

from processing.gui.BatchAlgorithmDialog import BatchAlgorithmDialog
from processing.gui.AlgorithmDialogBase import AlgorithmDialogBase
from processing.gui.AlgorithmExecutor import runalg, runalgIterating
from processing.gui.AlgorithmExecutor import execute, executeIterating
from processing.gui.Postprocessing import handleAlgorithmResults

from processing.core.parameters import ParameterRaster
Expand Down Expand Up @@ -198,7 +198,7 @@ def accept(self):
self.tr('<b>Algorithm {0} starting...</b>').format(self.alg.name))

if self.iterateParam:
if runalgIterating(self.alg, self.iterateParam, self.feedback):
if executeIterating(self.alg, self.iterateParam, self.feedback):
self.finish()
else:
QApplication.restoreOverrideCursor()
Expand All @@ -208,7 +208,7 @@ def accept(self):
if command:
ProcessingLog.addToLog(
ProcessingLog.LOG_ALGORITHM, command)
if runalg(self.alg, self.feedback):
if execute(self.alg, self.feedback):
self.finish()
else:
QApplication.restoreOverrideCursor()
Expand Down
6 changes: 3 additions & 3 deletions python/plugins/processing/gui/AlgorithmExecutor.py
Expand Up @@ -42,7 +42,7 @@
from processing.tools import vector


def runalg(alg, feedback=None):
def execute(alg, feedback=None):
"""Executes a given algorithm, showing its progress in the
progress object passed along.
Expand All @@ -63,7 +63,7 @@ def runalg(alg, feedback=None):
return False


def runalgIterating(alg, paramToIter, feedback):
def executeIterating(alg, paramToIter, feedback):
# Generate all single-feature layers
settings = QgsSettings()
systemEncoding = settings.value('/UI/encoding', 'System')
Expand Down Expand Up @@ -96,7 +96,7 @@ def runalgIterating(alg, paramToIter, feedback):
out.value = filename
feedback.setProgressText(tr('Executing iteration {0}/{1}...').format(i, len(filelist)))
feedback.setProgress(i * 100 / len(filelist))
if runalg(alg, feedback):
if execute(alg, feedback):
handleAlgorithmResults(alg, None, False)
else:
return False
Expand Down
4 changes: 2 additions & 2 deletions python/plugins/processing/gui/BatchAlgorithmDialog.py
Expand Up @@ -34,7 +34,7 @@

from processing.gui.BatchPanel import BatchPanel
from processing.gui.AlgorithmDialogBase import AlgorithmDialogBase
from processing.gui.AlgorithmExecutor import runalg
from processing.gui.AlgorithmExecutor import execute
from processing.gui.Postprocessing import handleAlgorithmResults

from processing.core.ProcessingResults import ProcessingResults
Expand Down Expand Up @@ -121,7 +121,7 @@ def accept(self):
for count, alg in enumerate(self.algs):
self.setText(self.tr('\nProcessing algorithm {0}/{1}...').format(count + 1, len(self.algs)))
self.setInfo(self.tr('<b>Algorithm {0} starting...</b>').format(alg.name))
if runalg(alg, self.feedback) and not self.canceled:
if execute(alg, self.feedback) and not self.canceled:
if self.load[count]:
handleAlgorithmResults(alg, self.feedback, False)
self.setInfo(self.tr('Algorithm {0} correctly executed...').format(alg.name))
Expand Down
4 changes: 2 additions & 2 deletions python/plugins/processing/gui/ProcessingToolbox.py
Expand Up @@ -45,7 +45,7 @@
from processing.gui.EditRenderingStylesDialog import EditRenderingStylesDialog
from processing.gui.ConfigDialog import ConfigDialog
from processing.gui.MessageBarProgress import MessageBarProgress
from processing.gui.AlgorithmExecutor import runalg
from processing.gui.AlgorithmExecutor import execute
from processing.core.alglist import algList

pluginPath = os.path.split(os.path.dirname(__file__))[0]
Expand Down Expand Up @@ -275,7 +275,7 @@ def executeAlgorithm(self):
self.addRecentAlgorithms(True)
else:
feedback = MessageBarProgress()
runalg(alg, feedback)
execute(alg, feedback)
handleAlgorithmResults(alg, feedback)
feedback.close()
if isinstance(item, TreeActionItem):
Expand Down
4 changes: 2 additions & 2 deletions python/plugins/processing/gui/menus.py
Expand Up @@ -10,7 +10,7 @@
from qgis.utils import iface
from qgis.core import QgsApplication
from processing.gui.MessageBarProgress import MessageBarProgress
from processing.gui.AlgorithmExecutor import runalg
from processing.gui.AlgorithmExecutor import execute
from processing.gui.Postprocessing import handleAlgorithmResults
from processing.core.Processing import Processing

Expand Down Expand Up @@ -221,7 +221,7 @@ def _executeAlgorithm(alg):
canvas.setMapTool(prevMapTool)
else:
feedback = MessageBarProgress()
runalg(alg, feedback)
execute(alg, feedback)
handleAlgorithmResults(alg, feedback)
feedback.close()

Expand Down

0 comments on commit c1e6ba0

Please sign in to comment.