~bzr-gtk/bzr-gtk/0.95

« back to all changes in this revision

Viewing changes to olive/frontend/gtk/commit.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:
29
29
except:
30
30
    sys.exit(1)
31
31
 
32
 
import bzrlib
 
32
from bzrlib import version_info
33
33
 
34
 
if bzrlib.version_info < (0, 9):
 
34
if version_info < (0, 9):
35
35
    # function deprecated after 0.9
36
36
    from bzrlib.delta import compare_trees
37
37
 
43
43
    def __init__(self, gladefile, comm, dialog):
44
44
        """ Initialize the Commit dialog. """
45
45
        self.gladefile = gladefile
46
 
        self.glade = gtk.glade.XML(self.gladefile, 'window_commit')
 
46
        self.glade = gtk.glade.XML(self.gladefile, 'window_commit', 'olive-gtk')
47
47
        
48
48
        # Communication object
49
49
        self.comm = comm
50
50
        # Dialog object
51
51
        self.dialog = dialog
52
52
        
53
 
        # Get the Commit dialog widget
 
53
        # Get some important widgets
54
54
        self.window = self.glade.get_widget('window_commit')
 
55
        self.checkbutton_local = self.glade.get_widget('checkbutton_commit_local')
 
56
        self.textview = self.glade.get_widget('textview_commit')
 
57
        self.file_view = self.glade.get_widget('treeview_commit_select')
55
58
 
56
59
        # Check if current location is a branch
57
60
        try:
72
75
        
73
76
        # Set the delta
74
77
        self.old_tree = self.wt.branch.repository.revision_tree(self.wt.branch.last_revision())
75
 
        if bzrlib.version_info < (0, 9):
 
78
        if version_info < (0, 9):
76
79
            self.delta = compare_trees(self.old_tree, self.wt)
77
80
        else:
78
81
            self.delta = self.wt.changes_from(self.old_tree)
86
89
        
87
90
        # Create the file list
88
91
        self._create_file_view()
89
 
        
90
 
        # Some additional widgets
91
 
        self.checkbutton_local = self.glade.get_widget('checkbutton_commit_local')
92
 
        self.textview = self.glade.get_widget('textview_commit')
93
92
    
94
93
    def display(self):
95
94
        """ Display the Push dialog. """
96
95
        if self.notbranch:
97
 
            self.dialog.error_dialog('Directory is not a branch',
98
 
                                     'You can perform this action only in a branch.')
 
96
            self.dialog.error_dialog(_('Directory is not a branch'),
 
97
                                     _('You can perform this action only in a branch.'))
99
98
            self.close()
100
99
        else:
101
100
            from olive.backend.info import is_checkout
112
111
        self.file_store = gtk.ListStore(gobject.TYPE_BOOLEAN,
113
112
                                        gobject.TYPE_STRING,
114
113
                                        gobject.TYPE_STRING)
115
 
        self.file_view = self.glade.get_widget('treeview_commit_select')
116
114
        self.file_view.set_model(self.file_store)
117
115
        crt = gtk.CellRendererToggle()
118
116
        crt.set_property("activatable", True)
119
117
        crt.connect("toggled", self._toggle_commit, self.file_store)
120
 
        self.file_view.append_column(gtk.TreeViewColumn("Commit",
 
118
        self.file_view.append_column(gtk.TreeViewColumn(_('Commit'),
121
119
                                     crt, active=0))
122
 
        self.file_view.append_column(gtk.TreeViewColumn("Path",
 
120
        self.file_view.append_column(gtk.TreeViewColumn(_('Path'),
123
121
                                     gtk.CellRendererText(), text=1))
124
 
        self.file_view.append_column(gtk.TreeViewColumn("Type",
 
122
        self.file_view.append_column(gtk.TreeViewColumn(_('Type'),
125
123
                                     gtk.CellRendererText(), text=2))
126
124
 
127
 
        for path, _, _ in self.delta.added:
128
 
            self.file_store.append([ True, path, "added" ])
129
 
 
130
 
        for path, _, _ in self.delta.removed:
131
 
            self.file_store.append([ True, path, "removed" ])
132
 
 
133
 
        for oldpath, _, _, _, _, _ in self.delta.renamed:
134
 
            self.file_store.append([ True, oldpath, "renamed"])
135
 
 
136
 
        for path, _, _, _, _ in self.delta.modified:
137
 
            self.file_store.append([ True, path, "modified"])
 
125
        for path, id, kind in self.delta.added:
 
126
            self.file_store.append([ True, path, _('added') ])
 
127
 
 
128
        for path, id, kind in self.delta.removed:
 
129
            self.file_store.append([ True, path, _('removed') ])
 
130
 
 
131
        for oldpath, newpath, id, kind, text_modified, meta_modified in self.delta.renamed:
 
132
            self.file_store.append([ True, oldpath, _('renamed') ])
 
133
 
 
134
        for path, id, kind, text_modified, meta_modified in self.delta.modified:
 
135
            self.file_store.append([ True, path, _('modified') ])
138
136
    
139
137
    def _get_specific_files(self):
140
138
        ret = []
170
168
                           local=self.checkbutton_local.get_active(),
171
169
                           specific_files=specific_files)
172
170
        except errors.NotBranchError:
173
 
            self.dialog.error_dialog('Directory is not a branch',
174
 
                                     'You can perform this action only in a branch.')
 
171
            self.dialog.error_dialog(_('Directory is not a branch'),
 
172
                                     _('You can perform this action only in a branch.'))
175
173
            self.comm.set_busy(self.window, False)
176
174
            return
177
175
        except errors.LocalRequiresBoundBranch:
178
 
            self.dialog.error_dialog('Directory is not a checkout',
179
 
                                     'You can perform local commit only on checkouts.')
 
176
            self.dialog.error_dialog(_('Directory is not a checkout'),
 
177
                                     _('You can perform local commit only on checkouts.'))
180
178
            self.comm.set_busy(self.window, False)
181
179
            return
182
180
        except errors.PointlessCommit:
183
 
            self.dialog.error_dialog('No changes to commit',
184
 
                                     'Try force commit if you want to commit anyway.')
 
181
            self.dialog.error_dialog(_('No changes to commit'),
 
182
                                     _('Try force commit if you want to commit anyway.'))
185
183
            self.comm.set_busy(self.window, False)
186
184
            return
187
185
        except errors.ConflictsInTree:
188
 
            self.dialog.error_dialog('Conflicts in tree'
189
 
                                     'You need to resolve the conflicts before committing.')
 
186
            self.dialog.error_dialog(_('Conflicts in tree'),
 
187
                                     _('You need to resolve the conflicts before committing.'))
190
188
            self.comm.set_busy(self.window, False)
191
189
            return
192
190
        except errors.StrictCommitFailed:
193
 
            self.dialog.error_dialog('Strict commit failed'
194
 
                                     'There are unknown files in the working tree.\nPlease add or delete them.')
 
191
            self.dialog.error_dialog(_('Strict commit failed'),
 
192
                                     _('There are unknown files in the working tree.\nPlease add or delete them.'))
195
193
            self.comm.set_busy(self.window, False)
196
194
            return
197
195
        except errors.BoundBranchOutOfDate, errmsg:
198
 
            self.dialog.error_dialog('Bound branch is out of date',
199
 
                                     '%s' % errmsg)
 
196
            self.dialog.error_dialog(_('Bound branch is out of date'),
 
197
                                     _('%s') % errmsg)
200
198
            self.comm.set_busy(self.window, False)
201
199
            return
202
200
        except: