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

  • Committer: Szilveszter Farkas (Phanatic)
  • Date: 2006-12-18 10:34:36 UTC
  • Revision ID: szilveszter.farkas@gmail.com-20061218103436-4j6mi3x9m9o5273q
Implemented annotate functionality (Fixed: #73786).

Show diffs side-by-side

added added

removed removed

Lines of Context:
45
45
try:
46
46
    from bzrlib.plugins.gtk.viz.diffwin import DiffWindow
47
47
    from bzrlib.plugins.gtk.viz.branchwin import BranchWindow
 
48
    from bzrlib.plugins.gtk.annotate.gannotate import GAnnotateWindow
 
49
    from bzrlib.plugins.gtk.annotate.config import GAnnotateConfig
48
50
except ImportError:
49
51
    # olive+bzr-gtk not installed. try to import from sources
50
52
    path = os.path.dirname(os.path.dirname(__file__))
52
54
        sys.path.append(path)
53
55
    from viz.diffwin import DiffWindow
54
56
    from viz.branchwin import BranchWindow
 
57
    from annotate.gannotate import GAnnotateWindow
 
58
    from annotate.config import GAnnotateConfig
55
59
 
56
60
 
57
61
class OliveGtk:
84
88
        self.menuitem_file_make_directory = self.toplevel.get_widget('menuitem_file_make_directory')
85
89
        self.menuitem_file_rename = self.toplevel.get_widget('menuitem_file_rename')
86
90
        self.menuitem_file_move = self.toplevel.get_widget('menuitem_file_move')
 
91
        self.menuitem_file_annotate = self.toplevel.get_widget('menuitem_file_annotate')
87
92
        self.menuitem_view_show_hidden_files = self.toplevel.get_widget('menuitem_view_show_hidden_files')
88
93
        self.menuitem_branch = self.toplevel.get_widget('menuitem_branch')
89
94
        self.menuitem_branch_init = self.toplevel.get_widget('menuitem_branch_initialize')
122
127
                "on_menuitem_file_make_directory_activate": self.on_menuitem_file_make_directory_activate,
123
128
                "on_menuitem_file_move_activate": self.on_menuitem_file_move_activate,
124
129
                "on_menuitem_file_rename_activate": self.on_menuitem_file_rename_activate,
 
130
                "on_menuitem_file_annotate_activate": self.on_menuitem_file_annotate_activate,
125
131
                "on_menuitem_view_show_hidden_files_activate": self.on_menuitem_view_show_hidden_files_activate,
126
132
                "on_menuitem_view_refresh_activate": self.on_menuitem_view_refresh_activate,
127
133
                "on_menuitem_branch_initialize_activate": self.on_menuitem_branch_initialize_activate,
333
339
                        _('Directory successfully initialized.'))
334
340
            self.refresh_right()
335
341
        
 
342
    def on_menuitem_file_annotate_activate(self, widget):
 
343
        """ File/Annotate... menu handler. """
 
344
        if self.get_selected_right() is None:
 
345
            error_dialog(_('No file was selected'),
 
346
                         _('Please select a file from the list.'))
 
347
            return
 
348
        
 
349
        branch = self.wt.branch
 
350
        file_id = self.wt.path2id(self.wt.relpath(os.path.join(self.path, self.get_selected_right())))
 
351
        revision_id = None
 
352
        
 
353
        window = GAnnotateWindow(all=False, plain=False)
 
354
        window.set_title(os.path.join(self.path, self.get_selected_right()) + " - Annotate")
 
355
        config = GAnnotateConfig(window)
 
356
        window.show()
 
357
        branch.lock_read()
 
358
        try:
 
359
            window.annotate(branch, file_id, revision_id)
 
360
        finally:
 
361
            branch.unlock()
 
362
    
336
363
    def on_menuitem_file_make_directory_activate(self, widget):
337
364
        """ File/Make directory... menu handler. """
338
365
        from mkdir import OliveMkdir
685
712
        self.menuitem_file_make_directory.set_sensitive(not self.notbranch)
686
713
        self.menuitem_file_rename.set_sensitive(not self.notbranch)
687
714
        self.menuitem_file_move.set_sensitive(not self.notbranch)
 
715
        self.menuitem_file_annotate.set_sensitive(not self.notbranch)
688
716
        #self.menutoolbutton_diff.set_sensitive(True)
689
717
        self.toolbutton_diff.set_sensitive(not self.notbranch)
690
718
        self.toolbutton_log.set_sensitive(not self.notbranch)