1
+ # -*- coding: utf-8 -*-
2
+
3
+ """
4
+ ***************************************************************************
5
+ DeleteRScriptAction.py
6
+ ---------------------
7
+ Date : August 2012
8
+ Copyright : (C) 2012 by Victor Olaya
9
+ Email : volayaf at gmail dot com
10
+ ***************************************************************************
11
+ * *
12
+ * This program is free software; you can redistribute it and/or modify *
13
+ * it under the terms of the GNU General Public License as published by *
14
+ * the Free Software Foundation; either version 2 of the License, or *
15
+ * (at your option) any later version. *
16
+ * *
17
+ ***************************************************************************
18
+ """
19
+
20
+ __author__ = 'Victor Olaya'
21
+ __date__ = 'August 2012'
22
+ __copyright__ = '(C) 2012, Victor Olaya'
23
+ # This will get replaced with a git SHA1 when you do a git archive
24
+ __revision__ = '$Format:%H$'
25
+
26
+ from sextante .r .RAlgorithm import RAlgorithm
27
+ from sextante .gui .ContextAction import ContextAction
28
+ import os
29
+ from PyQt4 import QtGui
30
+
31
+ class DeleteRScriptAction (ContextAction ):
32
+
33
+ def __init__ (self ):
34
+ self .name = "Delete script"
35
+
36
+ def isEnabled (self ):
37
+ return isinstance (self .alg , RAlgorithm )
38
+
39
+ def execute (self , alg ):
40
+ reply = QtGui .QMessageBox .question (None , 'Confirmation' ,
41
+ "Are you sure you want to delete this script?" , QtGui .QMessageBox .Yes |
42
+ QtGui .QMessageBox .No , QtGui .QMessageBox .No )
43
+ if reply == QtGui .QMessageBox .Yes :
44
+ os .remove (self .alg .descriptionFile )
45
+ self .toolbox .updateTree ()
0 commit comments