Skip to content
Permalink
Browse files

[processing] do not allow editing model if it's missing algorithms

fixes #19607
  • Loading branch information
volaya committed Jan 23, 2019
1 parent e3516ab commit a86965e94bc76016b142c7b7c1dfa817675fe007
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("Cannot edit model:", 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 a86965e

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