/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: 2011-03-23 09:49:44 UTC
  • mfrom: (723.1.1 isearch)
  • Revision ID: jelmer@samba.org-20110323094944-7n5h1vif3xpbze3p
Merge support for interactive substring search in bzr viz and annotate.

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
# along with this program; if not, write to the Free Software
16
16
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17
17
 
18
 
from gi.repository import Gtk
19
 
from gi.repository import Pango
20
 
from gi.repository import GObject
 
18
import pygtk
 
19
pygtk.require("2.0")
 
20
import gtk
 
21
import pango
 
22
import gobject
21
23
import webbrowser
22
24
 
23
25
from bzrlib import trace
52
54
    webbrowser.open(uri)
53
55
 
54
56
if getattr(gtk, 'link_button_set_uri_hook', None) is not None:
55
 
    Gtk.link_button_set_uri_hook(_open_link)
 
57
    # Not available before PyGtk-2.10
 
58
    gtk.link_button_set_uri_hook(_open_link)
56
59
 
57
 
class BugsTab(Gtk.VBox):
 
60
class BugsTab(gtk.VBox):
58
61
 
59
62
    def __init__(self):
60
63
        super(BugsTab, self).__init__(False, 6)
61
64
 
62
 
        table = Gtk.Table(rows=2, columns=2)
 
65
        table = gtk.Table(rows=2, columns=2)
63
66
 
64
67
        table.set_row_spacings(6)
65
68
        table.set_col_spacing(0, 16)
66
69
 
67
 
        image = Gtk.Image()
 
70
        image = gtk.Image()
68
71
        image.set_from_file(icon_path("bug.png"))
69
 
        table.attach(image, 0, 1, 0, 1, Gtk.AttachOptions.FILL)
 
72
        table.attach(image, 0, 1, 0, 1, gtk.FILL)
70
73
 
71
 
        align = Gtk.Alignment.new(0.0, 0.1)
72
 
        self.label = Gtk.Label()
 
74
        align = gtk.Alignment(0.0, 0.1)
 
75
        self.label = gtk.Label()
73
76
        align.add(self.label)
74
 
        table.attach(align, 1, 2, 0, 1, Gtk.AttachOptions.FILL)
 
77
        table.attach(align, 1, 2, 0, 1, gtk.FILL)
75
78
 
76
79
        treeview = self.construct_treeview()
77
 
        table.attach(treeview, 1, 2, 1, 2, Gtk.AttachOptions.FILL | Gtk.AttachOptions.EXPAND)
 
80
        table.attach(treeview, 1, 2, 1, 2, gtk.FILL | gtk.EXPAND)
78
81
 
79
82
        self.set_border_width(6)
80
 
        self.pack_start(table, False, True, 0)
 
83
        self.pack_start(table, expand=False)
81
84
 
82
85
        self.clear()
83
86
        self.show_all()
105
108
                              "%d %s." % (self.num_bugs, label))
106
109
 
107
110
    def construct_treeview(self):
108
 
        self.bugs = Gtk.ListStore(GObject.TYPE_STRING, GObject.TYPE_STRING)
109
 
        self.treeview = Gtk.TreeView(self.bugs)
 
111
        self.bugs = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_STRING)
 
112
        self.treeview = gtk.TreeView(self.bugs)
110
113
        self.treeview.set_headers_visible(False)
111
114
 
112
 
        uri_column = Gtk.TreeViewColumn('Bug URI', Gtk.CellRendererText(), text=0)
 
115
        uri_column = gtk.TreeViewColumn('Bug URI', gtk.CellRendererText(), text=0)
113
116
        self.treeview.append_column(uri_column)
114
117
 
115
118
        self.treeview.connect('row-activated', self.on_row_activated)
116
119
 
117
 
        win = Gtk.ScrolledWindow()
118
 
        win.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
119
 
        win.set_shadow_type(Gtk.ShadowType.IN)
 
120
        win = gtk.ScrolledWindow()
 
121
        win.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
 
122
        win.set_shadow_type(gtk.SHADOW_IN)
120
123
        win.add(self.treeview)
121
124
 
122
125
        return win
141
144
        _open_link(self, uri)
142
145
 
143
146
 
144
 
class SignatureTab(Gtk.VBox):
 
147
class SignatureTab(gtk.VBox):
145
148
 
146
149
    def __init__(self, repository):
147
150
        self.key = None
149
152
        self.repository = repository
150
153
 
151
154
        super(SignatureTab, self).__init__(False, 6)
152
 
        signature_box = Gtk.Table(rows=3, columns=3)
 
155
        signature_box = gtk.Table(rows=3, columns=3)
153
156
        signature_box.set_col_spacing(0, 16)
154
157
        signature_box.set_col_spacing(1, 12)
155
158
        signature_box.set_row_spacings(6)
156
159
 
157
 
        self.signature_image = Gtk.Image()
158
 
        signature_box.attach(self.signature_image, 0, 1, 0, 1, Gtk.AttachOptions.FILL)
 
160
        self.signature_image = gtk.Image()
 
161
        signature_box.attach(self.signature_image, 0, 1, 0, 1, gtk.FILL)
159
162
 
160
 
        align = Gtk.Alignment.new(0.0, 0.1)
161
 
        self.signature_label = Gtk.Label()
 
163
        align = gtk.Alignment(0.0, 0.1)
 
164
        self.signature_label = gtk.Label()
162
165
        align.add(self.signature_label)
163
 
        signature_box.attach(align, 1, 3, 0, 1, Gtk.AttachOptions.FILL)
 
166
        signature_box.attach(align, 1, 3, 0, 1, gtk.FILL)
164
167
 
165
 
        align = Gtk.Alignment.new(0.0, 0.5)
166
 
        self.signature_key_id_label = Gtk.Label()
 
168
        align = gtk.Alignment(0.0, 0.5)
 
169
        self.signature_key_id_label = gtk.Label()
167
170
        self.signature_key_id_label.set_markup("<b>Key Id:</b>")
168
171
        align.add(self.signature_key_id_label)
169
 
        signature_box.attach(align, 1, 2, 1, 2, Gtk.AttachOptions.FILL, Gtk.AttachOptions.FILL)
 
172
        signature_box.attach(align, 1, 2, 1, 2, gtk.FILL, gtk.FILL)
170
173
 
171
 
        align = Gtk.Alignment.new(0.0, 0.5)
172
 
        self.signature_key_id = Gtk.Label()
 
174
        align = gtk.Alignment(0.0, 0.5)
 
175
        self.signature_key_id = gtk.Label()
173
176
        self.signature_key_id.set_selectable(True)
174
177
        align.add(self.signature_key_id)
175
 
        signature_box.attach(align, 2, 3, 1, 2, Gtk.AttachOptions.EXPAND | Gtk.AttachOptions.FILL, Gtk.AttachOptions.FILL)
 
178
        signature_box.attach(align, 2, 3, 1, 2, gtk.EXPAND | gtk.FILL, gtk.FILL)
176
179
 
177
 
        align = Gtk.Alignment.new(0.0, 0.5)
178
 
        self.signature_fingerprint_label = Gtk.Label()
 
180
        align = gtk.Alignment(0.0, 0.5)
 
181
        self.signature_fingerprint_label = gtk.Label()
179
182
        self.signature_fingerprint_label.set_markup("<b>Fingerprint:</b>")
180
183
        align.add(self.signature_fingerprint_label)
181
 
        signature_box.attach(align, 1, 2, 2, 3, Gtk.AttachOptions.FILL, Gtk.AttachOptions.FILL)
 
184
        signature_box.attach(align, 1, 2, 2, 3, gtk.FILL, gtk.FILL)
182
185
 
183
 
        align = Gtk.Alignment.new(0.0, 0.5)
184
 
        self.signature_fingerprint = Gtk.Label()
 
186
        align = gtk.Alignment(0.0, 0.5)
 
187
        self.signature_fingerprint = gtk.Label()
185
188
        self.signature_fingerprint.set_selectable(True)
186
189
        align.add(self.signature_fingerprint)
187
 
        signature_box.attach(align, 2, 3, 2, 3, Gtk.AttachOptions.EXPAND | Gtk.AttachOptions.FILL, Gtk.AttachOptions.FILL)
 
190
        signature_box.attach(align, 2, 3, 2, 3, gtk.EXPAND | gtk.FILL, gtk.FILL)
188
191
 
189
 
        align = Gtk.Alignment.new(0.0, 0.5)
190
 
        self.signature_trust_label = Gtk.Label()
 
192
        align = gtk.Alignment(0.0, 0.5)
 
193
        self.signature_trust_label = gtk.Label()
191
194
        self.signature_trust_label.set_markup("<b>Trust:</b>")
192
195
        align.add(self.signature_trust_label)
193
 
        signature_box.attach(align, 1, 2, 3, 4, Gtk.AttachOptions.FILL, Gtk.AttachOptions.FILL)
 
196
        signature_box.attach(align, 1, 2, 3, 4, gtk.FILL, gtk.FILL)
194
197
 
195
 
        align = Gtk.Alignment.new(0.0, 0.5)
196
 
        self.signature_trust = Gtk.Label()
 
198
        align = gtk.Alignment(0.0, 0.5)
 
199
        self.signature_trust = gtk.Label()
197
200
        self.signature_trust.set_selectable(True)
198
201
        align.add(self.signature_trust)
199
 
        signature_box.attach(align, 2, 3, 3, 4, Gtk.AttachOptions.EXPAND | Gtk.AttachOptions.FILL, Gtk.AttachOptions.FILL)
 
202
        signature_box.attach(align, 2, 3, 3, 4, gtk.EXPAND | gtk.FILL, gtk.FILL)
200
203
 
201
204
        self.set_border_width(6)
202
 
        self.pack_start(signature_box, False, True, 0)
 
205
        self.pack_start(signature_box, expand=False)
203
206
        self.show_all()
204
207
 
205
208
    def set_revision(self, revision):
289
292
        self.signature_trust.set_text('This key is ' + trust_text)
290
293
 
291
294
 
292
 
class RevisionView(Gtk.Notebook):
 
295
class RevisionView(gtk.Notebook):
293
296
    """ Custom widget for commit log details.
294
297
 
295
298
    A variety of bzr tools may need to implement such a thing. This is a
298
301
 
299
302
    __gproperties__ = {
300
303
        'branch': (
301
 
            GObject.TYPE_PYOBJECT,
 
304
            gobject.TYPE_PYOBJECT,
302
305
            'Branch',
303
306
            'The branch holding the revision being displayed',
304
 
            GObject.PARAM_CONSTRUCT_ONLY | GObject.PARAM_WRITABLE
 
307
            gobject.PARAM_CONSTRUCT_ONLY | gobject.PARAM_WRITABLE
305
308
        ),
306
309
 
307
310
        'revision': (
308
 
            GObject.TYPE_PYOBJECT,
 
311
            gobject.TYPE_PYOBJECT,
309
312
            'Revision',
310
313
            'The revision being displayed',
311
 
            GObject.PARAM_READWRITE
 
314
            gobject.PARAM_READWRITE
312
315
        ),
313
316
 
314
317
        'children': (
315
 
            GObject.TYPE_PYOBJECT,
 
318
            gobject.TYPE_PYOBJECT,
316
319
            'Children',
317
320
            'Child revisions',
318
 
            GObject.PARAM_READWRITE
 
321
            gobject.PARAM_READWRITE
319
322
        ),
320
323
 
321
324
        'file-id': (
322
 
            GObject.TYPE_PYOBJECT,
 
325
            gobject.TYPE_PYOBJECT,
323
326
            'File Id',
324
327
            'The file id',
325
 
            GObject.PARAM_READWRITE
 
328
            gobject.PARAM_READWRITE
326
329
        )
327
330
    }
328
331
 
329
332
    def __init__(self, branch=None, repository=None):
330
 
        GObject.GObject.__init__(self)
 
333
        gtk.Notebook.__init__(self)
331
334
 
332
335
        self._revision = None
333
336
        self._branch = branch
527
530
        table.resize(max(len(revids), 1), 2)
528
531
 
529
532
        for idx, revid in enumerate(revids):
530
 
            align = Gtk.Alignment.new(0.0, 0.0, 1, 1)
 
533
            align = gtk.Alignment(0.0, 0.0, 1, 1)
531
534
            widgets.append(align)
532
535
            table.attach(align, 1, 2, idx, idx + 1,
533
 
                                      Gtk.AttachOptions.EXPAND | Gtk.AttachOptions.FILL, Gtk.AttachOptions.FILL)
 
536
                                      gtk.EXPAND | gtk.FILL, gtk.FILL)
534
537
            align.show()
535
538
 
536
 
            hbox = Gtk.HBox(False, spacing=6)
 
539
            hbox = gtk.HBox(False, spacing=6)
537
540
            align.add(hbox)
538
541
            hbox.show()
539
542
 
540
 
            image = Gtk.Image()
 
543
            image = gtk.Image()
541
544
            image.set_from_stock(
542
 
                Gtk.STOCK_FIND, Gtk.IconSize.SMALL_TOOLBAR)
 
545
                gtk.STOCK_FIND, gtk.ICON_SIZE_SMALL_TOOLBAR)
543
546
            image.show()
544
547
 
545
548
            if self._show_callback is not None:
546
 
                button = Gtk.Button()
 
549
                button = gtk.Button()
547
550
                button.add(image)
548
551
                button.connect("clicked", self._show_clicked_cb,
549
552
                               self._revision.revision_id, revid)
550
553
                hbox.pack_start(button, expand=False, fill=True)
551
554
                button.show()
552
555
 
553
 
            button = Gtk.Button()
554
 
            revid_label = Gtk.Label(label=str(revid))
555
 
            revid_label.set_ellipsize(Pango.EllipsizeMode.MIDDLE)
 
556
            button = gtk.Button()
 
557
            revid_label = gtk.Label(str(revid))
 
558
            revid_label.set_ellipsize(pango.ELLIPSIZE_MIDDLE)
556
559
            revid_label.set_alignment(0.0, 0.5)
557
560
            button.add(revid_label)
558
561
            button.connect("clicked",
562
565
            button.show_all()
563
566
 
564
567
    def _create_general(self):
565
 
        vbox = Gtk.VBox(False, 6)
 
568
        vbox = gtk.VBox(False, 6)
566
569
        vbox.set_border_width(6)
567
 
        vbox.pack_start(self._create_headers(, True, True, 0), expand=False, fill=True)
568
 
        vbox.pack_start(self._create_message_view(, True, True, 0))
569
 
        self.append_page(vbox, tab_label=Gtk.Label(label="General"))
 
570
        vbox.pack_start(self._create_headers(), expand=False, fill=True)
 
571
        vbox.pack_start(self._create_message_view())
 
572
        self.append_page(vbox, tab_label=gtk.Label("General"))
570
573
        vbox.show()
571
574
 
572
575
    def _create_relations(self):
573
 
        vbox = Gtk.VBox(False, 6)
 
576
        vbox = gtk.VBox(False, 6)
574
577
        vbox.set_border_width(6)
575
 
        vbox.pack_start(self._create_parents(, True, True, 0), expand=False, fill=True)
576
 
        vbox.pack_start(self._create_children(, True, True, 0), expand=False, fill=True)
577
 
        self.append_page(vbox, tab_label=Gtk.Label(label="Relations"))
 
578
        vbox.pack_start(self._create_parents(), expand=False, fill=True)
 
579
        vbox.pack_start(self._create_children(), expand=False, fill=True)
 
580
        self.append_page(vbox, tab_label=gtk.Label("Relations"))
578
581
        vbox.show()
579
582
 
580
583
    def _create_signature(self):
581
584
        self.signature_table = SignatureTab(self._repository)
582
 
        self.append_page(self.signature_table, tab_label=Gtk.Label(label='Signature'))
 
585
        self.append_page(self.signature_table, tab_label=gtk.Label('Signature'))
583
586
        self.connect_after('notify::revision', self._update_signature)
584
587
 
585
588
    def _create_headers(self):
586
589
        self.avatarsbox = AvatarsBox()
587
590
        
588
 
        self.table = Gtk.Table(rows=5, columns=2)
 
591
        self.table = gtk.Table(rows=5, columns=2)
589
592
        self.table.set_row_spacings(6)
590
593
        self.table.set_col_spacings(6)
591
594
        self.table.show()
592
595
        
593
 
        self.avatarsbox.pack_start(self.table, True, True, 0)
 
596
        self.avatarsbox.pack_start(self.table)
594
597
        self.avatarsbox.show()
595
598
 
596
599
        row = 0
597
600
 
598
 
        label = Gtk.Label()
 
601
        label = gtk.Label()
599
602
        label.set_alignment(1.0, 0.5)
600
603
        label.set_markup("<b>Revision Id:</b>")
601
 
        self.table.attach(label, 0, 1, row, row+1, Gtk.AttachOptions.FILL, Gtk.AttachOptions.FILL)
 
604
        self.table.attach(label, 0, 1, row, row+1, gtk.FILL, gtk.FILL)
602
605
        label.show()
603
606
 
604
 
        revision_id = Gtk.Label()
605
 
        revision_id.set_ellipsize(Pango.EllipsizeMode.MIDDLE)
 
607
        revision_id = gtk.Label()
 
608
        revision_id.set_ellipsize(pango.ELLIPSIZE_MIDDLE)
606
609
        revision_id.set_alignment(0.0, 0.5)
607
610
        revision_id.set_selectable(True)
608
611
        self.connect('notify::revision', 
609
612
                lambda w, p: revision_id.set_text(self._revision.revision_id))
610
 
        self.table.attach(revision_id, 1, 2, row, row+1, Gtk.AttachOptions.EXPAND | Gtk.AttachOptions.FILL, Gtk.AttachOptions.FILL)
 
613
        self.table.attach(revision_id, 1, 2, row, row+1, gtk.EXPAND | gtk.FILL, gtk.FILL)
611
614
        revision_id.show()
612
615
 
613
616
        row += 1
614
 
        self.author_label = Gtk.Label()
 
617
        self.author_label = gtk.Label()
615
618
        self.author_label.set_alignment(1.0, 0.5)
616
619
        self.author_label.set_markup("<b>Author:</b>")
617
 
        self.table.attach(self.author_label, 0, 1, row, row+1, Gtk.AttachOptions.FILL, Gtk.AttachOptions.FILL)
 
620
        self.table.attach(self.author_label, 0, 1, row, row+1, gtk.FILL, gtk.FILL)
618
621
        self.author_label.show()
619
622
 
620
 
        self.author = Gtk.Label()
621
 
        self.author.set_ellipsize(Pango.EllipsizeMode.END)
 
623
        self.author = gtk.Label()
 
624
        self.author.set_ellipsize(pango.ELLIPSIZE_END)
622
625
        self.author.set_alignment(0.0, 0.5)
623
626
        self.author.set_selectable(True)
624
 
        self.table.attach(self.author, 1, 2, row, row+1, Gtk.AttachOptions.EXPAND | Gtk.AttachOptions.FILL, Gtk.AttachOptions.FILL)
 
627
        self.table.attach(self.author, 1, 2, row, row+1, gtk.EXPAND | gtk.FILL, gtk.FILL)
625
628
        self.author.show()
626
629
        self.author.hide()
627
630
 
628
631
        row += 1
629
 
        label = Gtk.Label()
 
632
        label = gtk.Label()
630
633
        label.set_alignment(1.0, 0.5)
631
634
        label.set_markup("<b>Committer:</b>")
632
 
        self.table.attach(label, 0, 1, row, row+1, Gtk.AttachOptions.FILL, Gtk.AttachOptions.FILL)
 
635
        self.table.attach(label, 0, 1, row, row+1, gtk.FILL, gtk.FILL)
633
636
        label.show()
634
637
 
635
 
        self.committer = Gtk.Label()
636
 
        self.committer.set_ellipsize(Pango.EllipsizeMode.END)
 
638
        self.committer = gtk.Label()
 
639
        self.committer.set_ellipsize(pango.ELLIPSIZE_END)
637
640
        self.committer.set_alignment(0.0, 0.5)
638
641
        self.committer.set_selectable(True)
639
 
        self.table.attach(self.committer, 1, 2, row, row+1, Gtk.AttachOptions.EXPAND | Gtk.AttachOptions.FILL, Gtk.AttachOptions.FILL)
 
642
        self.table.attach(self.committer, 1, 2, row, row+1, gtk.EXPAND | gtk.FILL, gtk.FILL)
640
643
        self.committer.show()
641
644
 
642
645
        row += 1
643
 
        self.branchnick_label = Gtk.Label()
 
646
        self.branchnick_label = gtk.Label()
644
647
        self.branchnick_label.set_alignment(1.0, 0.5)
645
648
        self.branchnick_label.set_markup("<b>Branch nick:</b>")
646
 
        self.table.attach(self.branchnick_label, 0, 1, row, row+1, Gtk.AttachOptions.FILL, Gtk.AttachOptions.FILL)
 
649
        self.table.attach(self.branchnick_label, 0, 1, row, row+1, gtk.FILL, gtk.FILL)
647
650
        self.branchnick_label.show()
648
651
 
649
 
        self.branchnick = Gtk.Label()
650
 
        self.branchnick.set_ellipsize(Pango.EllipsizeMode.MIDDLE)
 
652
        self.branchnick = gtk.Label()
 
653
        self.branchnick.set_ellipsize(pango.ELLIPSIZE_MIDDLE)
651
654
        self.branchnick.set_alignment(0.0, 0.5)
652
655
        self.branchnick.set_selectable(True)
653
 
        self.table.attach(self.branchnick, 1, 2, row, row+1, Gtk.AttachOptions.EXPAND | Gtk.AttachOptions.FILL, Gtk.AttachOptions.FILL)
 
656
        self.table.attach(self.branchnick, 1, 2, row, row+1, gtk.EXPAND | gtk.FILL, gtk.FILL)
654
657
        self.branchnick.show()
655
658
 
656
659
        row += 1
657
 
        label = Gtk.Label()
 
660
        label = gtk.Label()
658
661
        label.set_alignment(1.0, 0.5)
659
662
        label.set_markup("<b>Timestamp:</b>")
660
 
        self.table.attach(label, 0, 1, row, row+1, Gtk.AttachOptions.FILL, Gtk.AttachOptions.FILL)
 
663
        self.table.attach(label, 0, 1, row, row+1, gtk.FILL, gtk.FILL)
661
664
        label.show()
662
665
 
663
 
        self.timestamp = Gtk.Label()
664
 
        self.timestamp.set_ellipsize(Pango.EllipsizeMode.END)
 
666
        self.timestamp = gtk.Label()
 
667
        self.timestamp.set_ellipsize(pango.ELLIPSIZE_END)
665
668
        self.timestamp.set_alignment(0.0, 0.5)
666
669
        self.timestamp.set_selectable(True)
667
 
        self.table.attach(self.timestamp, 1, 2, row, row+1, Gtk.AttachOptions.EXPAND | Gtk.AttachOptions.FILL, Gtk.AttachOptions.FILL)
 
670
        self.table.attach(self.timestamp, 1, 2, row, row+1, gtk.EXPAND | gtk.FILL, gtk.FILL)
668
671
        self.timestamp.show()
669
672
 
670
673
        row += 1
671
 
        self.tags_label = Gtk.Label()
 
674
        self.tags_label = gtk.Label()
672
675
        self.tags_label.set_alignment(1.0, 0.5)
673
676
        self.tags_label.set_markup("<b>Tags:</b>")
674
 
        self.table.attach(self.tags_label, 0, 1, row, row+1, Gtk.AttachOptions.FILL, Gtk.AttachOptions.FILL)
 
677
        self.table.attach(self.tags_label, 0, 1, row, row+1, gtk.FILL, gtk.FILL)
675
678
        self.tags_label.show()
676
679
 
677
 
        self.tags_list = Gtk.Label()
678
 
        self.tags_list.set_ellipsize(Pango.EllipsizeMode.MIDDLE)
 
680
        self.tags_list = gtk.Label()
 
681
        self.tags_list.set_ellipsize(pango.ELLIPSIZE_MIDDLE)
679
682
        self.tags_list.set_alignment(0.0, 0.5)
680
 
        self.table.attach(self.tags_list, 1, 2, row, row+1, Gtk.AttachOptions.EXPAND | Gtk.AttachOptions.FILL, Gtk.AttachOptions.FILL)
 
683
        self.table.attach(self.tags_list, 1, 2, row, row+1, gtk.EXPAND | gtk.FILL, gtk.FILL)
681
684
        self.tags_list.show()
682
685
 
683
686
        self.connect('notify::revision', self._add_tags)
686
689
        return self.avatarsbox
687
690
    
688
691
    def _create_parents(self):
689
 
        hbox = Gtk.HBox(True, 3)
 
692
        hbox = gtk.HBox(True, 3)
690
693
        
691
694
        self.parents_table = self._create_parents_or_children_table(
692
695
            "<b>Parents:</b>")
693
696
        self.parents_widgets = []
694
 
        hbox.pack_start(self.parents_table, True, True, 0)
 
697
        hbox.pack_start(self.parents_table)
695
698
 
696
699
        hbox.show()
697
700
        return hbox
698
701
 
699
702
    def _create_children(self):
700
 
        hbox = Gtk.HBox(True, 3)
 
703
        hbox = gtk.HBox(True, 3)
701
704
        self.children_table = self._create_parents_or_children_table(
702
705
            "<b>Children:</b>")
703
706
        self.children_widgets = []
704
 
        hbox.pack_start(self.children_table, True, True, 0)
 
707
        hbox.pack_start(self.children_table)
705
708
        hbox.show()
706
709
        return hbox
707
710
        
708
711
    def _create_parents_or_children_table(self, text):
709
 
        table = Gtk.Table(rows=1, columns=2)
 
712
        table = gtk.Table(rows=1, columns=2)
710
713
        table.set_row_spacings(3)
711
714
        table.set_col_spacings(6)
712
715
        table.show()
713
716
 
714
 
        label = Gtk.Label()
 
717
        label = gtk.Label()
715
718
        label.set_markup(text)
716
 
        align = Gtk.Alignment.new(0.0, 0.5)
 
719
        align = gtk.Alignment(0.0, 0.5)
717
720
        align.add(label)
718
 
        table.attach(align, 0, 1, 0, 1, Gtk.AttachOptions.FILL, Gtk.AttachOptions.FILL)
 
721
        table.attach(align, 0, 1, 0, 1, gtk.FILL, gtk.FILL)
719
722
        label.show()
720
723
        align.show()
721
724
 
722
725
        return table
723
726
 
724
727
    def _create_message_view(self):
725
 
        msg_buffer = Gtk.TextBuffer()
 
728
        msg_buffer = gtk.TextBuffer()
726
729
        self.connect('notify::revision',
727
730
                lambda w, p: msg_buffer.set_text(self._revision.message))
728
 
        window = Gtk.ScrolledWindow()
729
 
        window.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC)
730
 
        window.set_shadow_type(Gtk.ShadowType.IN)
731
 
        tv = Gtk.TextView(msg_buffer)
 
731
        window = gtk.ScrolledWindow()
 
732
        window.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)
 
733
        window.set_shadow_type(gtk.SHADOW_IN)
 
734
        tv = gtk.TextView(msg_buffer)
732
735
        tv.set_editable(False)
733
 
        tv.set_wrap_mode(Gtk.WrapMode.WORD)
 
736
        tv.set_wrap_mode(gtk.WRAP_WORD)
734
737
 
735
 
        tv.modify_font(Pango.FontDescription("Monospace"))
 
738
        tv.modify_font(pango.FontDescription("Monospace"))
736
739
        tv.show()
737
740
        window.add(tv)
738
741
        window.show()
741
744
    def _create_bugs(self):
742
745
        self.bugs_page = BugsTab()
743
746
        self.connect_after('notify::revision', self._update_bugs) 
744
 
        self.append_page(self.bugs_page, tab_label=Gtk.Label(label='Bugs'))
 
747
        self.append_page(self.bugs_page, tab_label=gtk.Label('Bugs'))
745
748
 
746
749
    def _create_file_info_view(self):
747
 
        self.file_info_box = Gtk.VBox(False, 6)
 
750
        self.file_info_box = gtk.VBox(False, 6)
748
751
        self.file_info_box.set_border_width(6)
749
 
        self.file_info_buffer = Gtk.TextBuffer()
750
 
        window = Gtk.ScrolledWindow()
751
 
        window.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC)
752
 
        window.set_shadow_type(Gtk.ShadowType.IN)
753
 
        tv = Gtk.TextView(self.file_info_buffer)
 
752
        self.file_info_buffer = gtk.TextBuffer()
 
753
        window = gtk.ScrolledWindow()
 
754
        window.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)
 
755
        window.set_shadow_type(gtk.SHADOW_IN)
 
756
        tv = gtk.TextView(self.file_info_buffer)
754
757
        tv.set_editable(False)
755
 
        tv.set_wrap_mode(Gtk.WrapMode.WORD)
756
 
        tv.modify_font(Pango.FontDescription("Monospace"))
 
758
        tv.set_wrap_mode(gtk.WRAP_WORD)
 
759
        tv.modify_font(pango.FontDescription("Monospace"))
757
760
        tv.show()
758
761
        window.add(tv)
759
762
        window.show()
760
 
        self.file_info_box.pack_start(window, True, True, 0)
 
763
        self.file_info_box.pack_start(window)
761
764
        self.file_info_box.hide() # Only shown when there are per-file messages
762
 
        self.append_page(self.file_info_box, tab_label=Gtk.Label(label='Per-file'))
 
765
        self.append_page(self.file_info_box, tab_label=gtk.Label('Per-file'))
763
766