/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-09-03 01:25:04 UTC
  • mto: This revision was merged to the branch mainline in revision 741.
  • Revision ID: sinzui.is@verizon.net-20110903012504-0jr4diz9033g5df2
Menu fixes.

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
53
51
            webbrowser._tryorder.insert(0, '%s "%%s"' % cmd)
54
52
    webbrowser.open(uri)
55
53
 
56
 
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)
 
54
if getattr(Gtk, 'link_button_set_uri_hook', None) is not None:
 
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
 
        super(BugsTab, self).__init__(False, 6)
 
60
        super(BugsTab, self).__init__(homogeneous=False, spacing=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, 0, 0)
 
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(model=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
151
148
        self.revision = None
152
149
        self.repository = repository
153
150
 
154
 
        super(SignatureTab, self).__init__(False, 6)
155
 
        signature_box = gtk.Table(rows=3, columns=3)
 
151
        super(SignatureTab, self).__init__(homogeneous=False, spacing=6)
 
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, 0.0, 0.0)
 
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, 0.0, 0.0)
 
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, 0.0, 0.0)
 
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, 0.0, 0.0)
 
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, 0.0, 0.0)
 
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, 0.0, 0.0)
 
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, 0.0, 0.0)
 
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
        Gtk.Notebook.__init__(self)
334
331
 
335
332
        self._revision = None
336
333
        self._branch = branch
338
335
            self._repository = branch.repository
339
336
        else:
340
337
            self._repository = repository
 
338
        self.signature_table = None
341
339
 
342
340
        self._create_general()
343
341
        self._create_relations()
477
475
        self._add_tags()
478
476
 
479
477
    def _update_signature(self, widget, param):
 
478
        if not has_seahorse:
 
479
            return
480
480
        if self.get_current_page() == PAGE_SIGNATURE:
481
481
            self.signature_table.set_revision(self._revision)
482
482
 
491
491
                                      self.children_table)
492
492
 
493
493
    def _switch_page_cb(self, notebook, page, page_num):
 
494
        if not has_seahorse:
 
495
            return
494
496
        if page_num == PAGE_SIGNATURE:
495
497
            self.signature_table.set_revision(self._revision)
496
498
 
530
532
        table.resize(max(len(revids), 1), 2)
531
533
 
532
534
        for idx, revid in enumerate(revids):
533
 
            align = gtk.Alignment(0.0, 0.0, 1, 1)
 
535
            align = Gtk.Alignment.new(0.0, 0.0, 1, 1)
534
536
            widgets.append(align)
535
537
            table.attach(align, 1, 2, idx, idx + 1,
536
 
                                      gtk.EXPAND | gtk.FILL, gtk.FILL)
 
538
                                      Gtk.AttachOptions.EXPAND | Gtk.AttachOptions.FILL, Gtk.AttachOptions.FILL)
537
539
            align.show()
538
540
 
539
 
            hbox = gtk.HBox(False, spacing=6)
 
541
            hbox = Gtk.HBox(homogeneous=False, spacing=6)
540
542
            align.add(hbox)
541
543
            hbox.show()
542
544
 
543
 
            image = gtk.Image()
 
545
            image = Gtk.Image()
544
546
            image.set_from_stock(
545
 
                gtk.STOCK_FIND, gtk.ICON_SIZE_SMALL_TOOLBAR)
 
547
                Gtk.STOCK_FIND, Gtk.IconSize.SMALL_TOOLBAR)
546
548
            image.show()
547
549
 
548
550
            if self._show_callback is not None:
549
 
                button = gtk.Button()
 
551
                button = Gtk.Button()
550
552
                button.add(image)
551
553
                button.connect("clicked", self._show_clicked_cb,
552
554
                               self._revision.revision_id, revid)
553
 
                hbox.pack_start(button, expand=False, fill=True)
 
555
                hbox.pack_start(button, False, True, 0)
554
556
                button.show()
555
557
 
556
 
            button = gtk.Button()
557
 
            revid_label = gtk.Label(str(revid))
558
 
            revid_label.set_ellipsize(pango.ELLIPSIZE_MIDDLE)
 
558
            button = Gtk.Button()
 
559
            revid_label = Gtk.Label(label=str(revid))
 
560
            revid_label.set_ellipsize(Pango.EllipsizeMode.MIDDLE)
559
561
            revid_label.set_alignment(0.0, 0.5)
560
562
            button.add(revid_label)
561
563
            button.connect("clicked",
562
 
                    lambda w, r: self.set_revision(self._repository.get_revision(r)), revid)
 
564
                    lambda w, r: self.set_revision(
 
565
                        self._repository.get_revision(r)), revid)
563
566
            button.set_use_underline(False)
564
 
            hbox.pack_start(button, expand=True, fill=True)
 
567
            hbox.pack_start(button, True, True, 0)
565
568
            button.show_all()
566
569
 
567
570
    def _create_general(self):
568
 
        vbox = gtk.VBox(False, 6)
 
571
        vbox = Gtk.VBox(homogeneous=False, spacing=6)
569
572
        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"))
 
573
        vbox.pack_start(self._create_headers(), False, True, 0)
 
574
        vbox.pack_start(self._create_message_view(), True, True, 0)
 
575
        self.append_page(vbox, Gtk.Label(label="General"))
573
576
        vbox.show()
574
577
 
575
578
    def _create_relations(self):
576
 
        vbox = gtk.VBox(False, 6)
 
579
        vbox = Gtk.VBox(homogeneous=False, spacing=6)
577
580
        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"))
 
581
        vbox.pack_start(self._create_parents(), False, True, 0)
 
582
        vbox.pack_start(self._create_children(), False, True, 0)
 
583
        self.append_page(vbox, Gtk.Label(label="Relations"))
581
584
        vbox.show()
582
585
 
583
586
    def _create_signature(self):
584
587
        self.signature_table = SignatureTab(self._repository)
585
 
        self.append_page(self.signature_table, tab_label=gtk.Label('Signature'))
 
588
        self.append_page(
 
589
            self.signature_table, Gtk.Label(label='Signature'))
586
590
        self.connect_after('notify::revision', self._update_signature)
587
591
 
588
592
    def _create_headers(self):
589
593
        self.avatarsbox = AvatarsBox()
590
594
        
591
 
        self.table = gtk.Table(rows=5, columns=2)
 
595
        self.table = Gtk.Table(rows=5, columns=2)
592
596
        self.table.set_row_spacings(6)
593
597
        self.table.set_col_spacings(6)
594
598
        self.table.show()
595
599
        
596
 
        self.avatarsbox.pack_start(self.table)
 
600
        self.avatarsbox.pack_start(self.table, True, True, 0)
597
601
        self.avatarsbox.show()
598
602
 
599
603
        row = 0
600
604
 
601
 
        label = gtk.Label()
 
605
        label = Gtk.Label()
602
606
        label.set_alignment(1.0, 0.5)
603
607
        label.set_markup("<b>Revision Id:</b>")
604
 
        self.table.attach(label, 0, 1, row, row+1, gtk.FILL, gtk.FILL)
 
608
        self.table.attach(label, 0, 1, row, row+1, Gtk.AttachOptions.FILL, Gtk.AttachOptions.FILL)
605
609
        label.show()
606
610
 
607
 
        revision_id = gtk.Label()
608
 
        revision_id.set_ellipsize(pango.ELLIPSIZE_MIDDLE)
 
611
        revision_id = Gtk.Label()
 
612
        revision_id.set_ellipsize(Pango.EllipsizeMode.MIDDLE)
609
613
        revision_id.set_alignment(0.0, 0.5)
610
614
        revision_id.set_selectable(True)
611
615
        self.connect('notify::revision', 
612
616
                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)
 
617
        self.table.attach(revision_id, 1, 2, row, row+1, Gtk.AttachOptions.EXPAND | Gtk.AttachOptions.FILL, Gtk.AttachOptions.FILL)
614
618
        revision_id.show()
615
619
 
616
620
        row += 1
617
 
        self.author_label = gtk.Label()
 
621
        self.author_label = Gtk.Label()
618
622
        self.author_label.set_alignment(1.0, 0.5)
619
623
        self.author_label.set_markup("<b>Author:</b>")
620
 
        self.table.attach(self.author_label, 0, 1, row, row+1, gtk.FILL, gtk.FILL)
 
624
        self.table.attach(self.author_label, 0, 1, row, row+1, Gtk.AttachOptions.FILL, Gtk.AttachOptions.FILL)
621
625
        self.author_label.show()
622
626
 
623
 
        self.author = gtk.Label()
624
 
        self.author.set_ellipsize(pango.ELLIPSIZE_END)
 
627
        self.author = Gtk.Label()
 
628
        self.author.set_ellipsize(Pango.EllipsizeMode.END)
625
629
        self.author.set_alignment(0.0, 0.5)
626
630
        self.author.set_selectable(True)
627
 
        self.table.attach(self.author, 1, 2, row, row+1, gtk.EXPAND | gtk.FILL, gtk.FILL)
 
631
        self.table.attach(self.author, 1, 2, row, row+1, Gtk.AttachOptions.EXPAND | Gtk.AttachOptions.FILL, Gtk.AttachOptions.FILL)
628
632
        self.author.show()
629
633
        self.author.hide()
630
634
 
631
635
        row += 1
632
 
        label = gtk.Label()
 
636
        label = Gtk.Label()
633
637
        label.set_alignment(1.0, 0.5)
634
638
        label.set_markup("<b>Committer:</b>")
635
 
        self.table.attach(label, 0, 1, row, row+1, gtk.FILL, gtk.FILL)
 
639
        self.table.attach(label, 0, 1, row, row+1, Gtk.AttachOptions.FILL, Gtk.AttachOptions.FILL)
636
640
        label.show()
637
641
 
638
 
        self.committer = gtk.Label()
639
 
        self.committer.set_ellipsize(pango.ELLIPSIZE_END)
 
642
        self.committer = Gtk.Label()
 
643
        self.committer.set_ellipsize(Pango.EllipsizeMode.END)
640
644
        self.committer.set_alignment(0.0, 0.5)
641
645
        self.committer.set_selectable(True)
642
 
        self.table.attach(self.committer, 1, 2, row, row+1, gtk.EXPAND | gtk.FILL, gtk.FILL)
 
646
        self.table.attach(self.committer, 1, 2, row, row+1, Gtk.AttachOptions.EXPAND | Gtk.AttachOptions.FILL, Gtk.AttachOptions.FILL)
643
647
        self.committer.show()
644
648
 
645
649
        row += 1
646
 
        self.branchnick_label = gtk.Label()
 
650
        self.branchnick_label = Gtk.Label()
647
651
        self.branchnick_label.set_alignment(1.0, 0.5)
648
652
        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)
 
653
        self.table.attach(self.branchnick_label, 0, 1, row, row+1, Gtk.AttachOptions.FILL, Gtk.AttachOptions.FILL)
650
654
        self.branchnick_label.show()
651
655
 
652
 
        self.branchnick = gtk.Label()
653
 
        self.branchnick.set_ellipsize(pango.ELLIPSIZE_MIDDLE)
 
656
        self.branchnick = Gtk.Label()
 
657
        self.branchnick.set_ellipsize(Pango.EllipsizeMode.MIDDLE)
654
658
        self.branchnick.set_alignment(0.0, 0.5)
655
659
        self.branchnick.set_selectable(True)
656
 
        self.table.attach(self.branchnick, 1, 2, row, row+1, gtk.EXPAND | gtk.FILL, gtk.FILL)
 
660
        self.table.attach(self.branchnick, 1, 2, row, row+1, Gtk.AttachOptions.EXPAND | Gtk.AttachOptions.FILL, Gtk.AttachOptions.FILL)
657
661
        self.branchnick.show()
658
662
 
659
663
        row += 1
660
 
        label = gtk.Label()
 
664
        label = Gtk.Label()
661
665
        label.set_alignment(1.0, 0.5)
662
666
        label.set_markup("<b>Timestamp:</b>")
663
 
        self.table.attach(label, 0, 1, row, row+1, gtk.FILL, gtk.FILL)
 
667
        self.table.attach(label, 0, 1, row, row+1, Gtk.AttachOptions.FILL, Gtk.AttachOptions.FILL)
664
668
        label.show()
665
669
 
666
 
        self.timestamp = gtk.Label()
667
 
        self.timestamp.set_ellipsize(pango.ELLIPSIZE_END)
 
670
        self.timestamp = Gtk.Label()
 
671
        self.timestamp.set_ellipsize(Pango.EllipsizeMode.END)
668
672
        self.timestamp.set_alignment(0.0, 0.5)
669
673
        self.timestamp.set_selectable(True)
670
 
        self.table.attach(self.timestamp, 1, 2, row, row+1, gtk.EXPAND | gtk.FILL, gtk.FILL)
 
674
        self.table.attach(self.timestamp, 1, 2, row, row+1, Gtk.AttachOptions.EXPAND | Gtk.AttachOptions.FILL, Gtk.AttachOptions.FILL)
671
675
        self.timestamp.show()
672
676
 
673
677
        row += 1
674
 
        self.tags_label = gtk.Label()
 
678
        self.tags_label = Gtk.Label()
675
679
        self.tags_label.set_alignment(1.0, 0.5)
676
680
        self.tags_label.set_markup("<b>Tags:</b>")
677
 
        self.table.attach(self.tags_label, 0, 1, row, row+1, gtk.FILL, gtk.FILL)
 
681
        self.table.attach(self.tags_label, 0, 1, row, row+1, Gtk.AttachOptions.FILL, Gtk.AttachOptions.FILL)
678
682
        self.tags_label.show()
679
683
 
680
 
        self.tags_list = gtk.Label()
681
 
        self.tags_list.set_ellipsize(pango.ELLIPSIZE_MIDDLE)
 
684
        self.tags_list = Gtk.Label()
 
685
        self.tags_list.set_ellipsize(Pango.EllipsizeMode.MIDDLE)
682
686
        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)
 
687
        self.table.attach(self.tags_list, 1, 2, row, row+1, Gtk.AttachOptions.EXPAND | Gtk.AttachOptions.FILL, Gtk.AttachOptions.FILL)
684
688
        self.tags_list.show()
685
689
 
686
690
        self.connect('notify::revision', self._add_tags)
687
691
 
688
 
        self.avatarsbox.show()
689
692
        return self.avatarsbox
690
693
    
691
694
    def _create_parents(self):
692
 
        hbox = gtk.HBox(True, 3)
 
695
        hbox = Gtk.HBox(homogeneous=True, spacing=3)
693
696
        
694
697
        self.parents_table = self._create_parents_or_children_table(
695
698
            "<b>Parents:</b>")
696
699
        self.parents_widgets = []
697
 
        hbox.pack_start(self.parents_table)
 
700
        hbox.pack_start(self.parents_table, True, True, 0)
698
701
 
699
702
        hbox.show()
700
703
        return hbox
701
704
 
702
705
    def _create_children(self):
703
 
        hbox = gtk.HBox(True, 3)
 
706
        hbox = Gtk.HBox(homogeneous=True, spacing=3)
704
707
        self.children_table = self._create_parents_or_children_table(
705
708
            "<b>Children:</b>")
706
709
        self.children_widgets = []
707
 
        hbox.pack_start(self.children_table)
 
710
        hbox.pack_start(self.children_table, True, True, 0)
708
711
        hbox.show()
709
712
        return hbox
710
713
        
711
714
    def _create_parents_or_children_table(self, text):
712
 
        table = gtk.Table(rows=1, columns=2)
 
715
        table = Gtk.Table(rows=1, columns=2)
713
716
        table.set_row_spacings(3)
714
717
        table.set_col_spacings(6)
715
718
        table.show()
716
719
 
717
 
        label = gtk.Label()
 
720
        label = Gtk.Label()
718
721
        label.set_markup(text)
719
 
        align = gtk.Alignment(0.0, 0.5)
 
722
        align = Gtk.Alignment.new(0.0, 0.5, 0, 0)
720
723
        align.add(label)
721
 
        table.attach(align, 0, 1, 0, 1, gtk.FILL, gtk.FILL)
 
724
        table.attach(align, 0, 1, 0, 1, Gtk.AttachOptions.FILL, Gtk.AttachOptions.FILL)
722
725
        label.show()
723
726
        align.show()
724
727
 
725
728
        return table
726
729
 
727
730
    def _create_message_view(self):
728
 
        msg_buffer = gtk.TextBuffer()
 
731
        msg_buffer = Gtk.TextBuffer()
729
732
        self.connect('notify::revision',
730
733
                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)
 
734
        window = Gtk.ScrolledWindow()
 
735
        window.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC)
 
736
        window.set_shadow_type(Gtk.ShadowType.IN)
 
737
        tv = Gtk.TextView(buffer=msg_buffer)
735
738
        tv.set_editable(False)
736
 
        tv.set_wrap_mode(gtk.WRAP_WORD)
 
739
        tv.set_wrap_mode(Gtk.WrapMode.WORD)
737
740
 
738
 
        tv.modify_font(pango.FontDescription("Monospace"))
 
741
        tv.modify_font(Pango.FontDescription("Monospace"))
739
742
        tv.show()
740
743
        window.add(tv)
741
744
        window.show()
744
747
    def _create_bugs(self):
745
748
        self.bugs_page = BugsTab()
746
749
        self.connect_after('notify::revision', self._update_bugs) 
747
 
        self.append_page(self.bugs_page, tab_label=gtk.Label('Bugs'))
 
750
        self.append_page(self.bugs_page, Gtk.Label(label='Bugs'))
748
751
 
749
752
    def _create_file_info_view(self):
750
 
        self.file_info_box = gtk.VBox(False, 6)
 
753
        self.file_info_box = Gtk.VBox(homogeneous=False, spacing=6)
751
754
        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)
 
755
        self.file_info_buffer = Gtk.TextBuffer()
 
756
        window = Gtk.ScrolledWindow()
 
757
        window.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC)
 
758
        window.set_shadow_type(Gtk.ShadowType.IN)
 
759
        tv = Gtk.TextView(buffer=self.file_info_buffer)
757
760
        tv.set_editable(False)
758
 
        tv.set_wrap_mode(gtk.WRAP_WORD)
759
 
        tv.modify_font(pango.FontDescription("Monospace"))
 
761
        tv.set_wrap_mode(Gtk.WrapMode.WORD)
 
762
        tv.modify_font(Pango.FontDescription("Monospace"))
760
763
        tv.show()
761
764
        window.add(tv)
762
765
        window.show()
763
 
        self.file_info_box.pack_start(window)
 
766
        self.file_info_box.pack_start(window, True, True, 0)
764
767
        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'))
 
768
        self.append_page(self.file_info_box, Gtk.Label(label='Per-file'))
766
769