/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-29 20:59:52 UTC
  • mfrom: (0.8.92 merge)
  • Revision ID: jelmer@samba.org-20060929205952-32ce1f02b7cf334b
MergeĀ OliveĀ code.

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
    pygtk.require("2.0")
23
23
except:
24
24
    pass
25
 
try:
26
 
    import gtk
27
 
    import gtk.glade
28
 
except:
29
 
    sys.exit(1)
30
 
 
31
 
import olive.backend.errors as errors
32
 
import olive.backend.fileops as fileops
 
25
 
 
26
import gtk
 
27
import gtk.glade
 
28
 
 
29
import bzrlib.errors as errors
 
30
 
 
31
from olive import gladefile
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, comm):
37
36
        """ Initialize the Move dialog. """
38
 
        self.gladefile = gladefile
39
 
        self.glade = gtk.glade.XML(self.gladefile, 'window_move', 'olive-gtk')
 
37
        self.glade = gtk.glade.XML(gladefile, 'window_move', 'olive-gtk')
40
38
        
41
39
        # Communication object
42
40
        self.comm = comm
43
 
        # Dialog object
44
 
        self.dialog = dialog
45
41
        
46
42
        self.window = self.glade.get_widget('window_move')
47
43
        
66
62
        filename = self.comm.get_selected_right()
67
63
            
68
64
        if filename is None:
69
 
            self.dialog.error_dialog(_('No file was selected'),
 
65
            error_dialog(_('No file was selected'),
70
66
                                     _('Please select a file from the list to proceed.'))
71
67
            return
72
68
        
74
70
        
75
71
        # Move the file to a directory
76
72
        try:
77
 
            fileops.move([source, destination])
 
73
            wt1, path1 = WorkingTree.open_containing(source)
 
74
            wt2, path2 = WorkingTree.open_containing(destination)
 
75
            if wt1.base != wt2.base:
 
76
                error_dialog(_('Not the same branch'),
 
77
                                         _('The destination is not in the same branch.'))
 
78
                return
 
79
 
 
80
            wt1.move([source], destination)
78
81
        except errors.NotBranchError:
79
 
            self.dialog.error_dialog(_('File is not in a branch'),
 
82
            error_dialog(_('File is not in a branch'),
80
83
                                     _('The selected file is not in a branch.'))
81
84
            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
85
 
89
86
        self.close()
90
87
        self.comm.refresh_right()