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

  • Committer: Jelmer Vernooij
  • Date: 2008-03-04 21:59:30 UTC
  • mto: This revision was merged to the branch mainline in revision 449.
  • Revision ID: jelmer@samba.org-20080304215930-ldbbq0a0zwmk44g0
Change emblems to the new emblems submitted by Martin.

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
import bzrlib.errors as errors
31
31
from bzrlib.workingtree import WorkingTree
32
32
 
33
 
from bzrlib.plugins.gtk import _i18n
34
33
from bzrlib.plugins.gtk.dialog import error_dialog, info_dialog, question_dialog, warning_dialog
35
34
from bzrlib.plugins.gtk.errors import show_bzr_error
36
35
from bzrlib.plugins.gtk.annotate.gannotate import GAnnotateWindow
37
36
from bzrlib.plugins.gtk.annotate.config import GAnnotateConfig
38
37
from bzrlib.plugins.gtk.diff import DiffWindow
39
38
from launch import launch
40
 
from bzrlib.plugins.gtk.olive import Preferences
 
39
from olive import Preferences
41
40
 
42
41
class OliveMenu:
43
42
    """ This class is responsible for building the context menus. """
60
59
        
61
60
        self.actiongroup = gtk.ActionGroup('context')
62
61
        self.actiongroup.add_actions([('add', gtk.STOCK_ADD,
63
 
                                       _i18n('Add'), None,
64
 
                                       _i18n('Add the selected file'),
 
62
                                       _('Add'), None,
 
63
                                       _('Add the selected file'),
65
64
                                       self.add_file),
66
65
                                      ('remove', gtk.STOCK_REMOVE,
67
 
                                       _i18n('Remove'), None,
68
 
                                       _i18n('Remove the selected file'),
 
66
                                       _('Remove'), None,
 
67
                                       _('Remove the selected file'),
69
68
                                       self.remove_file),
70
69
                                      ('remove_and_delete', gtk.STOCK_REMOVE,
71
 
                                       _i18n('Remove and delete'), None,
72
 
                                       _i18n('Remove the selected file/dir and delete from disk'),
 
70
                                       _('Remove and delete'), None,
 
71
                                       _('Remove the selected file/dir and delete from disk'),
73
72
                                       self.remove_and_delete_file),
74
73
                                      ('rename', None,
75
 
                                       _i18n('Rename'), None,
76
 
                                       _i18n('Rename the selected file'),
 
74
                                       _('Rename'), None,
 
75
                                       _('Rename the selected file'),
77
76
                                       self.rename_file),
78
77
                                      ('open', gtk.STOCK_OPEN,
79
 
                                       _i18n('Open'), None,
80
 
                                       _i18n('Open the selected file'),
 
78
                                       _('Open'), None,
 
79
                                       _('Open the selected file'),
81
80
                                       self.open_file),
82
81
                                      ('revert', None,
83
 
                                       _i18n('Revert'), None,
84
 
                                       _i18n('Revert the changes'),
 
82
                                       _('Revert'), None,
 
83
                                       _('Revert the changes'),
85
84
                                       self.revert),
86
85
                                      ('commit', None,
87
 
                                       _i18n('Commit'), None,
88
 
                                       _i18n('Commit the changes'),
 
86
                                       _('Commit'), None,
 
87
                                       _('Commit the changes'),
89
88
                                       self.commit),
90
89
                                      ('annotate', None,
91
 
                                       _i18n('Annotate'), None,
92
 
                                       _i18n('Annotate the selected file'),
 
90
                                       _('Annotate'), None,
 
91
                                       _('Annotate the selected file'),
93
92
                                       self.annotate),
94
93
                                      ('diff', None,
95
 
                                       _i18n('Diff'), None,
96
 
                                       _i18n('Show the diff of the file'),
 
94
                                       _('Diff'), None,
 
95
                                       _('Show the diff of the file'),
97
96
                                       self.diff),
98
97
                                      ('bookmark', None,
99
 
                                       _i18n('Bookmark'), None,
100
 
                                       _i18n('Bookmark current location'),
 
98
                                       _('Bookmark'), None,
 
99
                                       _('Bookmark current location'),
101
100
                                       self.bookmark),
102
101
                                      ('edit_bookmark', gtk.STOCK_EDIT,
103
 
                                       _i18n('Edit'), None,
104
 
                                       _i18n('Edit the selected bookmark'),
 
102
                                       _('Edit'), None,
 
103
                                       _('Edit the selected bookmark'),
105
104
                                       self.edit_bookmark),
106
105
                                      ('remove_bookmark', gtk.STOCK_REMOVE,
107
 
                                       _i18n('Remove'), None,
108
 
                                       _i18n('Remove the selected bookmark'),
 
106
                                       _('Remove'), None,
 
107
                                       _('Remove the selected bookmark'),
109
108
                                       self.remove_bookmark),
110
109
                                      ('open_folder', gtk.STOCK_OPEN,
111
 
                                       _i18n('Open Folder'), None,
112
 
                                       _i18n('Open bookmark folder in Nautilus'),
 
110
                                       _('Open Folder'), None,
 
111
                                       _('Open bookmark folder in Nautilus'),
113
112
                                       self.open_folder),
114
113
                                      ('diff_selected', None,
115
 
                                       _i18n('Selected...'), None,
116
 
                                       _i18n('Show the differences of the selected file'),
 
114
                                       _('Selected...'), None,
 
115
                                       _('Show the differences of the selected file'),
117
116
                                       self.diff_selected),
118
117
                                      ('diff_all', None,
119
 
                                       _i18n('All...'), None,
120
 
                                       _i18n('Show the differences of all files'),
 
118
                                       _('All...'), None,
 
119
                                       _('Show the differences of all files'),
121
120
                                       self.diff_all),
122
121
                                      ('view_remote', None,
123
 
                                       _i18n('View contents'), None,
124
 
                                       _i18n('View the contents of the file in a builtin viewer'),
 
122
                                       _('View contents'), None,
 
123
                                       _('View the contents of the file in a builtin viewer'),
125
124
                                       self.view_remote),
126
125
                                      ('diff_remote', None,
127
 
                                       _i18n('Show differences'), None,
128
 
                                       _i18n('Show the differences between two revisions of the file'),
 
126
                                       _('Show differences'), None,
 
127
                                       _('Show the differences between two revisions of the file'),
129
128
                                       self.diff_remote),
130
129
                                      ('revert_remote', None,
131
 
                                       _i18n('Revert to this revision'), None,
132
 
                                       _i18n('Revert the selected file to the selected revision'),
 
130
                                       _('Revert to this revision'), None,
 
131
                                       _('Revert the selected file to the selected revision'),
133
132
                                       self.revert_remote)
134
133
                                     ])
135
134
        
175
174
        filename = self.selected
176
175
            
177
176
        if filename is None:
178
 
            error_dialog(_i18n('No file was selected'),
179
 
                         _i18n('Please select a file from the list,\nor choose the other option.'))
 
177
            error_dialog(_('No file was selected'),
 
178
                         _('Please select a file from the list,\nor choose the other option.'))
180
179
            return
181
180
        
182
 
        wt, path = WorkingTree.open_containing(os.path.join(directory, filename))
183
 
        wt.add([path])
 
181
        bzrlib.add.smart_add([os.path.join(directory, filename)])
184
182
    
185
183
    @show_bzr_error
186
184
    def annotate(self, action):
189
187
        filename = self.selected
190
188
        
191
189
        if filename is None:
192
 
            error_dialog(_i18n('No file was selected'),
193
 
                         _i18n('Please select a file from the list.'))
 
190
            error_dialog(_('No file was selected'),
 
191
                         _('Please select a file from the list.'))
194
192
            return
195
193
        
196
194
        wt, path = WorkingTree.open_containing(os.path.join(directory, filename))
216
214
        filename = self.selected
217
215
        
218
216
        if filename is None:
219
 
            error_dialog(_i18n('No file was selected'),
220
 
                         _i18n('Please select a file from the list,\nor choose the other option.'))
 
217
            error_dialog(_('No file was selected'),
 
218
                         _('Please select a file from the list,\nor choose the other option.'))
221
219
            return
222
220
        
223
221
        wt, path = WorkingTree.open_containing(os.path.join(directory, filename))
226
224
        if delete_on_disk:
227
225
            abs_filename = os.path.join(directory,filename)
228
226
            if os.path.isdir(abs_filename):
229
 
                response = question_dialog(_i18n('Delete directory with all directories below ?'), abs_filename )
 
227
                response = question_dialog(_('Delete directory with all directories below ?'), abs_filename )
230
228
                if response == gtk.RESPONSE_YES:
231
229
                    shutil.rmtree(abs_filename)
232
230
            else:
252
250
        filename = self.selected
253
251
        
254
252
        if filename is None:
255
 
            error_dialog(_i18n('No file was selected'),
256
 
                         _i18n('Please select a file from the list,\nor choose the other option.'))
 
253
            error_dialog(_('No file was selected'),
 
254
                         _('Please select a file from the list,\nor choose the other option.'))
257
255
            return
258
256
 
259
257
        if filename == '..':
273
271
        wt, path = WorkingTree.open_containing(self.path)
274
272
        ret = wt.revert([os.path.join(path, self.selected)])
275
273
        if ret:
276
 
            warning_dialog(_i18n('Conflicts detected'),
277
 
                           _i18n('Please have a look at the working tree before continuing.'))
 
274
            warning_dialog(_('Conflicts detected'),
 
275
                           _('Please have a look at the working tree before continuing.'))
278
276
        else:
279
 
            info_dialog(_i18n('Revert successful'),
280
 
                        _i18n('All files reverted to last revision.'))
 
277
            info_dialog(_('Revert successful'),
 
278
                        _('All files reverted to last revision.'))
281
279
        self.app.refresh_right()       
282
280
    
283
281
    def commit(self, action):
317
315
    def bookmark(self, action):
318
316
        """ Right context menu -> Bookmark """
319
317
        if self.pref.add_bookmark(self.path):
320
 
            info_dialog(_i18n('Bookmark successfully added'),
321
 
                        _i18n('The current directory was bookmarked. You can reach\nit by selecting it from the left panel.'))
 
318
            info_dialog(_('Bookmark successfully added'),
 
319
                        _('The current directory was bookmarked. You can reach\nit by selecting it from the left panel.'))
322
320
            self.pref.write()
323
321
        else:
324
 
            warning_dialog(_i18n('Location already bookmarked'),
325
 
                           _i18n('The current directory is already bookmarked.\nSee the left panel for reference.'))
 
322
            warning_dialog(_('Location already bookmarked'),
 
323
                           _('The current directory is already bookmarked.\nSee the left panel for reference.'))
326
324
        
327
325
        self.app.refresh_left()
328
326