/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-02-18 13:01:03 UTC
  • Revision ID: jelmer@samba.org-20110218130103-fiyk203auk28thpn
Remove some unused imports, fix some formatting.

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