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

  • Committer: Szilveszter Farkas (Phanatic)
  • Date: 2006-08-20 13:02:35 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-20060820130235-62c9c5753f5d8774
Gettext support added.

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

    * po/hu.po: added Hungarian traslation
    * Added gettext support to all files.
    * genpot.sh: added olive-gtk.pot generator script

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