Skip to content

Commit 511ffb2

Browse files
author
volayaf
committed
added delete model action (#5392)
git-svn-id: http://sextante.googlecode.com/svn/trunk/soft/bindings/qgis-plugin@112 881b9c09-3ef8-f3c2-ec3d-21d735c97f4d
1 parent 24ea829 commit 511ffb2

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
from sextante.gui.ContextAction import ContextAction
2+
from sextante.modeler.ModelerAlgorithm import ModelerAlgorithm
3+
import os
4+
5+
class DeleteModelAction(ContextAction):
6+
7+
def __init__(self):
8+
self.name="Delete model"
9+
10+
def isEnabled(self):
11+
return isinstance(self.alg, ModelerAlgorithm)
12+
13+
def execute(self):
14+
os.remove(self.alg.descriptionFile)
15+
self.toolbox.updateTree()

src/sextante/modeler/ModelerAlgorithmProvider.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,14 @@
1010
from sextante.modeler.CreateNewModelAction import CreateNewModelAction
1111
from sextante.core.AlgorithmProvider import AlgorithmProvider
1212
from PyQt4 import QtGui
13+
from sextante.modeler.DeleteModelAction import DeleteModelAction
1314

1415
class ModelerAlgorithmProvider(AlgorithmProvider):
1516

1617
def __init__(self):
1718
AlgorithmProvider.__init__(self)
1819
self.actions = [CreateNewModelAction()]
19-
self.contextMenuActions = [EditModelAction()]
20+
self.contextMenuActions = [EditModelAction(), DeleteModelAction()]
2021

2122
def initializeSettings(self):
2223
AlgorithmProvider.initializeSettings(self)

0 commit comments

Comments
 (0)