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