/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: Javier Derderian
  • Date: 2008-04-11 20:34:06 UTC
  • mto: (465.1.1 gtk.patch)
  • mto: This revision was merged to the branch mainline in revision 466.
  • Revision ID: javierder@gmail.com-20080411203406-ftlwyodw9vr87olv
Updated "Compare with..." (#78765) to use revbrowser.RevisionBrowser.
Also needed to fix #215872 to make it work.

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
181
        bzrlib.add.smart_add([os.path.join(directory, filename)])
188
187
        filename = self.selected
189
188
        
190
189
        if filename is None:
191
 
            error_dialog(_i18n('No file was selected'),
192
 
                         _i18n('Please select a file from the list.'))
 
190
            error_dialog(_('No file was selected'),
 
191
                         _('Please select a file from the list.'))
193
192
            return
194
193
        
195
194
        wt, path = WorkingTree.open_containing(os.path.join(directory, filename))
215
214
        filename = self.selected
216
215
        
217
216
        if filename is None:
218
 
            error_dialog(_i18n('No file was selected'),
219
 
                         _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.'))
220
219
            return
221
220
        
222
221
        wt, path = WorkingTree.open_containing(os.path.join(directory, filename))
225
224
        if delete_on_disk:
226
225
            abs_filename = os.path.join(directory,filename)
227
226
            if os.path.isdir(abs_filename):
228
 
                response = question_dialog(_i18n('Delete directory with all directories below ?'), abs_filename )
 
227
                response = question_dialog(_('Delete directory with all directories below ?'), abs_filename )
229
228
                if response == gtk.RESPONSE_YES:
230
229
                    shutil.rmtree(abs_filename)
231
230
            else:
251
250
        filename = self.selected
252
251
        
253
252
        if filename is None:
254
 
            error_dialog(_i18n('No file was selected'),
255
 
                         _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.'))
256
255
            return
257
256
 
258
257
        if filename == '..':
272
271
        wt, path = WorkingTree.open_containing(self.path)
273
272
        ret = wt.revert([os.path.join(path, self.selected)])
274
273
        if ret:
275
 
            warning_dialog(_i18n('Conflicts detected'),
276
 
                           _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.'))
277
276
        else:
278
 
            info_dialog(_i18n('Revert successful'),
279
 
                        _i18n('All files reverted to last revision.'))
 
277
            info_dialog(_('Revert successful'),
 
278
                        _('All files reverted to last revision.'))
280
279
        self.app.refresh_right()       
281
280
    
282
281
    def commit(self, action):
316
315
    def bookmark(self, action):
317
316
        """ Right context menu -> Bookmark """
318
317
        if self.pref.add_bookmark(self.path):
319
 
            info_dialog(_i18n('Bookmark successfully added'),
320
 
                        _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.'))
321
320
            self.pref.write()
322
321
        else:
323
 
            warning_dialog(_i18n('Location already bookmarked'),
324
 
                           _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.'))
325
324
        
326
325
        self.app.refresh_left()
327
326