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

  • Committer: Jelmer Vernooij
  • Date: 2006-09-27 17:56:26 UTC
  • mto: (0.12.2 olive)
  • mto: This revision was merged to the branch mainline in revision 83.
  • Revision ID: jelmer@samba.org-20060927175626-4462e9dc20d422b1
Bunch of random cleanups

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
except:
29
29
    sys.exit(1)
30
30
 
31
 
import olive.backend.errors as errors
32
 
import olive.backend.fileops as fileops
 
31
import bzrlib.errors as errors
33
32
 
34
33
class OliveRename:
35
34
    """ Display the Rename dialog and perform the needed actions. """
36
 
    def __init__(self, gladefile, comm, dialog):
 
35
    def __init__(self, gladefile, comm):
37
36
        """ Initialize the Rename dialog. """
38
37
        self.gladefile = gladefile
39
38
        self.glade = gtk.glade.XML(self.gladefile, 'window_rename')
40
39
        
41
40
        # Communication object
42
41
        self.comm = comm
43
 
        # Dialog object
44
 
        self.dialog = dialog
45
42
        
46
43
        self.window = self.glade.get_widget('window_rename')
47
44
        
64
61
        new_filename = entry.get_text()
65
62
            
66
63
        if old_filename is None:
67
 
            self.dialog.error_dialog(_('No file was selected'),
 
64
            error_dialog(_('No file was selected'),
68
65
                                     _('Please select a file from the list to proceed.'))
69
66
            return
70
67
        
71
68
        if new_filename == "":
72
 
            self.dialog.error_dialog(_('Filename not given'),
 
69
            error_dialog(_('Filename not given'),
73
70
                                     _('Please specify a new name for the file.'))
74
71
            return
75
72
        
78
75
        
79
76
        # Rename the file
80
77
        try:
81
 
            fileops.rename(source, destination)
 
78
            wt1, path1 = WorkingTree.open_containing(source)
 
79
            wt2, path2 = WorkingTree.open_containing(source)
 
80
 
 
81
            if wt1.base != wt2.base:
 
82
                error_dialog(_('Not the same branch'),
 
83
                                         _('The destination is not in the same branch.'))
 
84
                return
 
85
            wt1.rename_one(source, destination)
82
86
        except errors.NotBranchError:
83
 
            self.dialog.error_dialog(_('File is not in a branch'),
 
87
            error_dialog(_('File is not in a branch'),
84
88
                                     _('The selected file is not in a branch.'))
85
89
            return
86
 
        except errors.NotSameBranchError:
87
 
            self.dialog.error_dialog(_('Not the same branch'),
88
 
                                     _('The destination is not in the same branch.'))
89
 
            return
90
 
        except:
91
 
            raise
92
90
 
93
91
        self.close()
94
92
        self.comm.refresh_right()