/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: Szilveszter Farkas (Phanatic)
  • Date: 2007-05-14 10:54:40 UTC
  • mto: (195.1.4 trunk)
  • mto: This revision was merged to the branch mainline in revision 199.
  • Revision ID: szilveszter.farkas@gmail.com-20070514105440-e5fhlftlp3r0bgmr
Fixed Branch -> Status in Olive (no more traceback).

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
 
31
31
from bzrlib.plugins.gtk.dialog import error_dialog, info_dialog, warning_dialog
32
32
from bzrlib.plugins.gtk.errors import show_bzr_error
33
 
from bzrlib.plugins.gtk.annotate.gannotate import GAnnotateWindow
34
 
from bzrlib.plugins.gtk.annotate.config import GAnnotateConfig
35
 
from bzrlib.plugins.gtk.diff import DiffWindow
36
33
from launch import launch
37
 
from olive import Preferences
 
34
from olive import Preferences, DiffWindow
38
35
 
39
36
class OliveMenu:
40
37
    """ This class is responsible for building the context menus. """
80
77
                                       _('Commit'), None,
81
78
                                       _('Commit the changes'),
82
79
                                       self.commit),
83
 
                                      ('annotate', None,
84
 
                                       _('Annotate'), None,
85
 
                                       _('Annotate the selected file'),
86
 
                                       self.annotate),
87
80
                                      ('diff', None,
88
81
                                       _('Diff'), None,
89
82
                                       _('Show the diff of the file'),
111
104
                                      ('diff_all', None,
112
105
                                       _('All...'), None,
113
106
                                       _('Show the differences of all files'),
114
 
                                       self.diff_all),
115
 
                                      ('view_remote', None,
116
 
                                       _('View contents'), None,
117
 
                                       _('View the contents of the file in a builtin viewer'),
118
 
                                       self.view_remote),
119
 
                                      ('diff_remote', None,
120
 
                                       _('Show differences'), None,
121
 
                                       _('Show the differences between two revisions of the file'),
122
 
                                       self.diff_remote),
123
 
                                      ('revert_remote', None,
124
 
                                       _('Revert to this revision'), None,
125
 
                                       _('Revert the selected file to the selected revision'),
126
 
                                       self.revert_remote)
 
107
                                       self.diff_all)
127
108
                                     ])
128
109
        
129
110
        self.ui.insert_action_group(self.actiongroup, 0)
132
113
        self.cmenu_right = self.ui.get_widget('/context_right')
133
114
        self.cmenu_left = self.ui.get_widget('/context_left')
134
115
        self.toolbar_diff = self.ui.get_widget('/toolbar_diff')
135
 
        self.cmenu_remote = self.ui.get_widget('/context_remote')
136
116
        
137
117
        # Set icons
138
118
        # TODO: do it without using deprecated comm
155
135
    def left_context_menu(self):
156
136
        return self.cmenu_left
157
137
    
158
 
    def remote_context_menu(self):
159
 
        return self.cmenu_remote
160
 
    
161
138
    @show_bzr_error
162
139
    def add_file(self, action):
163
140
        """ Right context menu -> Add """
175
152
        bzrlib.add.smart_add([os.path.join(directory, filename)])
176
153
    
177
154
    @show_bzr_error
178
 
    def annotate(self, action):
179
 
        """ Right context menu -> Annotate """
180
 
        directory = self.path
181
 
        filename = self.selected
182
 
        
183
 
        if filename is None:
184
 
            error_dialog(_('No file was selected'),
185
 
                         _('Please select a file from the list.'))
186
 
            return
187
 
        
188
 
        wt, path = WorkingTree.open_containing(os.path.join(directory, filename))
189
 
        
190
 
        branch = wt.branch
191
 
        file_id = wt.path2id(wt.relpath(os.path.join(directory, filename)))
192
 
        
193
 
        window = GAnnotateWindow(all=False, plain=False)
194
 
        window.set_title(os.path.join(directory, filename) + " - Annotate")
195
 
        config = GAnnotateConfig(window)
196
 
        window.show()
197
 
        branch.lock_read()
198
 
        try:
199
 
            window.annotate(wt, branch, file_id)
200
 
        finally:
201
 
            branch.unlock()
202
 
    
203
 
    @show_bzr_error
204
155
    def remove_file(self, action):
205
156
        """ Right context menu -> Remove """
206
157
        # Remove only the selected file
341
292
        from diff import OliveDiff
342
293
        diff = OliveDiff(self.comm)
343
294
        diff.display()
344
 
    
345
 
    def view_remote(self, action):
346
 
        """ Remote context menu -> View contents """
347
 
        print "DEBUG: view contents."
348
 
    
349
 
    def diff_remote(self, action):
350
 
        """ Remote context menu -> Show differences """
351
 
        print "DEBUG: show differences."
352
 
    
353
 
    def revert_remote(self, action):
354
 
        """ Remote context menu -> Revert to this revision """
355
 
        print "DEBUG: revert to this revision."