Skip to content
Permalink
Browse files

Merge pull request #8957 from volaya/#19607

[processing] do not allow editing model if it's missing algorithms
  • Loading branch information
m-kuhn committed Jan 24, 2019
2 parents 861a8b7 + 9bdaac9 commit 7482f7a448dbbf908316dcb3edcb4c35584f9d77
Showing with 10 additions and 4 deletions.
  1. +10 −4 python/plugins/processing/modeler/EditModelAction.py
@@ -26,9 +26,11 @@
__revision__ = '$Format:%H$'

from qgis.PyQt.QtCore import QCoreApplication
from qgis.core import QgsApplication, QgsProcessingModelAlgorithm
from qgis.core import QgsApplication, QgsProcessingModelAlgorithm, QgsMessageLog
from processing.gui.ContextAction import ContextAction
from processing.modeler.ModelerDialog import ModelerDialog
from qgis.core import Qgis
from qgis.utils import iface


class EditModelAction(ContextAction):
@@ -41,9 +43,13 @@ def isEnabled(self):

def execute(self):
alg = self.itemData
dlg = ModelerDialog(alg)
dlg.update_model.connect(self.updateModel)
dlg.show()
ok, msg = alg.canExecute()
if not ok:
iface.messageBar().pushMessage(QCoreApplication.translate('EditModelAction', 'Cannot edit model: {}').format(msg), level=Qgis.Warning)
else:
dlg = ModelerDialog(alg)
dlg.update_model.connect(self.updateModel)
dlg.show()

def updateModel(self):
QgsApplication.processingRegistry().providerById('model').refreshAlgorithms()

0 comments on commit 7482f7a

Please sign in to comment.
You can’t perform that action at this time.