Skip to content
Permalink
Browse files

[Processing] Fix isEnabled check for modeler context menu actions

  • Loading branch information
github-actions authored and nyalldawson committed Feb 12, 2020
1 parent a4c55fb commit a6cea90120b26422c5fa09e0ed60322d8b4ba958
@@ -23,7 +23,7 @@

import os
from qgis.core import (QgsApplication,
QgsProcessingModelAlgorithm,
QgsProcessingAlgorithm,
QgsProject)
from qgis.PyQt.QtWidgets import QMessageBox
from qgis.PyQt.QtCore import QCoreApplication
@@ -38,7 +38,7 @@ def __init__(self):
self.name = QCoreApplication.translate('DeleteModelAction', 'Delete Model…')

def isEnabled(self):
return isinstance(self.itemData, QgsProcessingModelAlgorithm)
return isinstance(self.itemData, QgsProcessingAlgorithm) and self.itemData.provider().id() == "model"

def execute(self):
model = self.itemData
@@ -22,7 +22,7 @@
__copyright__ = '(C) 2012, Victor Olaya'

from qgis.PyQt.QtCore import QCoreApplication
from qgis.core import QgsApplication, QgsProcessingModelAlgorithm, QgsMessageLog
from qgis.core import QgsApplication, QgsProcessingAlgorithm
from processing.gui.ContextAction import ContextAction
from processing.modeler.ModelerDialog import ModelerDialog
from qgis.core import Qgis
@@ -36,7 +36,7 @@ def __init__(self):
self.name = QCoreApplication.translate('EditModelAction', 'Edit Model…')

def isEnabled(self):
return isinstance(self.itemData, QgsProcessingModelAlgorithm)
return isinstance(self.itemData, QgsProcessingAlgorithm) and self.itemData.provider().id() == "model"

def execute(self):
alg = self.itemData
@@ -22,7 +22,7 @@
__copyright__ = '(C) 2019, Nyall Dawson'

from qgis.PyQt.QtCore import QCoreApplication
from qgis.core import QgsProcessingModelAlgorithm, QgsProcessing, QgsApplication
from qgis.core import QgsProcessingAlgorithm, QgsProcessing, QgsApplication
from processing.gui.ContextAction import ContextAction
from processing.script.ScriptEditorDialog import ScriptEditorDialog

@@ -34,7 +34,7 @@ def __init__(self):
self.name = QCoreApplication.translate('ExportModelAsPythonScriptAction', 'Export Model as Python Algorithm…')

def isEnabled(self):
return isinstance(self.itemData, QgsProcessingModelAlgorithm)
return isinstance(self.itemData, QgsProcessingAlgorithm) and self.itemData.provider().id() == "model"

def icon(self):
return QgsApplication.getThemeIcon('/mActionSaveAsPython.svg')

0 comments on commit a6cea90

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