/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: 2010-05-25 17:09:02 UTC
  • mto: This revision was merged to the branch mainline in revision 691.
  • Revision ID: jelmer@samba.org-20100525170902-3to8g5iw7ovw79kh
Split out olive into a separate directory.

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