[Pkg-bazaar-commits] ./bzr-gtk/unstable r448: Add bugs tab in branch view.

Jelmer Vernooij jelmer at samba.org
Fri Apr 10 07:44:53 UTC 2009


------------------------------------------------------------
revno: 448
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: trunk
timestamp: Sun 2008-03-09 20:07:11 +0100
message:
  Add bugs tab in branch view.
modified:
  NEWS
  revisionview.py
    ------------------------------------------------------------
    revno: 423.14.1
    committer: Jelmer Vernooij <jelmer at samba.org>
    branch nick: bugstab
    timestamp: Tue 2008-01-22 15:34:10 +0100
    message:
      Add bugs tab to display bug status change metadata.
    modified:
      revisionview.py
    ------------------------------------------------------------
    revno: 423.14.2
    committer: Jelmer Vernooij <jelmer at samba.org>
    branch nick: bugstab
    timestamp: Sun 2008-01-27 01:58:40 +0100
    message:
      Move bugs tab to separate widget.
    modified:
      revisionview.py
    ------------------------------------------------------------
    revno: 423.14.3
    committer: Jelmer Vernooij <jelmer at samba.org>
    branch nick: bugstab
    timestamp: Sun 2008-01-27 02:05:32 +0100
    message:
      Always show bugs tab.
    modified:
      revisionview.py
-------------- next part --------------
=== modified file 'NEWS'
--- a/NEWS	2008-01-27 01:17:31 +0000
+++ b/NEWS	2008-03-09 19:07:11 +0000
@@ -7,6 +7,8 @@
 
   * Made the tag list in the revision view be comma-separated. (Daniel Schierbeck)
 
+  * Add bugs tab in the branch view. (Jelmer Vernooij)
+
  BUG FIXES
 
   * Make adding tags from the viz work again. (Daniel Schierbeck)

=== modified file 'revisionview.py'
--- a/revisionview.py	2008-01-23 16:24:25 +0000
+++ b/revisionview.py	2008-03-09 19:07:11 +0000
@@ -20,10 +20,40 @@
 import gtk
 import pango
 import gobject
+import subprocess
 
 from bzrlib.osutils import format_date
 from bzrlib.util.bencode import bdecode
 
+def _open_link(widget, uri):
+    subprocess.Popen(['sensible-browser', uri], close_fds=True)
+
+gtk.link_button_set_uri_hook(_open_link)
+
+class BugsTab(gtk.Table):
+    def __init__(self):
+        super(BugsTab, self).__init__(rows=5, columns=2)
+        self.set_row_spacings(6)
+        self.set_col_spacings(6)
+        self.clear()
+
+    def clear(self):
+        for c in self.get_children():
+            self.remove(c)
+        self.count = 0
+        self.hide_all() # Only shown when there are bugs
+
+    def add_bug(self, url, status):
+        button = gtk.LinkButton(url, url)
+        self.attach(button, 0, 1, self.count, self.count + 1,
+                              gtk.EXPAND | gtk.FILL, gtk.FILL)
+        status_label = gtk.Label(status)
+        self.attach(status_label, 1, 2, self.count, self.count + 1,
+                              gtk.EXPAND | gtk.FILL, gtk.FILL)
+        self.count += 1
+        self.show_all()
+
+
 class RevisionView(gtk.Notebook):
     """ Custom widget for commit log details.
 
@@ -68,6 +98,7 @@
         self._create_general()
         self._create_relations()
         self._create_file_info_view()
+        self._create_bugs()
 
         self.set_current_page(0)
         
@@ -176,6 +207,13 @@
         else:
             self.file_info_box.hide()
 
+        self.bugs_table.clear()
+        bugs_text = revision.properties.get('bugs', None)
+        if bugs_text:
+            for bugline in bugs_text.splitlines():
+                (url, status) = bugline.split(" ")
+                self.bugs_table.add_bug(url, status)
+
     def update_tags(self):
         if self._branch is not None and self._branch.supports_tags():
             self._tagdict = self._branch.tags.get_reverse_tag_dict()
@@ -429,6 +467,10 @@
         window.show()
         return window
 
+    def _create_bugs(self):
+        self.bugs_table = BugsTab()
+        self.append_page(self.bugs_table, tab_label=gtk.Label('Bugs'))
+
     def _create_file_info_view(self):
         self.file_info_box = gtk.VBox(False, 6)
         self.file_info_box.set_border_width(6)



More information about the Pkg-bazaar-commits mailing list