25
from bzrlib import trace
25
26
from bzrlib.osutils import format_date
26
from bzrlib.util.bencode import bdecode
28
from bzrlib.bencode import bdecode
30
from bzrlib.util.bencode import bdecode
27
31
from bzrlib.testament import Testament
29
33
from bzrlib.plugins.gtk import icon_path
35
from bzrlib.plugins.gtk.avatarsbox import AvatarsBox
32
38
from bzrlib.plugins.gtk import seahorse
33
39
except ImportError:
47
53
webbrowser._tryorder.insert(0, '%s "%%s"' % cmd)
48
54
webbrowser.open(uri)
50
gtk.link_button_set_uri_hook(_open_link)
56
if getattr(gtk, 'link_button_set_uri_hook', None) is not None:
57
# Not available before PyGtk-2.10
58
gtk.link_button_set_uri_hook(_open_link)
52
60
class BugsTab(gtk.VBox):
54
62
def __init__(self):
55
63
super(BugsTab, self).__init__(False, 6)
57
65
table = gtk.Table(rows=2, columns=2)
59
67
table.set_row_spacings(6)
397
405
def _set_revision(self, revision):
398
406
if revision is None: return
408
self.avatarsbox.reset()
400
410
self._revision = revision
401
411
if revision.committer is not None:
402
412
self.committer.set_text(revision.committer)
413
self.avatarsbox.add(revision.committer, "committer")
404
415
self.committer.set_text("")
416
self.avatarsbox.hide()
405
417
author = revision.properties.get('author', '')
418
self.avatarsbox.merge(revision.get_apparent_authors(), "author")
407
420
self.author.set_text(author)
408
421
self.author.show()
415
428
self.timestamp.set_text(format_date(revision.timestamp,
416
429
revision.timezone))
418
self.branchnick_label.set_text(revision.properties['branch-nick'])
431
self.branchnick.show()
432
self.branchnick_label.show()
433
self.branchnick.set_text(revision.properties['branch-nick'])
420
self.branchnick_label.set_text("")
435
self.branchnick.hide()
436
self.branchnick_label.hide()
422
438
self._add_parents_or_children(revision.parent_ids,
423
439
self.parents_widgets,
424
440
self.parents_table)
426
442
file_info = revision.properties.get('file-info', None)
427
443
if file_info is not None:
428
file_info = bdecode(file_info.encode('UTF-8'))
445
file_info = bdecode(file_info.encode('UTF-8'))
447
trace.note('Invalid per-file info for revision:%s, value: %r',
448
revision.revision_id, file_info)
431
452
if self._file_id is None:
565
586
self.connect_after('notify::revision', self._update_signature)
567
588
def _create_headers(self):
589
self.avatarsbox = AvatarsBox()
568
591
self.table = gtk.Table(rows=5, columns=2)
569
592
self.table.set_row_spacings(6)
570
593
self.table.set_col_spacings(6)
571
594
self.table.show()
596
self.avatarsbox.pack_start(self.table)
597
self.avatarsbox.show()
617
643
self.committer.show()
621
label.set_alignment(1.0, 0.5)
622
label.set_markup("<b>Branch nick:</b>")
623
self.table.attach(label, 0, 1, row, row+1, gtk.FILL, gtk.FILL)
626
646
self.branchnick_label = gtk.Label()
627
self.branchnick_label.set_ellipsize(pango.ELLIPSIZE_MIDDLE)
628
self.branchnick_label.set_alignment(0.0, 0.5)
629
self.branchnick_label.set_selectable(True)
630
self.table.attach(self.branchnick_label, 1, 2, row, row+1, gtk.EXPAND | gtk.FILL, gtk.FILL)
647
self.branchnick_label.set_alignment(1.0, 0.5)
648
self.branchnick_label.set_markup("<b>Branch nick:</b>")
649
self.table.attach(self.branchnick_label, 0, 1, row, row+1, gtk.FILL, gtk.FILL)
631
650
self.branchnick_label.show()
652
self.branchnick = gtk.Label()
653
self.branchnick.set_ellipsize(pango.ELLIPSIZE_MIDDLE)
654
self.branchnick.set_alignment(0.0, 0.5)
655
self.branchnick.set_selectable(True)
656
self.table.attach(self.branchnick, 1, 2, row, row+1, gtk.EXPAND | gtk.FILL, gtk.FILL)
657
self.branchnick.show()
634
660
label = gtk.Label()
635
661
label.set_alignment(1.0, 0.5)