mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-18 00:03:05 -04:00
[processing] rename AlgorithmExecutor's runalg() and runalgIterating()
to avoid overlapping with general functions and improve readability
This commit is contained in:
parent
79566f7649
commit
c1e6ba0f40
@ -40,7 +40,7 @@ from qgis.gui import QgsEncodingFileDialog
|
||||
|
||||
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
|
||||
|
||||
@ -232,7 +232,7 @@ class FieldsCalculatorDialog(BASE, WIDGET):
|
||||
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,
|
||||
|
@ -49,7 +49,7 @@ from processing.core.ProcessingLog import ProcessingLog
|
||||
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
|
||||
|
||||
@ -298,7 +298,7 @@ class Processing(object):
|
||||
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)
|
||||
|
@ -69,7 +69,7 @@ class ProcessingLog(object):
|
||||
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)
|
||||
|
@ -160,7 +160,7 @@ class Parameter(object):
|
||||
"""
|
||||
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)
|
||||
|
||||
|
@ -39,7 +39,7 @@ from processing.core.ProcessingConfig import ProcessingConfig
|
||||
|
||||
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
|
||||
@ -198,7 +198,7 @@ class AlgorithmDialog(AlgorithmDialogBase):
|
||||
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()
|
||||
@ -208,7 +208,7 @@ class AlgorithmDialog(AlgorithmDialogBase):
|
||||
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()
|
||||
|
@ -42,7 +42,7 @@ from processing.tools.system import getTempFilename
|
||||
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.
|
||||
|
||||
@ -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')
|
||||
@ -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
|
||||
|
@ -34,7 +34,7 @@ from qgis.gui import QgsMessageBar
|
||||
|
||||
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
|
||||
@ -121,7 +121,7 @@ class BatchAlgorithmDialog(AlgorithmDialogBase):
|
||||
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))
|
||||
|
@ -45,7 +45,7 @@ from processing.gui.BatchAlgorithmDialog import BatchAlgorithmDialog
|
||||
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]
|
||||
@ -275,7 +275,7 @@ class ProcessingToolbox(BASE, WIDGET):
|
||||
self.addRecentAlgorithms(True)
|
||||
else:
|
||||
feedback = MessageBarProgress()
|
||||
runalg(alg, feedback)
|
||||
execute(alg, feedback)
|
||||
handleAlgorithmResults(alg, feedback)
|
||||
feedback.close()
|
||||
if isinstance(item, TreeActionItem):
|
||||
|
@ -10,7 +10,7 @@ from processing.gui.AlgorithmDialog import AlgorithmDialog
|
||||
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
|
||||
|
||||
@ -221,7 +221,7 @@ def _executeAlgorithm(alg):
|
||||
canvas.setMapTool(prevMapTool)
|
||||
else:
|
||||
feedback = MessageBarProgress()
|
||||
runalg(alg, feedback)
|
||||
execute(alg, feedback)
|
||||
handleAlgorithmResults(alg, feedback)
|
||||
feedback.close()
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user