/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 17:20:33 UTC
  • mto: (195.1.5 trunk)
  • mto: This revision was merged to the branch mainline in revision 199.
  • Revision ID: szilveszter.farkas@gmail.com-20070514172033-z0yhlsjo8uwmpscy
Added Annotate to the right context menu + fixed Diff in that menu.

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
33
36
from launch import launch
34
 
from olive import Preferences, DiffWindow
 
37
from olive import Preferences
35
38
 
36
39
class OliveMenu:
37
40
    """ This class is responsible for building the context menus. """
77
80
                                       _('Commit'), None,
78
81
                                       _('Commit the changes'),
79
82
                                       self.commit),
 
83
                                      ('annotate', None,
 
84
                                       _('Annotate'), None,
 
85
                                       _('Annotate the selected file'),
 
86
                                       self.annotate),
80
87
                                      ('diff', None,
81
88
                                       _('Diff'), None,
82
89
                                       _('Show the diff of the file'),
152
159
        bzrlib.add.smart_add([os.path.join(directory, filename)])
153
160
    
154
161
    @show_bzr_error
 
162
    def annotate(self, action):
 
163
        """ Right context menu -> Annotate """
 
164
        directory = self.path
 
165
        filename = self.selected
 
166
        
 
167
        if filename is None:
 
168
            error_dialog(_('No file was selected'),
 
169
                         _('Please select a file from the list.'))
 
170
            return
 
171
        
 
172
        wt, path = WorkingTree.open_containing(os.path.join(directory, filename))
 
173
        
 
174
        branch = wt.branch
 
175
        file_id = wt.path2id(wt.relpath(os.path.join(directory, filename)))
 
176
        
 
177
        window = GAnnotateWindow(all=False, plain=False)
 
178
        window.set_title(os.path.join(directory, filename) + " - Annotate")
 
179
        config = GAnnotateConfig(window)
 
180
        window.show()
 
181
        branch.lock_read()
 
182
        try:
 
183
            window.annotate(wt, branch, file_id)
 
184
        finally:
 
185
            branch.unlock()
 
186
    
 
187
    @show_bzr_error
155
188
    def remove_file(self, action):
156
189
        """ Right context menu -> Remove """
157
190
        # Remove only the selected file