[Pkg-bazaar-commits] ./bzr-gtk/unstable r124: Implemented annotate functionality (Fixed: #73786).

Szilveszter Farkas (Phanatic) Szilveszter.Farkas at gmail.com
Fri Apr 10 07:45:48 UTC 2009


------------------------------------------------------------
revno: 124
committer: Szilveszter Farkas (Phanatic) <Szilveszter.Farkas at gmail.com>
branch nick: bzr-gtk
timestamp: Mon 2006-12-18 11:34:36 +0100
message:
  Implemented annotate functionality (Fixed: #73786).
modified:
  olive.glade
  olive/__init__.py
-------------- next part --------------
=== modified file 'olive.glade'
--- a/olive.glade	2006-12-10 19:30:04 +0000
+++ b/olive.glade	2006-12-18 10:34:36 +0000
@@ -124,6 +124,15 @@
 		      <signal name="activate" handler="on_menuitem_file_move_activate" last_modification_time="Mon, 17 Jul 2006 08:56:08 GMT"/>
 		    </widget>
 		  </child>
+		  
+		  <child>
+		    <widget class="GtkMenuItem" id="menuitem_file_annotate">
+		      <property name="visible">True</property>
+		      <property name="label" translatable="yes">_Annotate...</property>
+		      <property name="use_underline">True</property>
+		      <signal name="activate" handler="on_menuitem_file_annotate_activate" last_modification_time="Mon, 18 Dec 2006 10:17:00 GMT"/>
+		    </widget>
+		  </child>
 
 		  <child>
 		    <widget class="GtkSeparatorMenuItem" id="separator_file2">

=== modified file 'olive/__init__.py'
--- a/olive/__init__.py	2006-12-18 10:06:32 +0000
+++ b/olive/__init__.py	2006-12-18 10:34:36 +0000
@@ -45,6 +45,8 @@
 try:
     from bzrlib.plugins.gtk.viz.diffwin import DiffWindow
     from bzrlib.plugins.gtk.viz.branchwin import BranchWindow
+    from bzrlib.plugins.gtk.annotate.gannotate import GAnnotateWindow
+    from bzrlib.plugins.gtk.annotate.config import GAnnotateConfig
 except ImportError:
     # olive+bzr-gtk not installed. try to import from sources
     path = os.path.dirname(os.path.dirname(__file__))
@@ -52,6 +54,8 @@
         sys.path.append(path)
     from viz.diffwin import DiffWindow
     from viz.branchwin import BranchWindow
+    from annotate.gannotate import GAnnotateWindow
+    from annotate.config import GAnnotateConfig
 
 
 class OliveGtk:
@@ -84,6 +88,7 @@
         self.menuitem_file_make_directory = self.toplevel.get_widget('menuitem_file_make_directory')
         self.menuitem_file_rename = self.toplevel.get_widget('menuitem_file_rename')
         self.menuitem_file_move = self.toplevel.get_widget('menuitem_file_move')
+        self.menuitem_file_annotate = self.toplevel.get_widget('menuitem_file_annotate')
         self.menuitem_view_show_hidden_files = self.toplevel.get_widget('menuitem_view_show_hidden_files')
         self.menuitem_branch = self.toplevel.get_widget('menuitem_branch')
         self.menuitem_branch_init = self.toplevel.get_widget('menuitem_branch_initialize')
@@ -122,6 +127,7 @@
                 "on_menuitem_file_make_directory_activate": self.on_menuitem_file_make_directory_activate,
                 "on_menuitem_file_move_activate": self.on_menuitem_file_move_activate,
                 "on_menuitem_file_rename_activate": self.on_menuitem_file_rename_activate,
+                "on_menuitem_file_annotate_activate": self.on_menuitem_file_annotate_activate,
                 "on_menuitem_view_show_hidden_files_activate": self.on_menuitem_view_show_hidden_files_activate,
                 "on_menuitem_view_refresh_activate": self.on_menuitem_view_refresh_activate,
                 "on_menuitem_branch_initialize_activate": self.on_menuitem_branch_initialize_activate,
@@ -333,6 +339,27 @@
                         _('Directory successfully initialized.'))
             self.refresh_right()
         
+    def on_menuitem_file_annotate_activate(self, widget):
+        """ File/Annotate... menu handler. """
+        if self.get_selected_right() is None:
+            error_dialog(_('No file was selected'),
+                         _('Please select a file from the list.'))
+            return
+        
+        branch = self.wt.branch
+        file_id = self.wt.path2id(self.wt.relpath(os.path.join(self.path, self.get_selected_right())))
+        revision_id = None
+        
+        window = GAnnotateWindow(all=False, plain=False)
+        window.set_title(os.path.join(self.path, self.get_selected_right()) + " - Annotate")
+        config = GAnnotateConfig(window)
+        window.show()
+        branch.lock_read()
+        try:
+            window.annotate(branch, file_id, revision_id)
+        finally:
+            branch.unlock()
+    
     def on_menuitem_file_make_directory_activate(self, widget):
         """ File/Make directory... menu handler. """
         from mkdir import OliveMkdir
@@ -685,6 +712,7 @@
         self.menuitem_file_make_directory.set_sensitive(not self.notbranch)
         self.menuitem_file_rename.set_sensitive(not self.notbranch)
         self.menuitem_file_move.set_sensitive(not self.notbranch)
+        self.menuitem_file_annotate.set_sensitive(not self.notbranch)
         #self.menutoolbutton_diff.set_sensitive(True)
         self.toolbutton_diff.set_sensitive(not self.notbranch)
         self.toolbutton_log.set_sensitive(not self.notbranch)



More information about the Pkg-bazaar-commits mailing list