File tree Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change 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 ()
Original file line number Diff line number Diff line change 1010from sextante .modeler .CreateNewModelAction import CreateNewModelAction
1111from sextante .core .AlgorithmProvider import AlgorithmProvider
1212from PyQt4 import QtGui
13+ from sextante .modeler .DeleteModelAction import DeleteModelAction
1314
1415class 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 )
You can’t perform that action at this time.
0 commit comments