Skip to content

Commit

Permalink
added delete model action (#5392)
Browse files Browse the repository at this point in the history
git-svn-id: http://sextante.googlecode.com/svn/trunk/soft/bindings/qgis-plugin@112 881b9c09-3ef8-f3c2-ec3d-21d735c97f4d
  • Loading branch information
volayaf committed Apr 17, 2012
1 parent 24ea829 commit 511ffb2
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
15 changes: 15 additions & 0 deletions src/sextante/modeler/DeleteModelAction.py
@@ -0,0 +1,15 @@
from sextante.gui.ContextAction import ContextAction
from sextante.modeler.ModelerAlgorithm import ModelerAlgorithm
import os

class DeleteModelAction(ContextAction):

def __init__(self):
self.name="Delete model"

def isEnabled(self):
return isinstance(self.alg, ModelerAlgorithm)

def execute(self):
os.remove(self.alg.descriptionFile)
self.toolbox.updateTree()
3 changes: 2 additions & 1 deletion src/sextante/modeler/ModelerAlgorithmProvider.py
Expand Up @@ -10,13 +10,14 @@
from sextante.modeler.CreateNewModelAction import CreateNewModelAction
from sextante.core.AlgorithmProvider import AlgorithmProvider
from PyQt4 import QtGui
from sextante.modeler.DeleteModelAction import DeleteModelAction

class ModelerAlgorithmProvider(AlgorithmProvider):

def __init__(self):
AlgorithmProvider.__init__(self)
self.actions = [CreateNewModelAction()]
self.contextMenuActions = [EditModelAction()]
self.contextMenuActions = [EditModelAction(), DeleteModelAction()]

def initializeSettings(self):
AlgorithmProvider.initializeSettings(self)
Expand Down

0 comments on commit 511ffb2

Please sign in to comment.