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. |
- 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:
IntEnumDialog 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[source]¶
pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- signal algorithmFinished[source]¶
pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- 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
stringfor display in the log tab.- Parameters:
string (Optional[str])
- Return type:
str
- virtual isFinalized(self) bool[source]¶
Returns
Trueif 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
errorstring to the dialog’s log.If
fatalErrorisTrue, 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
algorithmto 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
taskrunning in the dialog. The task will automatically be started by the dialog. Ownership oftaskis 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
messagein 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
levelto 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
widgetfor 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
valuesto 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.