/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/move.py

  • Committer: Jelmer Vernooij
  • Date: 2007-01-29 23:27:09 UTC
  • Revision ID: jelmer@samba.org-20070129232709-0yygg83sh9is3xvw
Use decorator for catching and showing bzr-gtk errors graphically. Eventually, this should go away and should be handled by the ui factory.

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
from bzrlib.workingtree import WorkingTree
31
31
 
32
32
from dialog import error_dialog
 
33
from errors import show_bzr_error
33
34
from guifiles import GLADEFILENAME
34
35
 
35
36
 
68
69
        """ Display the Move dialog. """
69
70
        self.window.show_all()
70
71
 
 
72
    @show_bzr_error
71
73
    def move(self, widget):
72
74
        destination = self.filechooser.get_filename()
73
75
 
81
83
        source = os.path.join(self.wtpath, filename)
82
84
        
83
85
        # Move the file to a directory
84
 
        try:
85
 
            wt1, path1 = WorkingTree.open_containing(self.wt.abspath(source))
86
 
            wt2, path2 = WorkingTree.open_containing(destination)
87
 
            if wt1.basedir != wt2.basedir:
88
 
                error_dialog(_('Not the same branch'),
89
 
                             _('The destination is not in the same branch.'))
90
 
                return
91
 
 
92
 
            wt1.move([source], wt1.relpath(destination))
93
 
        except errors.NotBranchError:
94
 
            error_dialog(_('File is not in a branch'),
95
 
                         _('The selected file is not in a branch.'))
 
86
        wt1, path1 = WorkingTree.open_containing(self.wt.abspath(source))
 
87
        wt2, path2 = WorkingTree.open_containing(destination)
 
88
        if wt1.basedir != wt2.basedir:
 
89
            error_dialog(_('Not the same branch'),
 
90
                         _('The destination is not in the same branch.'))
96
91
            return
97
92
 
 
93
        wt1.move([source], wt1.relpath(destination))
98
94
        self.close()
99
95
    
100
96
    def close(self, widget=None):