/b-gtk/fix-viz

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/b-gtk/fix-viz

« back to all changes in this revision

Viewing changes to olive/menu.py

  • Committer: Jelmer Vernooij
  • Date: 2007-07-15 15:22:29 UTC
  • Revision ID: jelmer@samba.org-20070715152229-clmlen0vpd8d2pzx
Add docstrings, remove unused code.

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
# along with this program; if not, write to the Free Software
15
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
16
 
17
 
import os
18
17
import os.path
19
 
import shutil
20
18
import sys
21
19
 
22
20
try:
30
28
import bzrlib.errors as errors
31
29
from bzrlib.workingtree import WorkingTree
32
30
 
33
 
from bzrlib.plugins.gtk.dialog import error_dialog, info_dialog, question_dialog, warning_dialog
 
31
from bzrlib.plugins.gtk.dialog import error_dialog, info_dialog, warning_dialog
34
32
from bzrlib.plugins.gtk.errors import show_bzr_error
35
33
from bzrlib.plugins.gtk.annotate.gannotate import GAnnotateWindow
36
34
from bzrlib.plugins.gtk.annotate.config import GAnnotateConfig
66
64
                                       _('Remove'), None,
67
65
                                       _('Remove the selected file'),
68
66
                                       self.remove_file),
69
 
                                      ('remove_and_delete', gtk.STOCK_REMOVE,
70
 
                                       _('Remove and delete'), None,
71
 
                                       _('Remove the selected file/dir and delete from disk'),
72
 
                                       self.remove_and_delete_file),
73
67
                                      ('rename', None,
74
68
                                       _('Rename'), None,
75
69
                                       _('Rename the selected file'),
207
201
            branch.unlock()
208
202
    
209
203
    @show_bzr_error
210
 
    def remove_file(self, action,delete_on_disk=0):
 
204
    def remove_file(self, action):
211
205
        """ Right context menu -> Remove """
212
206
        # Remove only the selected file
213
207
        directory = self.path
220
214
        
221
215
        wt, path = WorkingTree.open_containing(os.path.join(directory, filename))
222
216
        wt.remove(path)
223
 
        
224
 
        if delete_on_disk:
225
 
            abs_filename = os.path.join(directory,filename)
226
 
            if os.path.isdir(abs_filename):
227
 
                response = question_dialog(_('Delete directory with all directories below ?'), abs_filename )
228
 
                if response == gtk.RESPONSE_YES:
229
 
                    shutil.rmtree(abs_filename)
230
 
            else:
231
 
                os.remove(abs_filename)
232
 
                
233
217
        self.app.set_path(self.path)
234
218
        self.app.refresh_right()
235
 
        
236
 
    def remove_and_delete_file(self, action):
237
 
        """ Right context menu -> Remove and delete"""
238
 
        self.remove_file(action,delete_on_disk=1)
239
219
 
240
220
    def rename_file(self, action):
241
221
        """ Right context menu -> Rename """