/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: Curtis Hovey
  • Date: 2011-07-31 15:52:43 UTC
  • mto: This revision was merged to the branch mainline in revision 741.
  • Revision ID: sinzui.is@verizon.net-20110731155243-ln8istmxbryhb4pz
Mechanical changes made by pygi.convert.sh.

Show diffs side-by-side

added added

removed removed

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