/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-04-10 18:44:39 UTC
  • mto: This revision was merged to the branch mainline in revision 730.
  • Revision ID: jelmer@samba.org-20110410184439-g7hqaacexqtviq13
Move i18n support to a separate file, so gettext files aren't loaded unless bzr-gtk is used.

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
24
26
from bzrlib.osutils import format_date
25
 
from bzrlib.bencode import bdecode
 
27
try:
 
28
    from bzrlib.bencode import bdecode
 
29
except ImportError:
 
30
    from bzrlib.util.bencode import bdecode
26
31
from bzrlib.testament import Testament
27
32
 
28
33
from bzrlib.plugins.gtk import icon_path
48
53
            webbrowser._tryorder.insert(0, '%s "%%s"' % cmd)
49
54
    webbrowser.open(uri)
50
55
 
 
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)
51
59
 
52
 
class BugsTab(Gtk.VBox):
 
60
class BugsTab(gtk.VBox):
53
61
 
54
62
    def __init__(self):
55
 
        super(BugsTab, self).__init__(homogeneous=False, spacing=6)
 
63
        super(BugsTab, self).__init__(False, 6)
56
64
 
57
 
        table = Gtk.Table(rows=2, columns=2)
 
65
        table = gtk.Table(rows=2, columns=2)
58
66
 
59
67
        table.set_row_spacings(6)
60
68
        table.set_col_spacing(0, 16)
61
69
 
62
 
        image = Gtk.Image()
 
70
        image = gtk.Image()
63
71
        image.set_from_file(icon_path("bug.png"))
64
 
        table.attach(image, 0, 1, 0, 1, Gtk.AttachOptions.FILL)
 
72
        table.attach(image, 0, 1, 0, 1, gtk.FILL)
65
73
 
66
 
        align = Gtk.Alignment.new(0.0, 0.1, 0, 0)
67
 
        self.label = Gtk.Label()
 
74
        align = gtk.Alignment(0.0, 0.1)
 
75
        self.label = gtk.Label()
68
76
        align.add(self.label)
69
 
        table.attach(align, 1, 2, 0, 1, Gtk.AttachOptions.FILL)
 
77
        table.attach(align, 1, 2, 0, 1, gtk.FILL)
70
78
 
71
79
        treeview = self.construct_treeview()
72
 
        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)
73
81
 
74
82
        self.set_border_width(6)
75
 
        self.pack_start(table, False, True, 0)
 
83
        self.pack_start(table, expand=False)
76
84
 
77
85
        self.clear()
78
86
        self.show_all()
100
108
                              "%d %s." % (self.num_bugs, label))
101
109
 
102
110
    def construct_treeview(self):
103
 
        self.bugs = Gtk.ListStore(GObject.TYPE_STRING, GObject.TYPE_STRING)
104
 
        self.treeview = Gtk.TreeView(model=self.bugs)
 
111
        self.bugs = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_STRING)
 
112
        self.treeview = gtk.TreeView(self.bugs)
105
113
        self.treeview.set_headers_visible(False)
106
114
 
107
 
        uri_column = Gtk.TreeViewColumn('Bug URI', Gtk.CellRendererText(), text=0)
 
115
        uri_column = gtk.TreeViewColumn('Bug URI', gtk.CellRendererText(), text=0)
108
116
        self.treeview.append_column(uri_column)
109
117
 
110
118
        self.treeview.connect('row-activated', self.on_row_activated)
111
119
 
112
 
        win = Gtk.ScrolledWindow()
113
 
        win.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
114
 
        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)
115
123
        win.add(self.treeview)
116
124
 
117
125
        return win
136
144
        _open_link(self, uri)
137
145
 
138
146
 
139
 
class SignatureTab(Gtk.VBox):
 
147
class SignatureTab(gtk.VBox):
140
148
 
141
149
    def __init__(self, repository):
142
150
        self.key = None
143
151
        self.revision = None
144
152
        self.repository = repository
145
153
 
146
 
        super(SignatureTab, self).__init__(homogeneous=False, spacing=6)
147
 
        signature_box = Gtk.Table(rows=3, columns=3)
 
154
        super(SignatureTab, self).__init__(False, 6)
 
155
        signature_box = gtk.Table(rows=3, columns=3)
148
156
        signature_box.set_col_spacing(0, 16)
149
157
        signature_box.set_col_spacing(1, 12)
150
158
        signature_box.set_row_spacings(6)
151
159
 
152
 
        self.signature_image = Gtk.Image()
153
 
        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)
154
162
 
155
 
        align = Gtk.Alignment.new(0.0, 0.1, 0.0, 0.0)
156
 
        self.signature_label = Gtk.Label()
 
163
        align = gtk.Alignment(0.0, 0.1)
 
164
        self.signature_label = gtk.Label()
157
165
        align.add(self.signature_label)
158
 
        signature_box.attach(align, 1, 3, 0, 1, Gtk.AttachOptions.FILL)
 
166
        signature_box.attach(align, 1, 3, 0, 1, gtk.FILL)
159
167
 
160
 
        align = Gtk.Alignment.new(0.0, 0.5, 0.0, 0.0)
161
 
        self.signature_key_id_label = Gtk.Label()
 
168
        align = gtk.Alignment(0.0, 0.5)
 
169
        self.signature_key_id_label = gtk.Label()
162
170
        self.signature_key_id_label.set_markup("<b>Key Id:</b>")
163
171
        align.add(self.signature_key_id_label)
164
 
        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)
165
173
 
166
 
        align = Gtk.Alignment.new(0.0, 0.5, 0.0, 0.0)
167
 
        self.signature_key_id = Gtk.Label()
 
174
        align = gtk.Alignment(0.0, 0.5)
 
175
        self.signature_key_id = gtk.Label()
168
176
        self.signature_key_id.set_selectable(True)
169
177
        align.add(self.signature_key_id)
170
 
        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)
171
179
 
172
 
        align = Gtk.Alignment.new(0.0, 0.5, 0.0, 0.0)
173
 
        self.signature_fingerprint_label = Gtk.Label()
 
180
        align = gtk.Alignment(0.0, 0.5)
 
181
        self.signature_fingerprint_label = gtk.Label()
174
182
        self.signature_fingerprint_label.set_markup("<b>Fingerprint:</b>")
175
183
        align.add(self.signature_fingerprint_label)
176
 
        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)
177
185
 
178
 
        align = Gtk.Alignment.new(0.0, 0.5, 0.0, 0.0)
179
 
        self.signature_fingerprint = Gtk.Label()
 
186
        align = gtk.Alignment(0.0, 0.5)
 
187
        self.signature_fingerprint = gtk.Label()
180
188
        self.signature_fingerprint.set_selectable(True)
181
189
        align.add(self.signature_fingerprint)
182
 
        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)
183
191
 
184
 
        align = Gtk.Alignment.new(0.0, 0.5, 0.0, 0.0)
185
 
        self.signature_trust_label = Gtk.Label()
 
192
        align = gtk.Alignment(0.0, 0.5)
 
193
        self.signature_trust_label = gtk.Label()
186
194
        self.signature_trust_label.set_markup("<b>Trust:</b>")
187
195
        align.add(self.signature_trust_label)
188
 
        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)
189
197
 
190
 
        align = Gtk.Alignment.new(0.0, 0.5, 0.0, 0.0)
191
 
        self.signature_trust = Gtk.Label()
 
198
        align = gtk.Alignment(0.0, 0.5)
 
199
        self.signature_trust = gtk.Label()
192
200
        self.signature_trust.set_selectable(True)
193
201
        align.add(self.signature_trust)
194
 
        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)
195
203
 
196
204
        self.set_border_width(6)
197
 
        self.pack_start(signature_box, False, True, 0)
 
205
        self.pack_start(signature_box, expand=False)
198
206
        self.show_all()
199
207
 
200
208
    def set_revision(self, revision):
284
292
        self.signature_trust.set_text('This key is ' + trust_text)
285
293
 
286
294
 
287
 
class RevisionView(Gtk.Notebook):
 
295
class RevisionView(gtk.Notebook):
288
296
    """ Custom widget for commit log details.
289
297
 
290
298
    A variety of bzr tools may need to implement such a thing. This is a
293
301
 
294
302
    __gproperties__ = {
295
303
        'branch': (
296
 
            GObject.TYPE_PYOBJECT,
 
304
            gobject.TYPE_PYOBJECT,
297
305
            'Branch',
298
306
            'The branch holding the revision being displayed',
299
 
            GObject.PARAM_CONSTRUCT_ONLY | GObject.PARAM_WRITABLE
 
307
            gobject.PARAM_CONSTRUCT_ONLY | gobject.PARAM_WRITABLE
300
308
        ),
301
309
 
302
310
        'revision': (
303
 
            GObject.TYPE_PYOBJECT,
 
311
            gobject.TYPE_PYOBJECT,
304
312
            'Revision',
305
313
            'The revision being displayed',
306
 
            GObject.PARAM_READWRITE
 
314
            gobject.PARAM_READWRITE
307
315
        ),
308
316
 
309
317
        'children': (
310
 
            GObject.TYPE_PYOBJECT,
 
318
            gobject.TYPE_PYOBJECT,
311
319
            'Children',
312
320
            'Child revisions',
313
 
            GObject.PARAM_READWRITE
 
321
            gobject.PARAM_READWRITE
314
322
        ),
315
323
 
316
324
        'file-id': (
317
 
            GObject.TYPE_PYOBJECT,
 
325
            gobject.TYPE_PYOBJECT,
318
326
            'File Id',
319
327
            'The file id',
320
 
            GObject.PARAM_READWRITE
 
328
            gobject.PARAM_READWRITE
321
329
        )
322
330
    }
323
331
 
324
332
    def __init__(self, branch=None, repository=None):
325
 
        super(RevisionView, self).__init__()
 
333
        gtk.Notebook.__init__(self)
326
334
 
327
335
        self._revision = None
328
336
        self._branch = branch
330
338
            self._repository = branch.repository
331
339
        else:
332
340
            self._repository = repository
333
 
        self.signature_table = None
334
341
 
335
342
        self._create_general()
336
343
        self._create_relations()
470
477
        self._add_tags()
471
478
 
472
479
    def _update_signature(self, widget, param):
473
 
        if not has_seahorse:
474
 
            return
475
480
        if self.get_current_page() == PAGE_SIGNATURE:
476
481
            self.signature_table.set_revision(self._revision)
477
482
 
486
491
                                      self.children_table)
487
492
 
488
493
    def _switch_page_cb(self, notebook, page, page_num):
489
 
        if not has_seahorse:
490
 
            return
491
494
        if page_num == PAGE_SIGNATURE:
492
495
            self.signature_table.set_revision(self._revision)
493
496
 
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(homogeneous=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
 
                hbox.pack_start(button, False, True, 0)
 
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",
559
 
                    lambda w, r: self.set_revision(
560
 
                        self._repository.get_revision(r)), revid)
 
562
                    lambda w, r: self.set_revision(self._repository.get_revision(r)), revid)
561
563
            button.set_use_underline(False)
562
 
            hbox.pack_start(button, True, True, 0)
 
564
            hbox.pack_start(button, expand=True, fill=True)
563
565
            button.show_all()
564
566
 
565
567
    def _create_general(self):
566
 
        vbox = Gtk.VBox(homogeneous=False, spacing=6)
 
568
        vbox = gtk.VBox(False, 6)
567
569
        vbox.set_border_width(6)
568
 
        vbox.pack_start(self._create_headers(), False, True, 0)
569
 
        vbox.pack_start(self._create_message_view(), True, True, 0)
570
 
        self.append_page(vbox, 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"))
571
573
        vbox.show()
572
574
 
573
575
    def _create_relations(self):
574
 
        vbox = Gtk.VBox(homogeneous=False, spacing=6)
 
576
        vbox = gtk.VBox(False, 6)
575
577
        vbox.set_border_width(6)
576
 
        vbox.pack_start(self._create_parents(), False, True, 0)
577
 
        vbox.pack_start(self._create_children(), False, True, 0)
578
 
        self.append_page(vbox, 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"))
579
581
        vbox.show()
580
582
 
581
583
    def _create_signature(self):
582
584
        self.signature_table = SignatureTab(self._repository)
583
 
        self.append_page(
584
 
            self.signature_table, Gtk.Label(label='Signature'))
 
585
        self.append_page(self.signature_table, tab_label=gtk.Label('Signature'))
585
586
        self.connect_after('notify::revision', self._update_signature)
586
587
 
587
588
    def _create_headers(self):
588
589
        self.avatarsbox = AvatarsBox()
589
590
        
590
 
        self.table = Gtk.Table(rows=5, columns=2)
 
591
        self.table = gtk.Table(rows=5, columns=2)
591
592
        self.table.set_row_spacings(6)
592
593
        self.table.set_col_spacings(6)
593
594
        self.table.show()
594
595
        
595
 
        self.avatarsbox.pack_start(self.table, True, True, 0)
 
596
        self.avatarsbox.pack_start(self.table)
596
597
        self.avatarsbox.show()
597
598
 
598
599
        row = 0
599
600
 
600
 
        label = Gtk.Label()
 
601
        label = gtk.Label()
601
602
        label.set_alignment(1.0, 0.5)
602
603
        label.set_markup("<b>Revision Id:</b>")
603
 
        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)
604
605
        label.show()
605
606
 
606
 
        revision_id = Gtk.Label()
607
 
        revision_id.set_ellipsize(Pango.EllipsizeMode.MIDDLE)
 
607
        revision_id = gtk.Label()
 
608
        revision_id.set_ellipsize(pango.ELLIPSIZE_MIDDLE)
608
609
        revision_id.set_alignment(0.0, 0.5)
609
610
        revision_id.set_selectable(True)
610
611
        self.connect('notify::revision', 
611
612
                lambda w, p: revision_id.set_text(self._revision.revision_id))
612
 
        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)
613
614
        revision_id.show()
614
615
 
615
616
        row += 1
616
 
        self.author_label = Gtk.Label()
 
617
        self.author_label = gtk.Label()
617
618
        self.author_label.set_alignment(1.0, 0.5)
618
619
        self.author_label.set_markup("<b>Author:</b>")
619
 
        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)
620
621
        self.author_label.show()
621
622
 
622
 
        self.author = Gtk.Label()
623
 
        self.author.set_ellipsize(Pango.EllipsizeMode.END)
 
623
        self.author = gtk.Label()
 
624
        self.author.set_ellipsize(pango.ELLIPSIZE_END)
624
625
        self.author.set_alignment(0.0, 0.5)
625
626
        self.author.set_selectable(True)
626
 
        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)
627
628
        self.author.show()
628
629
        self.author.hide()
629
630
 
630
631
        row += 1
631
 
        label = Gtk.Label()
 
632
        label = gtk.Label()
632
633
        label.set_alignment(1.0, 0.5)
633
634
        label.set_markup("<b>Committer:</b>")
634
 
        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)
635
636
        label.show()
636
637
 
637
 
        self.committer = Gtk.Label()
638
 
        self.committer.set_ellipsize(Pango.EllipsizeMode.END)
 
638
        self.committer = gtk.Label()
 
639
        self.committer.set_ellipsize(pango.ELLIPSIZE_END)
639
640
        self.committer.set_alignment(0.0, 0.5)
640
641
        self.committer.set_selectable(True)
641
 
        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)
642
643
        self.committer.show()
643
644
 
644
645
        row += 1
645
 
        self.branchnick_label = Gtk.Label()
 
646
        self.branchnick_label = gtk.Label()
646
647
        self.branchnick_label.set_alignment(1.0, 0.5)
647
648
        self.branchnick_label.set_markup("<b>Branch nick:</b>")
648
 
        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)
649
650
        self.branchnick_label.show()
650
651
 
651
 
        self.branchnick = Gtk.Label()
652
 
        self.branchnick.set_ellipsize(Pango.EllipsizeMode.MIDDLE)
 
652
        self.branchnick = gtk.Label()
 
653
        self.branchnick.set_ellipsize(pango.ELLIPSIZE_MIDDLE)
653
654
        self.branchnick.set_alignment(0.0, 0.5)
654
655
        self.branchnick.set_selectable(True)
655
 
        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)
656
657
        self.branchnick.show()
657
658
 
658
659
        row += 1
659
 
        label = Gtk.Label()
 
660
        label = gtk.Label()
660
661
        label.set_alignment(1.0, 0.5)
661
662
        label.set_markup("<b>Timestamp:</b>")
662
 
        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)
663
664
        label.show()
664
665
 
665
 
        self.timestamp = Gtk.Label()
666
 
        self.timestamp.set_ellipsize(Pango.EllipsizeMode.END)
 
666
        self.timestamp = gtk.Label()
 
667
        self.timestamp.set_ellipsize(pango.ELLIPSIZE_END)
667
668
        self.timestamp.set_alignment(0.0, 0.5)
668
669
        self.timestamp.set_selectable(True)
669
 
        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)
670
671
        self.timestamp.show()
671
672
 
672
673
        row += 1
673
 
        self.tags_label = Gtk.Label()
 
674
        self.tags_label = gtk.Label()
674
675
        self.tags_label.set_alignment(1.0, 0.5)
675
676
        self.tags_label.set_markup("<b>Tags:</b>")
676
 
        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)
677
678
        self.tags_label.show()
678
679
 
679
 
        self.tags_list = Gtk.Label()
680
 
        self.tags_list.set_ellipsize(Pango.EllipsizeMode.MIDDLE)
 
680
        self.tags_list = gtk.Label()
 
681
        self.tags_list.set_ellipsize(pango.ELLIPSIZE_MIDDLE)
681
682
        self.tags_list.set_alignment(0.0, 0.5)
682
 
        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)
683
684
        self.tags_list.show()
684
685
 
685
686
        self.connect('notify::revision', self._add_tags)
686
687
 
 
688
        self.avatarsbox.show()
687
689
        return self.avatarsbox
688
690
    
689
691
    def _create_parents(self):
690
 
        hbox = Gtk.HBox(homogeneous=True, spacing=3)
 
692
        hbox = gtk.HBox(True, 3)
691
693
        
692
694
        self.parents_table = self._create_parents_or_children_table(
693
695
            "<b>Parents:</b>")
694
696
        self.parents_widgets = []
695
 
        hbox.pack_start(self.parents_table, True, True, 0)
 
697
        hbox.pack_start(self.parents_table)
696
698
 
697
699
        hbox.show()
698
700
        return hbox
699
701
 
700
702
    def _create_children(self):
701
 
        hbox = Gtk.HBox(homogeneous=True, spacing=3)
 
703
        hbox = gtk.HBox(True, 3)
702
704
        self.children_table = self._create_parents_or_children_table(
703
705
            "<b>Children:</b>")
704
706
        self.children_widgets = []
705
 
        hbox.pack_start(self.children_table, True, True, 0)
 
707
        hbox.pack_start(self.children_table)
706
708
        hbox.show()
707
709
        return hbox
708
710
        
709
711
    def _create_parents_or_children_table(self, text):
710
 
        table = Gtk.Table(rows=1, columns=2)
 
712
        table = gtk.Table(rows=1, columns=2)
711
713
        table.set_row_spacings(3)
712
714
        table.set_col_spacings(6)
713
715
        table.show()
714
716
 
715
 
        label = Gtk.Label()
 
717
        label = gtk.Label()
716
718
        label.set_markup(text)
717
 
        align = Gtk.Alignment.new(0.0, 0.5, 0, 0)
 
719
        align = gtk.Alignment(0.0, 0.5)
718
720
        align.add(label)
719
 
        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)
720
722
        label.show()
721
723
        align.show()
722
724
 
723
725
        return table
724
726
 
725
727
    def _create_message_view(self):
726
 
        msg_buffer = Gtk.TextBuffer()
 
728
        msg_buffer = gtk.TextBuffer()
727
729
        self.connect('notify::revision',
728
730
                lambda w, p: msg_buffer.set_text(self._revision.message))
729
 
        window = Gtk.ScrolledWindow()
730
 
        window.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC)
731
 
        window.set_shadow_type(Gtk.ShadowType.IN)
732
 
        tv = Gtk.TextView(buffer=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)
733
735
        tv.set_editable(False)
734
 
        tv.set_wrap_mode(Gtk.WrapMode.WORD)
 
736
        tv.set_wrap_mode(gtk.WRAP_WORD)
735
737
 
736
 
        tv.modify_font(Pango.FontDescription("Monospace"))
 
738
        tv.modify_font(pango.FontDescription("Monospace"))
737
739
        tv.show()
738
740
        window.add(tv)
739
741
        window.show()
742
744
    def _create_bugs(self):
743
745
        self.bugs_page = BugsTab()
744
746
        self.connect_after('notify::revision', self._update_bugs) 
745
 
        self.append_page(self.bugs_page, Gtk.Label(label='Bugs'))
 
747
        self.append_page(self.bugs_page, tab_label=gtk.Label('Bugs'))
746
748
 
747
749
    def _create_file_info_view(self):
748
 
        self.file_info_box = Gtk.VBox(homogeneous=False, spacing=6)
 
750
        self.file_info_box = gtk.VBox(False, 6)
749
751
        self.file_info_box.set_border_width(6)
750
 
        self.file_info_buffer = Gtk.TextBuffer()
751
 
        window = Gtk.ScrolledWindow()
752
 
        window.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC)
753
 
        window.set_shadow_type(Gtk.ShadowType.IN)
754
 
        tv = Gtk.TextView(buffer=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)
755
757
        tv.set_editable(False)
756
 
        tv.set_wrap_mode(Gtk.WrapMode.WORD)
757
 
        tv.modify_font(Pango.FontDescription("Monospace"))
 
758
        tv.set_wrap_mode(gtk.WRAP_WORD)
 
759
        tv.modify_font(pango.FontDescription("Monospace"))
758
760
        tv.show()
759
761
        window.add(tv)
760
762
        window.show()
761
 
        self.file_info_box.pack_start(window, True, True, 0)
 
763
        self.file_info_box.pack_start(window)
762
764
        self.file_info_box.hide() # Only shown when there are per-file messages
763
 
        self.append_page(self.file_info_box, Gtk.Label(label='Per-file'))
 
765
        self.append_page(self.file_info_box, tab_label=gtk.Label('Per-file'))
764
766