Class: QgsProcessingAlgorithmDialogBase

Base class for processing algorithm dialogs.

Note

This is not considered stable API and may change in future QGIS versions.

Note

This is an abstract class, with methods which must be implemented by a subclass.

The following methods must be implemented: QgsProcessingParametersGenerator.createProcessingParameters(), QgsProcessingContextGenerator.processingContext()

Class Hierarchy

Inheritance diagram of qgis.gui.QgsProcessingAlgorithmDialogBase

Base classes

QDialog

QWidget

QObject

QPaintDevice

QgsProcessingParametersGenerator

An interface for objects which can create sets of parameter values for processing algorithms.

QgsProcessingContextGenerator

An interface for objects which can create Processing contexts.

Subclasses

QgsProcessingBatchAlgorithmDialogBase

Base class for processing batch algorithm dialogs.

Enums

DialogMode

Dialog modes.

Methods

algorithm

Returns the algorithm running in the dialog.

applyContextOverrides

Applies any defined overrides for Processing context settings to the specified context.

blockControlsWhileRunning

Blocks run and changeParameters buttons and parameters tab while the algorithm is running.

buttonBox

Returns the dialog's button box.

cancelButton

Returns the dialog's cancel button.

changeParametersButton

Returns the dialog's change parameters button.

clearLog

Clears the current log contents.

clearProgress

Clears any current progress from the dialog.

copyLogToClipboard

Copies the current log contents to the clipboard.

createFeedback

Creates a new processing feedback object, automatically connected to the appropriate slots in this dialog.

createProgressDialog

Creates a modal progress dialog showing progress and log messages from this dialog.

hideShortHelp

Hides the short help panel.

logLevel

Returns the logging level to use when running algorithms from the dialog.

mainWidget

Returns the main widget for the dialog, usually a panel for configuring algorithm parameters.

messageBar

Returns the dialog's message bar.

pushCommandInfo

Pushes command info to the dialog's log.

pushConsoleInfo

Pushes a console info string to the dialog's log.

pushDebugInfo

Pushes a debug info string to the dialog's log.

pushFormattedMessage

Pushes a pre-formatted message to the dialog's log

pushInfo

Pushes an information string to the dialog's log.

pushWarning

Pushes a warning information string to the dialog's log.

reportError

Reports an error string to the dialog's log.

resetGui

Resets the dialog's gui, ready for another algorithm execution.

results

Returns the results returned by the algorithm executed.

runButton

Returns the dialog's run button.

saveLog

Opens a dialog allowing users to save the current log contents.

saveLogToFile

Saves the log contents to a text file (specified by the file path), in the given format.

setAlgorithm

Sets the algorithm to run in the dialog.

setCurrentTask

Sets the current task running in the dialog.

setExecuted

Sets whether the algorithm was executed through the dialog.

setExecutedAnyResult

Sets whether the algorithm was executed through the dialog (no matter the result).

setInfo

Displays an info message in the dialog's log.

setLogLevel

Sets the logging level to use when running algorithms from the dialog.

setMainWidget

Sets the main widget for the dialog, usually a panel for configuring algorithm parameters.

setPercentage

Sets the percentage progress for the dialog, between 0 and 100.

setProgressText

Sets a progress text message.

setResults

Sets the algorithm results.

showLog

Switches the dialog to the log page.

showParameters

Switches the dialog to the parameters page.

tabWidget

Returns the dialog's tab widget.

updateRunButtonVisibility

Sets visibility for mutually exclusive buttons Run and Change Parameters.

wasExecuted

Returns True if an algorithm was executed in the dialog.

Virtual Methods

In PyQGIS, only methods marked as virtual can be safely overridden in a Python subclass of QgsProcessingAlgorithmDialogBase. See the FAQ for more details.

algExecuted

Called when an algorithm task has completed.

blockAdditionalControlsWhileRunning

For subclasses to register their own GUI controls to be blocked while the algorithm is running.

finished

Called when the algorithm has finished executing.

isFinalized

Returns True if the dialog is all finalized and can be safely deleted.

resetAdditionalGui

For subclasses to register their own GUI controls to be reset, ready for another algorithm execution.

runAlgorithm

Called when the dialog's algorithm should be run.

setParameters

Sets the parameter values to show in the dialog.

Static Methods

formatStringForLog

Formats an input string for display in the log tab.

Signals

algorithmAboutToRun

Emitted when the algorithm is about to run in the specified context.

algorithmFinished

Emitted whenever an algorithm has finished executing in the dialog.

Attributes

FormatHtml

FormatPlainText

class qgis.gui.QgsProcessingAlgorithmDialogBase[source]

Bases: QDialog, QgsProcessingParametersGenerator, QgsProcessingContextGenerator

__init__(parent: QWidget | None = None, flags: Qt.WindowFlags | Qt.WindowType = Qt.WindowFlags(), mode: QgsProcessingAlgorithmDialogBase.DialogMode = QgsProcessingAlgorithmDialogBase.DialogMode.Single)

Constructor for QgsProcessingAlgorithmDialogBase.

Parameters:
  • parent (Optional[QWidget] = None)

  • flags (Union[Qt.WindowFlags, Qt.WindowType] = Qt.WindowFlags())

  • mode (QgsProcessingAlgorithmDialogBase.DialogMode = QgsProcessingAlgorithmDialogBase.DialogMode.Single)

class DialogMode(*values)

Bases: IntEnum

Dialog modes.

Added in version 3.24.

  • Single: Single algorithm execution mode

  • Batch: Batch processing mode

Batch = 1
Single = 0
FormatHtml = 1
FormatPlainText = 0
class LogFormat

Bases: int

virtual algExecuted(self, successful: bool, results: Dict[str, Any])[source]

Called when an algorithm task has completed.

Added in version 3.26.

Parameters:
  • successful (bool)

  • results (Dict[str, Any])

algorithm(self) QgsProcessingAlgorithm | None[source]

Returns the algorithm running in the dialog.

See also

setAlgorithm()

Return type:

Optional[QgsProcessingAlgorithm]

signal algorithmAboutToRun(context: QgsProcessingContext)[source]

Emitted when the algorithm is about to run in the specified context.

This signal can be used to tweak the context prior to the algorithm execution.

Added in version 3.38.

Parameters:

context (QgsProcessingContext)

signal algorithmFinished(successful: bool, result: Dict[str, object])[source]

Emitted whenever an algorithm has finished executing in the dialog.

Added in version 3.14.

Parameters:
  • successful (bool)

  • result (Dict[str, object])

applyContextOverrides(self, context: QgsProcessingContext | None)[source]

Applies any defined overrides for Processing context settings to the specified context.

This allows the dialog to override default Processing settings for an individual algorithm execution.

Added in version 3.32.

Parameters:

context (Optional[QgsProcessingContext])

virtual blockAdditionalControlsWhileRunning(self)[source]

For subclasses to register their own GUI controls to be blocked while the algorithm is running.

blockControlsWhileRunning(self)[source]

Blocks run and changeParameters buttons and parameters tab while the algorithm is running.

buttonBox(self) QDialogButtonBox | None[source]

Returns the dialog’s button box.

Return type:

Optional[QDialogButtonBox]

cancelButton(self) QPushButton | None[source]

Returns the dialog’s cancel button.

Return type:

Optional[QPushButton]

changeParametersButton(self) QPushButton | None[source]

Returns the dialog’s change parameters button.

Return type:

Optional[QPushButton]

clearLog(self)[source]

Clears the current log contents.

Added in version 3.2.

clearProgress(self)[source]

Clears any current progress from the dialog.

copyLogToClipboard(self)[source]

Copies the current log contents to the clipboard.

Added in version 3.2.

createFeedback(self) QgsProcessingFeedback | None[source]

Creates a new processing feedback object, automatically connected to the appropriate slots in this dialog.

Return type:

Optional[QgsProcessingFeedback]

createProgressDialog(self) QDialog | None[source]

Creates a modal progress dialog showing progress and log messages from this dialog.

Return type:

Optional[QDialog]

virtual finished(self, successful: bool, result: Dict[str, Any], context: QgsProcessingContext, feedback: QgsProcessingFeedback | None)[source]

Called when the algorithm has finished executing.

Parameters:
static formatStringForLog(string: str | None) str[source]

Formats an input string for display in the log tab.

Parameters:

string (Optional[str])

Return type:

str

hideShortHelp(self)[source]

Hides the short help panel.

virtual isFinalized(self) bool[source]

Returns True if the dialog is all finalized and can be safely deleted.

Added in version 3.26.

Return type:

bool

logLevel(self) Qgis.ProcessingLogLevel[source]

Returns the logging level to use when running algorithms from the dialog.

See also

setLogLevel()

Added in version 3.20.

Return type:

Qgis.ProcessingLogLevel

mainWidget(self) QgsPanelWidget | None[source]

Returns the main widget for the dialog, usually a panel for configuring algorithm parameters.

See also

setMainWidget()

Return type:

Optional[QgsPanelWidget]

messageBar(self) QgsMessageBar | None[source]

Returns the dialog’s message bar.

Return type:

Optional[QgsMessageBar]

pushCommandInfo(self, info: str | None)[source]

Pushes command info to the dialog’s log.

Parameters:

info (Optional[str])

pushConsoleInfo(self, info: str | None)[source]

Pushes a console info string to the dialog’s log.

Parameters:

info (Optional[str])

pushDebugInfo(self, message: str | None)[source]

Pushes a debug info string to the dialog’s log.

Parameters:

message (Optional[str])

pushFormattedMessage(self, html: str | None)[source]

Pushes a pre-formatted message to the dialog’s log

This can be used to push formatted HTML messages to the dialog.

Added in version 3.36.

Parameters:

html (Optional[str])

pushInfo(self, info: str | None)[source]

Pushes an information string to the dialog’s log.

Parameters:

info (Optional[str])

pushWarning(self, warning: str | None)[source]

Pushes a warning information string to the dialog’s log.

Parameters:

warning (Optional[str])

reportError(self, error: str | None, fatalError: bool)[source]

Reports an error string to the dialog’s log.

If fatalError is True, the error prevented the algorithm from executing.

Parameters:
  • error (Optional[str])

  • fatalError (bool)

virtual resetAdditionalGui(self)[source]

For subclasses to register their own GUI controls to be reset, ready for another algorithm execution.

resetGui(self)[source]

Resets the dialog’s gui, ready for another algorithm execution.

results(self) Dict[str, Any][source]

Returns the results returned by the algorithm executed.

See also

wasExecuted()

See also

setResults()

Return type:

Dict[str, Any]

virtual runAlgorithm(self)[source]

Called when the dialog’s algorithm should be run. Must be overridden by subclasses.

runButton(self) QPushButton | None[source]

Returns the dialog’s run button.

Return type:

Optional[QPushButton]

saveLog(self)[source]

Opens a dialog allowing users to save the current log contents.

See also

saveLogToFile()

Added in version 3.2.

saveLogToFile(self, path: str | None, format: QgsProcessingAlgorithmDialogBase.LogFormat = QgsProcessingAlgorithmDialogBase.FormatPlainText)[source]

Saves the log contents to a text file (specified by the file path), in the given format.

See also

saveLog()

Added in version 3.2.

Parameters:
  • path (Optional[str])

  • format (QgsProcessingAlgorithmDialogBase.LogFormat = QgsProcessingAlgorithmDialogBase.FormatPlainText)

setAlgorithm(self, algorithm: QgsProcessingAlgorithm | None)[source]

Sets the algorithm to run in the dialog.

Ownership of the algorithm instance is transferred to the dialog.

See also

algorithm()

Parameters:

algorithm (Optional[QgsProcessingAlgorithm])

setCurrentTask(self, task: QgsProcessingAlgRunnerTask | None)[source]

Sets the current task running in the dialog. The task will automatically be started by the dialog. Ownership of task is transferred to the dialog.

Parameters:

task (Optional[QgsProcessingAlgRunnerTask])

setExecuted(self, executed: bool)[source]

Sets whether the algorithm was executed through the dialog.

See also

wasExecuted()

See also

setResults()

Parameters:

executed (bool)

setExecutedAnyResult(self, executedAnyResult: bool)[source]

Sets whether the algorithm was executed through the dialog (no matter the result).

Parameters:

executedAnyResult (bool)

setInfo(self, message: str | None, isError: bool = False, escapeHtml: bool = True, isWarning: bool = False)[source]

Displays an info message in the dialog’s log.

Parameters:
  • message (Optional[str])

  • isError (bool = False)

  • escapeHtml (bool = True)

  • isWarning (bool = False)

setLogLevel(self, level: Qgis.ProcessingLogLevel)[source]

Sets the logging level to use when running algorithms from the dialog.

See also

logLevel()

Added in version 3.20.

Parameters:

level (Qgis.ProcessingLogLevel)

setMainWidget(self, widget: QgsPanelWidget | None)[source]

Sets the main widget for the dialog, usually a panel for configuring algorithm parameters.

See also

mainWidget()

Parameters:

widget (Optional[QgsPanelWidget])

virtual setParameters(self, values: Dict[str, Any])[source]

Sets the parameter values to show in the dialog.

Added in version 3.24.

Parameters:

values (Dict[str, Any])

setPercentage(self, percent: float)[source]

Sets the percentage progress for the dialog, between 0 and 100.

Parameters:

percent (float)

setProgressText(self, text: str | None)[source]

Sets a progress text message.

Parameters:

text (Optional[str])

setResults(self, results: Dict[str, Any])[source]

Sets the algorithm results.

See also

results()

See also

setExecuted()

Parameters:

results (Dict[str, Any])

showLog(self)[source]

Switches the dialog to the log page.

showParameters(self)[source]

Switches the dialog to the parameters page.

tabWidget(self) QTabWidget | None[source]

Returns the dialog’s tab widget.

Return type:

Optional[QTabWidget]

updateRunButtonVisibility(self)[source]

Sets visibility for mutually exclusive buttons Run and Change Parameters.

wasExecuted(self) bool[source]

Returns True if an algorithm was executed in the dialog.

See also

results()

See also

setExecuted()

Return type:

bool