/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 16:50:29 UTC
  • mto: This revision was merged to the branch mainline in revision 741.
  • Revision ID: sinzui.is@verizon.net-20110731165029-9gixuqypi3lwapzm
Removed import_pygtk because gi does not impicitly call Main(). Inlined checks for gtk availablility.

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