/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: 2006-09-27 18:08:35 UTC
  • mto: (0.12.2 olive)
  • mto: This revision was merged to the branch mainline in revision 83.
  • Revision ID: jelmer@samba.org-20060927180835-4c295d9bb936623a
Turn some windows into dialogs.
Remove the diffwindow code from olive, 
switched to using the one from bzr-gtk instead.

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 OliveMove:
35
34
    """ Display the Move dialog and perform the needed actions. """
36
 
    def __init__(self, gladefile, comm, dialog):
 
35
    def __init__(self, gladefile, comm):
37
36
        """ Initialize the Move dialog. """
38
37
        self.gladefile = gladefile
39
38
        self.glade = gtk.glade.XML(self.gladefile, 'window_move', 'olive-gtk')
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_move')
47
44
        
66
63
        filename = self.comm.get_selected_right()
67
64
            
68
65
        if filename is None:
69
 
            self.dialog.error_dialog(_('No file was selected'),
 
66
            error_dialog(_('No file was selected'),
70
67
                                     _('Please select a file from the list to proceed.'))
71
68
            return
72
69
        
74
71
        
75
72
        # Move the file to a directory
76
73
        try:
77
 
            fileops.move([source, destination])
 
74
            wt1, path1 = WorkingTree.open_containing(source)
 
75
            wt2, path2 = WorkingTree.open_containing(destination)
 
76
            if wt1.base != wt2.base:
 
77
                error_dialog(_('Not the same branch'),
 
78
                                         _('The destination is not in the same branch.'))
 
79
                return
 
80
 
 
81
            wt1.move([source], destination)
78
82
        except errors.NotBranchError:
79
 
            self.dialog.error_dialog(_('File is not in a branch'),
 
83
            error_dialog(_('File is not in a branch'),
80
84
                                     _('The selected file is not in a branch.'))
81
85
            return
82
 
        except errors.NotSameBranchError:
83
 
            self.dialog.error_dialog(_('Not the same branch'),
84
 
                                     _('The destination is not in the same branch.'))
85
 
            return
86
 
        except:
87
 
            raise
88
86
 
89
87
        self.close()
90
88
        self.comm.refresh_right()