/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 19:52:46 UTC
  • mto: (0.12.2 olive)
  • mto: This revision was merged to the branch mainline in revision 83.
  • Revision ID: jelmer@samba.org-20060927195246-9354d7ccf56127f5
Don't pass around gladefile all the time. 
Fix bug in status information when files have been removed.

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