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¶
Base classes¶
An interface for objects which can create sets of parameter values for processing algorithms. |
|
An interface for objects which can create Processing contexts. |
Subclasses¶
Base class for processing batch algorithm dialogs. |
Enums
Dialog modes. |
Methods
Returns the algorithm running in the dialog. |
|
Applies any defined overrides for Processing context settings to the specified context. |
|
Blocks run and changeParameters buttons and parameters tab while the algorithm is running. |
|
Returns the dialog's button box. |
|
Returns the dialog's cancel button. |
|
Returns the dialog's change parameters button. |
|
Clears the current log contents. |
|
Clears any current progress from the dialog. |
|
Copies the current log contents to the clipboard. |
|
Creates a new processing feedback object, automatically connected to the appropriate slots in this dialog. |
|
Creates a modal progress dialog showing progress and log messages from this dialog. |
|
Hides the short help panel. |
|
Returns the logging level to use when running algorithms from the dialog. |
|
Returns the main widget for the dialog, usually a panel for configuring algorithm parameters. |
|
Returns the dialog's message bar. |
|
Pushes command info to the dialog's log. |
|
Pushes a console info string to the dialog's log. |
|
Pushes a debug info string to the dialog's log. |
|
Pushes a pre-formatted message to the dialog's log |
|
Pushes an information string to the dialog's log. |
|
Pushes a warning information string to the dialog's log. |
|
Reports an error string to the dialog's log. |
|
Resets the dialog's gui, ready for another algorithm execution. |
|
Returns the results returned by the algorithm executed. |
|
Returns the dialog's run button. |
|
Opens a dialog allowing users to save the current log contents. |
|
Saves the log contents to a text file (specified by the file path), in the given format. |
|
Sets the algorithm to run in the dialog. |
|
Sets the current task running in the dialog. |
|
Sets whether the algorithm was executed through the dialog. |
|
Sets whether the algorithm was executed through the dialog (no matter the result). |
|
Displays an info message in the dialog's log. |
|
Sets the logging level to use when running algorithms from the dialog. |
|
Sets the main widget for the dialog, usually a panel for configuring algorithm parameters. |
|
Sets the percentage progress for the dialog, between 0 and 100. |
|
Sets a progress text message. |
|
Sets the algorithm results. |
|
Switches the dialog to the log page. |
|
Switches the dialog to the parameters page. |
|
Returns the dialog's tab widget. |
|
Sets visibility for mutually exclusive buttons Run and Change Parameters. |
|
Returns |
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.
Called when an algorithm task has completed. |
|
For subclasses to register their own GUI controls to be blocked while the algorithm is running. |
|
Called when the algorithm has finished executing. |
|
Returns |
|
For subclasses to register their own GUI controls to be reset, ready for another algorithm execution. |
|
Called when the dialog's algorithm should be run. |
|
Sets the parameter values to show in the dialog. |
Static Methods
Formats an input string for display in the log tab. |
Signals
Emitted when the algorithm is about to run in the specified context. |
|
Emitted whenever an algorithm has finished executing in the dialog. |
Attributes
- 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 modeBatch
: 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
- 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]
- 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:
successful (bool)
result (Dict[str, Any])
context (QgsProcessingContext)
feedback (Optional[QgsProcessingFeedback])
- static formatStringForLog(string: str | None) str [source]¶
Formats an input
string
for display in the log tab.- Parameters:
string (Optional[str])
- Return type:
str
- 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
Added in version 3.20.
- Return type:
- mainWidget(self) QgsPanelWidget | None [source]¶
Returns the main widget for the dialog, usually a panel for configuring algorithm parameters.
See also
- 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
isTrue
, 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.
- results(self) Dict[str, Any] [source]¶
Returns the results returned by the algorithm executed.
See also
See also
- 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
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 givenformat
.See also
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
- 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 oftask
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
See also
- 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
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
- 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
See also
- Parameters:
results (Dict[str, Any])
- 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.