/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: zedtux
  • Date: 2011-03-15 16:50:15 UTC
  • mto: This revision was merged to the branch mainline in revision 723.
  • Revision ID: zedtux@zedroot.org-20110315165015-dc8r4yoqhkmfrye3
Moved AvatarDownloaderWorker class into avatarsbox.py file

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