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

  • Committer: Szilveszter Farkas (Phanatic)
  • Date: 2006-08-15 17:37:54 UTC
  • mto: (0.14.1 main) (93.1.1 win32.bialix)
  • mto: This revision was merged to the branch mainline in revision 83.
  • Revision ID: Szilveszter.Farkas@gmail.com-20060815173754-9877ef0e3e64660e
Some small tweaks in the .desktop file.

2006-08-15  Szilveszter Farkas <Szilveszter.Farkas@gmail.com>

    * icons/olive-gtk.png: added application icon

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