/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: Vincent Ladeuil
  • Date: 2008-05-05 18:16:46 UTC
  • mto: (487.1.1 gtk)
  • mto: This revision was merged to the branch mainline in revision 490.
  • Revision ID: v.ladeuil+lp@free.fr-20080505181646-n95l8ltw2u6jtr26
Fix bug #187283 fix replacing _() by _i18n().

* genpot.sh 
Remove duplication. Add the ability to specify the genrated pot
file on command-line for debugging purposes.

* po/olive-gtk.pot:
Regenerated.

* __init__.py, branch.py, branchview/treeview.py, checkout.py,
commit.py, conflicts.py, diff.py, errors.py, initialize.py,
merge.py, nautilus-bzr.py, olive/__init__.py, olive/add.py,
olive/bookmark.py, olive/guifiles.py, olive/info.py,
olive/menu.py, olive/mkdir.py, olive/move.py, olive/remove.py,
olive/rename.py, push.py, revbrowser.py, status.py, tags.py:
Replace all calls to _() by calls to _i18n(), the latter being
defined in __init__.py and imported in the other modules from
there. This fix the problem encountered countless times when
running bzr selftest and getting silly error messages about
boolean not being callables.

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
import gtk
21
21
import pango
22
22
import gobject
23
 
import webbrowser
 
23
import subprocess
24
24
 
25
 
from bzrlib import trace
 
25
from bzrlib.plugins.gtk import icon_path
26
26
from bzrlib.osutils import format_date
27
 
try:
28
 
    from bzrlib.bencode import bdecode
29
 
except ImportError:
30
 
    from bzrlib.util.bencode import bdecode
31
 
from bzrlib.testament import Testament
32
 
 
33
 
from bzrlib.plugins.gtk import icon_path
 
27
from bzrlib.util.bencode import bdecode
34
28
 
35
29
try:
36
30
    from bzrlib.plugins.gtk import seahorse
44
38
PAGE_SIGNATURE = 2
45
39
PAGE_BUGS = 3
46
40
 
47
 
 
48
41
def _open_link(widget, uri):
49
 
    for cmd in ['sensible-browser', 'xdg-open']:
50
 
        if webbrowser._iscommand(cmd):
51
 
            webbrowser._tryorder.insert(0, '%s "%%s"' % cmd)
52
 
    webbrowser.open(uri)
 
42
    subprocess.Popen(['sensible-browser', uri], close_fds=True)
53
43
 
54
44
gtk.link_button_set_uri_hook(_open_link)
55
45
 
226
216
                                        "This revision has not been signed.")
227
217
 
228
218
    def show_signature(self, crypttext):
229
 
        (cleartext, key) = seahorse.verify(crypttext)
230
 
 
231
 
        assert cleartext is not None
232
 
 
233
 
        inv = self.repository.get_inventory(self.revision.revision_id)
234
 
        expected_testament = Testament(self.revision, inv).as_short_text()
235
 
        if expected_testament != cleartext:
236
 
            self.signature_image.set_from_file(icon_path("sign-bad.png"))
237
 
            self.signature_label.set_markup("<b>Signature does not match repository data</b>\n" +
238
 
                        "The signature plaintext is different from the expected testament plaintext.")
239
 
            return
 
219
        key = seahorse.verify(crypttext)
240
220
 
241
221
        if key and key.is_available():
242
222
            if key.is_trusted():
337
317
 
338
318
        self._create_general()
339
319
        self._create_relations()
340
 
        # Disabled because testaments aren't verified yet:
341
320
        if has_seahorse:
342
321
            self._create_signature()
343
322
        self._create_file_info_view()
419
398
            self.timestamp.set_text(format_date(revision.timestamp,
420
399
                                                revision.timezone))
421
400
        try:
422
 
            self.branchnick.show()
423
 
            self.branchnick_label.show()
424
 
            self.branchnick.set_text(revision.properties['branch-nick'])
 
401
            self.branchnick_label.set_text(revision.properties['branch-nick'])
425
402
        except KeyError:
426
 
            self.branchnick.hide()
427
 
            self.branchnick_label.hide()
 
403
            self.branchnick_label.set_text("")
428
404
 
429
405
        self._add_parents_or_children(revision.parent_ids,
430
406
                                      self.parents_widgets,
431
407
                                      self.parents_table)
432
 
 
 
408
        
433
409
        file_info = revision.properties.get('file-info', None)
434
410
        if file_info is not None:
435
 
            try:
436
 
                file_info = bdecode(file_info.encode('UTF-8'))
437
 
            except ValueError:
438
 
                trace.note('Invalid per-file info for revision:%s, value: %r',
439
 
                           revision.revision_id, file_info)
440
 
                file_info = None
 
411
            file_info = bdecode(file_info.encode('UTF-8'))
441
412
 
442
413
        if file_info:
443
414
            if self._file_id is None:
521
492
        table.resize(max(len(revids), 1), 2)
522
493
 
523
494
        for idx, revid in enumerate(revids):
524
 
            align = gtk.Alignment(0.0, 0.0, 1, 1)
 
495
            align = gtk.Alignment(0.0, 0.0)
525
496
            widgets.append(align)
526
497
            table.attach(align, 1, 2, idx, idx + 1,
527
498
                                      gtk.EXPAND | gtk.FILL, gtk.FILL)
544
515
                hbox.pack_start(button, expand=False, fill=True)
545
516
                button.show()
546
517
 
547
 
            button = gtk.Button()
548
 
            revid_label = gtk.Label(str(revid))
549
 
            revid_label.set_ellipsize(pango.ELLIPSIZE_MIDDLE)
550
 
            revid_label.set_alignment(0.0, 0.5)
551
 
            button.add(revid_label)
 
518
            button = gtk.Button(revid)
552
519
            button.connect("clicked",
553
520
                    lambda w, r: self.set_revision(self._repository.get_revision(r)), revid)
554
521
            button.set_use_underline(False)
555
 
            hbox.pack_start(button, expand=True, fill=True)
556
 
            button.show_all()
 
522
            hbox.pack_start(button, expand=False, fill=True)
 
523
            button.show()
557
524
 
558
525
    def _create_general(self):
559
526
        vbox = gtk.VBox(False, 6)
582
549
        self.table.set_col_spacings(6)
583
550
        self.table.show()
584
551
 
585
 
        row = 0
586
 
 
 
552
        align = gtk.Alignment(1.0, 0.5)
587
553
        label = gtk.Label()
588
 
        label.set_alignment(1.0, 0.5)
589
554
        label.set_markup("<b>Revision Id:</b>")
590
 
        self.table.attach(label, 0, 1, row, row+1, gtk.FILL, gtk.FILL)
 
555
        align.add(label)
 
556
        self.table.attach(align, 0, 1, 0, 1, gtk.FILL, gtk.FILL)
 
557
        align.show()
591
558
        label.show()
592
559
 
 
560
        align = gtk.Alignment(0.0, 0.5)
593
561
        revision_id = gtk.Label()
594
 
        revision_id.set_ellipsize(pango.ELLIPSIZE_MIDDLE)
595
 
        revision_id.set_alignment(0.0, 0.5)
596
562
        revision_id.set_selectable(True)
597
563
        self.connect('notify::revision', 
598
564
                lambda w, p: revision_id.set_text(self._revision.revision_id))
599
 
        self.table.attach(revision_id, 1, 2, row, row+1, gtk.EXPAND | gtk.FILL, gtk.FILL)
 
565
        align.add(revision_id)
 
566
        self.table.attach(align, 1, 2, 0, 1, gtk.EXPAND | gtk.FILL, gtk.FILL)
 
567
        align.show()
600
568
        revision_id.show()
601
569
 
602
 
        row += 1
 
570
        align = gtk.Alignment(1.0, 0.5)
603
571
        self.author_label = gtk.Label()
604
 
        self.author_label.set_alignment(1.0, 0.5)
605
572
        self.author_label.set_markup("<b>Author:</b>")
606
 
        self.table.attach(self.author_label, 0, 1, row, row+1, gtk.FILL, gtk.FILL)
 
573
        align.add(self.author_label)
 
574
        self.table.attach(align, 0, 1, 1, 2, gtk.FILL, gtk.FILL)
 
575
        align.show()
607
576
        self.author_label.show()
608
577
 
 
578
        align = gtk.Alignment(0.0, 0.5)
609
579
        self.author = gtk.Label()
610
 
        self.author.set_ellipsize(pango.ELLIPSIZE_END)
611
 
        self.author.set_alignment(0.0, 0.5)
612
580
        self.author.set_selectable(True)
613
 
        self.table.attach(self.author, 1, 2, row, row+1, gtk.EXPAND | gtk.FILL, gtk.FILL)
 
581
        align.add(self.author)
 
582
        self.table.attach(align, 1, 2, 1, 2, gtk.EXPAND | gtk.FILL, gtk.FILL)
 
583
        align.show()
614
584
        self.author.show()
615
585
        self.author.hide()
616
586
 
617
 
        row += 1
 
587
        align = gtk.Alignment(1.0, 0.5)
618
588
        label = gtk.Label()
619
 
        label.set_alignment(1.0, 0.5)
620
589
        label.set_markup("<b>Committer:</b>")
621
 
        self.table.attach(label, 0, 1, row, row+1, gtk.FILL, gtk.FILL)
 
590
        align.add(label)
 
591
        self.table.attach(align, 0, 1, 2, 3, gtk.FILL, gtk.FILL)
 
592
        align.show()
622
593
        label.show()
623
594
 
 
595
        align = gtk.Alignment(0.0, 0.5)
624
596
        self.committer = gtk.Label()
625
 
        self.committer.set_ellipsize(pango.ELLIPSIZE_END)
626
 
        self.committer.set_alignment(0.0, 0.5)
627
597
        self.committer.set_selectable(True)
628
 
        self.table.attach(self.committer, 1, 2, row, row+1, gtk.EXPAND | gtk.FILL, gtk.FILL)
 
598
        align.add(self.committer)
 
599
        self.table.attach(align, 1, 2, 2, 3, gtk.EXPAND | gtk.FILL, gtk.FILL)
 
600
        align.show()
629
601
        self.committer.show()
630
602
 
631
 
        row += 1
 
603
        align = gtk.Alignment(0.0, 0.5)
 
604
        label = gtk.Label()
 
605
        label.set_markup("<b>Branch nick:</b>")
 
606
        align.add(label)
 
607
        self.table.attach(align, 0, 1, 3, 4, gtk.FILL, gtk.FILL)
 
608
        label.show()
 
609
        align.show()
 
610
 
 
611
        align = gtk.Alignment(0.0, 0.5)
632
612
        self.branchnick_label = gtk.Label()
633
 
        self.branchnick_label.set_alignment(1.0, 0.5)
634
 
        self.branchnick_label.set_markup("<b>Branch nick:</b>")
635
 
        self.table.attach(self.branchnick_label, 0, 1, row, row+1, gtk.FILL, gtk.FILL)
 
613
        self.branchnick_label.set_selectable(True)
 
614
        align.add(self.branchnick_label)
 
615
        self.table.attach(align, 1, 2, 3, 4, gtk.EXPAND | gtk.FILL, gtk.FILL)
636
616
        self.branchnick_label.show()
637
 
 
638
 
        self.branchnick = gtk.Label()
639
 
        self.branchnick.set_ellipsize(pango.ELLIPSIZE_MIDDLE)
640
 
        self.branchnick.set_alignment(0.0, 0.5)
641
 
        self.branchnick.set_selectable(True)
642
 
        self.table.attach(self.branchnick, 1, 2, row, row+1, gtk.EXPAND | gtk.FILL, gtk.FILL)
643
 
        self.branchnick.show()
644
 
 
645
 
        row += 1
 
617
        align.show()
 
618
 
 
619
        align = gtk.Alignment(1.0, 0.5)
646
620
        label = gtk.Label()
647
 
        label.set_alignment(1.0, 0.5)
648
621
        label.set_markup("<b>Timestamp:</b>")
649
 
        self.table.attach(label, 0, 1, row, row+1, gtk.FILL, gtk.FILL)
 
622
        align.add(label)
 
623
        self.table.attach(align, 0, 1, 4, 5, gtk.FILL, gtk.FILL)
 
624
        align.show()
650
625
        label.show()
651
626
 
 
627
        align = gtk.Alignment(0.0, 0.5)
652
628
        self.timestamp = gtk.Label()
653
 
        self.timestamp.set_ellipsize(pango.ELLIPSIZE_END)
654
 
        self.timestamp.set_alignment(0.0, 0.5)
655
629
        self.timestamp.set_selectable(True)
656
 
        self.table.attach(self.timestamp, 1, 2, row, row+1, gtk.EXPAND | gtk.FILL, gtk.FILL)
 
630
        align.add(self.timestamp)
 
631
        self.table.attach(align, 1, 2, 4, 5, gtk.EXPAND | gtk.FILL, gtk.FILL)
 
632
        align.show()
657
633
        self.timestamp.show()
658
634
 
659
 
        row += 1
 
635
        align = gtk.Alignment(1.0, 0.5)
660
636
        self.tags_label = gtk.Label()
661
 
        self.tags_label.set_alignment(1.0, 0.5)
662
637
        self.tags_label.set_markup("<b>Tags:</b>")
663
 
        self.table.attach(self.tags_label, 0, 1, row, row+1, gtk.FILL, gtk.FILL)
 
638
        align.add(self.tags_label)
 
639
        align.show()
 
640
        self.table.attach(align, 0, 1, 5, 6, gtk.FILL, gtk.FILL)
664
641
        self.tags_label.show()
665
642
 
 
643
        align = gtk.Alignment(0.0, 0.5)
666
644
        self.tags_list = gtk.Label()
667
 
        self.tags_list.set_ellipsize(pango.ELLIPSIZE_MIDDLE)
668
 
        self.tags_list.set_alignment(0.0, 0.5)
669
 
        self.table.attach(self.tags_list, 1, 2, row, row+1, gtk.EXPAND | gtk.FILL, gtk.FILL)
 
645
        align.add(self.tags_list)
 
646
        self.table.attach(align, 1, 2, 5, 6, gtk.EXPAND | gtk.FILL, gtk.FILL)
 
647
        align.show()
670
648
        self.tags_list.show()
671
649
 
672
650
        self.connect('notify::revision', self._add_tags)