Rev 241: Show tags in bzr viz. in file:///data/jelmer/bzr-gtk/trunk/

Jelmer Vernooij jelmer at samba.org
Thu Jul 19 15:11:55 BST 2007


At file:///data/jelmer/bzr-gtk/trunk/

------------------------------------------------------------
revno: 241
revision-id: jelmer at samba.org-20070719141155-c51ze4udyrz1224v
parent: jelmer at samba.org-20070719131631-2ods52j02o0ni2ir
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: trunk
timestamp: Thu 2007-07-19 16:11:55 +0200
message:
  Show tags in bzr viz.
modified:
  NEWS                           news-20070325173539-3va57o99cz3o57xe-1
  logview.py                     logview.py-20051024072750-4d5c28cb73611027
  viz/branchwin.py               branchwin.py-20051016222514-15fd120652fcf25c
=== modified file 'NEWS'
--- a/NEWS	2007-07-17 02:55:14 +0000
+++ b/NEWS	2007-07-19 14:11:55 +0000
@@ -1,5 +1,13 @@
 0.19.0	UNRELEASED
 
+ FEATURES
+
+  * Show tags in bzr viz. (Jelmer)
+
+ UI
+  
+  * Improve Preferences dialog layout. (Jelmer)
+
 0.18.0  2007-07-17
 
  FEATURES

=== modified file 'logview.py'
--- a/logview.py	2007-05-19 09:58:19 +0000
+++ b/logview.py	2007-07-19 14:11:55 +0000
@@ -30,7 +30,7 @@
     start.
     """
 
-    def __init__(self, revision=None, scroll=True):
+    def __init__(self, revision=None, scroll=True, tags=None):
         super(LogView, self).__init__()
         if scroll:
             self.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)
@@ -43,7 +43,7 @@
         self._clicked_callback = None
 
         if revision is not None:
-            self.set_revision(revision)
+            self.set_revision(revision, tags=tags)
 
     def set_show_callback(self, callback):
         self._show_callback = callback
@@ -51,7 +51,7 @@
     def set_go_callback(self, callback):
         self._go_callback = callback
 
-    def set_revision(self, revision):
+    def set_revision(self, revision, tags=None):
         self._revision = revision
         self.revision_id.set_text(revision.revision_id)
         if revision.committer is not None:
@@ -68,6 +68,7 @@
             self.branchnick_label.set_text("")
 
         self._add_parents(revision.parent_ids)
+        self._add_tags(tags)
 
     def _show_clicked_cb(self, widget, revid, parentid):
         """Callback for when the show button for a parent is clicked."""
@@ -77,6 +78,24 @@
         """Callback for when the go button for a parent is clicked."""
         self._go_callback(revid)
 
+    def _add_tags(self, tags):
+        if tags == []:
+            self.tags_list.hide()
+            self.tags_label.hide()
+            return
+
+        for widget in self.tags_widgets:
+            self.tags_list.remove(widget)
+
+        for tag in tags:
+            widget = gtk.Label(tag)
+            widget.set_selectable(True)
+            self.tags_widgets.append(widget)
+            self.tags_list.add(widget)
+        self.tags_list.show_all()
+        self.tags_label.show_all()
+        
+
     def _add_parents(self, parent_ids):
         for widget in self.parents_widgets:
             self.parents_table.remove(widget)
@@ -127,7 +146,7 @@
         vbox.show()
 
     def _create_headers(self):
-        self.table = gtk.Table(rows=4, columns=2)
+        self.table = gtk.Table(rows=5, columns=2)
         self.table.set_row_spacings(6)
         self.table.set_col_spacings(6)
         self.table.show()
@@ -196,6 +215,22 @@
         align.show()
         self.timestamp.show()
 
+        align = gtk.Alignment(1.0, 0.5)
+        self.tags_label = gtk.Label()
+        self.tags_label.set_markup("<b>Tags:</b>")
+        align.add(self.tags_label)
+        align.show()
+        self.table.attach(align, 0, 1, 4, 5, gtk.FILL, gtk.FILL)
+        self.tags_label.show()
+
+        align = gtk.Alignment(0.0, 0.5)
+        self.tags_list = gtk.VBox()
+        align.add(self.tags_list)
+        self.table.attach(align, 1, 2, 4, 5, gtk.EXPAND | gtk.FILL, gtk.FILL)
+        align.show()
+        self.tags_list.show()
+        self.tags_widgets = []
+
         return self.table
 
     def _create_parents_table(self):

=== modified file 'viz/branchwin.py'
--- a/viz/branchwin.py	2007-07-15 16:39:21 +0000
+++ b/viz/branchwin.py	2007-07-19 14:11:55 +0000
@@ -204,7 +204,12 @@
 
         self.back_button.set_sensitive(len(self.parent_ids[revision]) > 0)
         self.fwd_button.set_sensitive(len(self.children[revision]) > 0)
-        self.logview.set_revision(revision)
+        tags = []
+        if self.branch.supports_tags():
+            tagdict = self.branch.tags.get_reverse_tag_dict()
+            if tagdict.has_key(revision.revision_id):
+                tags = tagdict[revision.revision_id]
+        self.logview.set_revision(revision, tags)
 
     def _back_clicked_cb(self, *args):
         """Callback for when the back button is clicked."""




More information about the bazaar-commits mailing list