/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:
22
22
import gobject
23
23
import webbrowser
24
24
 
 
25
from bzrlib import trace
25
26
from bzrlib.osutils import format_date
26
 
from bzrlib.util.bencode import bdecode
 
27
try:
 
28
    from bzrlib.bencode import bdecode
 
29
except ImportError:
 
30
    from bzrlib.util.bencode import bdecode
27
31
from bzrlib.testament import Testament
28
32
 
29
33
from bzrlib.plugins.gtk import icon_path
47
51
            webbrowser._tryorder.insert(0, '%s "%%s"' % cmd)
48
52
    webbrowser.open(uri)
49
53
 
50
 
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)
51
57
 
52
58
class BugsTab(gtk.VBox):
53
59
 
54
60
    def __init__(self):
55
61
        super(BugsTab, self).__init__(False, 6)
56
 
    
 
62
 
57
63
        table = gtk.Table(rows=2, columns=2)
58
64
 
59
65
        table.set_row_spacings(6)
415
421
            self.timestamp.set_text(format_date(revision.timestamp,
416
422
                                                revision.timezone))
417
423
        try:
418
 
            self.branchnick_label.set_text(revision.properties['branch-nick'])
 
424
            self.branchnick.show()
 
425
            self.branchnick_label.show()
 
426
            self.branchnick.set_text(revision.properties['branch-nick'])
419
427
        except KeyError:
420
 
            self.branchnick_label.set_text("")
 
428
            self.branchnick.hide()
 
429
            self.branchnick_label.hide()
421
430
 
422
431
        self._add_parents_or_children(revision.parent_ids,
423
432
                                      self.parents_widgets,
424
433
                                      self.parents_table)
425
 
        
 
434
 
426
435
        file_info = revision.properties.get('file-info', None)
427
436
        if file_info is not None:
428
 
            file_info = bdecode(file_info.encode('UTF-8'))
 
437
            try:
 
438
                file_info = bdecode(file_info.encode('UTF-8'))
 
439
            except ValueError:
 
440
                trace.note('Invalid per-file info for revision:%s, value: %r',
 
441
                           revision.revision_id, file_info)
 
442
                file_info = None
429
443
 
430
444
        if file_info:
431
445
            if self._file_id is None:
617
631
        self.committer.show()
618
632
 
619
633
        row += 1
620
 
        label = gtk.Label()
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)
624
 
        label.show()
625
 
 
626
634
        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)
 
635
        self.branchnick_label.set_alignment(1.0, 0.5)
 
636
        self.branchnick_label.set_markup("<b>Branch nick:</b>")
 
637
        self.table.attach(self.branchnick_label, 0, 1, row, row+1, gtk.FILL, gtk.FILL)
631
638
        self.branchnick_label.show()
632
639
 
 
640
        self.branchnick = gtk.Label()
 
641
        self.branchnick.set_ellipsize(pango.ELLIPSIZE_MIDDLE)
 
642
        self.branchnick.set_alignment(0.0, 0.5)
 
643
        self.branchnick.set_selectable(True)
 
644
        self.table.attach(self.branchnick, 1, 2, row, row+1, gtk.EXPAND | gtk.FILL, gtk.FILL)
 
645
        self.branchnick.show()
 
646
 
633
647
        row += 1
634
648
        label = gtk.Label()
635
649
        label.set_alignment(1.0, 0.5)