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

  • Committer: Jelmer Vernooij
  • Date: 2008-01-22 14:34:10 UTC
  • mto: This revision was merged to the branch mainline in revision 448.
  • Revision ID: jelmer@samba.org-20080122143410-w3nr2uuml1filn78
Add bugs tab to display bug status change metadata.

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
import gtk
21
21
import pango
22
22
import gobject
 
23
import subprocess
23
24
 
24
25
from bzrlib.osutils import format_date
25
26
from bzrlib.util.bencode import bdecode
68
69
        self._create_general()
69
70
        self._create_relations()
70
71
        self._create_file_info_view()
 
72
        self._create_bugs()
71
73
 
72
74
        self.set_current_page(0)
73
75
        
126
128
    def get_revision(self):
127
129
        return self.get_property('revision')
128
130
 
 
131
    def _open_link(self, widget, uri):
 
132
        subprocess.Popen(['sensible-browser', uri], close_fds=True)
 
133
 
129
134
    def _set_revision(self, revision):
130
135
        if revision is None: return
131
136
 
179
184
        else:
180
185
            self.file_info_box.hide()
181
186
 
 
187
        bugs_text = revision.properties.get('bugs', None)
 
188
        if bugs_text:
 
189
            for c in self.bugs_table.get_children():
 
190
                self.bugs_table.remove(c)
 
191
            idx = 0
 
192
            for bugline in bugs_text.splitlines():
 
193
                (url, status) = bugline.split(" ")
 
194
                button = gtk.LinkButton(url, url)
 
195
                gtk.link_button_set_uri_hook(self._open_link)
 
196
                self.bugs_table.attach(button, 0, 1, idx, idx + 1,
 
197
                                      gtk.EXPAND | gtk.FILL, gtk.FILL)
 
198
                status_label = gtk.Label(status)
 
199
                self.bugs_table.attach(status_label, 1, 2, idx, idx + 1,
 
200
                                      gtk.EXPAND | gtk.FILL, gtk.FILL)
 
201
                idx += 1
 
202
            self.bugs_table.show_all()
 
203
        else:
 
204
            self.bugs_table.hide()
 
205
 
182
206
    def set_children(self, children):
183
207
        self._add_parents_or_children(children,
184
208
                                      self.children_widgets,
431
455
        window.show()
432
456
        return window
433
457
 
 
458
    def _create_bugs(self):
 
459
        self.bugs_table = gtk.Table(rows=5, columns=2)
 
460
        self.bugs_table.set_row_spacings(6)
 
461
        self.bugs_table.set_col_spacings(6)
 
462
        self.bugs_table.hide() # Only shown when there are bugs
 
463
        self.append_page(self.bugs_table, tab_label=gtk.Label('Bugs'))
 
464
 
434
465
    def _create_file_info_view(self):
435
466
        self.file_info_box = gtk.VBox(False, 6)
436
467
        self.file_info_box.set_border_width(6)