/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: David Planella
  • Date: 2011-03-06 08:24:07 UTC
  • mfrom: (718 trunk)
  • mto: This revision was merged to the branch mainline in revision 719.
  • Revision ID: david.planella@ubuntu.com-20110306082407-y9zwkjje5oue9egw
Added preliminary internationalization support. Merged from trunk.

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