Minor cleanup in processing plugin python code

This commit is contained in:
Valentin Buira 2025-08-26 14:12:05 +02:00 committed by Nyall Dawson
parent 0503771bf1
commit 1ddc5ad90c
2 changed files with 125 additions and 119 deletions

View File

@ -444,16 +444,17 @@ class ProcessingPlugin(QObject):
.createAlgorithmById(alg_id, config)
)
if alg is not None:
if not alg:
return
ok, message = alg.canExecute()
if not ok:
dlg = MessageDialog()
dlg.setTitle(self.tr("Error executing algorithm"))
dlg.setMessage(
self.tr(
"<h3>This algorithm cannot " "be run :-( </h3>\n{0}"
).format(message)
self.tr("<h3>This algorithm cannot " "be run :-( </h3>\n{0}").format(
message
)
)
dlg.exec()
return
@ -462,7 +463,8 @@ class ProcessingPlugin(QObject):
dlg = BatchAlgorithmDialog(alg, iface.mainWindow())
dlg.show()
dlg.exec()
else:
return
in_place_input_parameter_name = "INPUT"
if hasattr(alg, "inputParameterName"):
in_place_input_parameter_name = alg.inputParameterName()

View File

@ -114,7 +114,9 @@ class AlgorithmLocatorFilter(QgsLocatorFilter):
def triggerResult(self, result):
alg = QgsApplication.processingRegistry().createAlgorithmById(result.userData)
if alg:
if not alg:
return
ok, message = alg.canExecute()
if not ok:
dlg = MessageDialog()
@ -221,7 +223,9 @@ class InPlaceAlgorithmLocatorFilter(QgsLocatorFilter):
alg = QgsApplication.processingRegistry().createAlgorithmById(
result.userData, config
)
if alg:
if not alg:
return
ok, message = alg.canExecute()
if not ok:
dlg = MessageDialog()