/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: Jelmer Vernooij
  • Date: 2008-05-04 18:16:01 UTC
  • Revision ID: jelmer@samba.org-20080504181601-u5gh89q8l2we201l
Fix display of children in branchview.

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.plugins.gtk import icon_path
25
26
from bzrlib.osutils import format_date
26
27
from bzrlib.util.bencode import bdecode
27
 
from bzrlib.testament import Testament
28
 
 
29
 
from bzrlib.plugins.gtk import icon_path
30
28
 
31
29
try:
32
30
    from bzrlib.plugins.gtk import seahorse
40
38
PAGE_SIGNATURE = 2
41
39
PAGE_BUGS = 3
42
40
 
43
 
 
44
41
def _open_link(widget, uri):
45
 
    for cmd in ['sensible-browser', 'xdg-open']:
46
 
        if webbrowser._iscommand(cmd):
47
 
            webbrowser._tryorder.insert(0, '%s "%%s"' % cmd)
48
 
    webbrowser.open(uri)
 
42
    subprocess.Popen(['sensible-browser', uri], close_fds=True)
49
43
 
50
44
gtk.link_button_set_uri_hook(_open_link)
51
45
 
222
216
                                        "This revision has not been signed.")
223
217
 
224
218
    def show_signature(self, crypttext):
225
 
        (cleartext, key) = seahorse.verify(crypttext)
226
 
 
227
 
        assert cleartext is not None
228
 
 
229
 
        inv = self.repository.get_inventory(self.revision.revision_id)
230
 
        expected_testament = Testament(self.revision, inv).as_short_text()
231
 
        if expected_testament != cleartext:
232
 
            self.signature_image.set_from_file(icon_path("sign-bad.png"))
233
 
            self.signature_label.set_markup("<b>Signature does not match repository data</b>\n" +
234
 
                        "The signature plaintext is different from the expected testament plaintext.")
235
 
            return
 
219
        key = seahorse.verify(crypttext)
236
220
 
237
221
        if key and key.is_available():
238
222
            if key.is_trusted():
333
317
 
334
318
        self._create_general()
335
319
        self._create_relations()
336
 
        # Disabled because testaments aren't verified yet:
337
320
        if has_seahorse:
338
321
            self._create_signature()
339
322
        self._create_file_info_view()
509
492
        table.resize(max(len(revids), 1), 2)
510
493
 
511
494
        for idx, revid in enumerate(revids):
512
 
            align = gtk.Alignment(0.0, 0.0, 1, 1)
 
495
            align = gtk.Alignment(0.0, 0.0)
513
496
            widgets.append(align)
514
497
            table.attach(align, 1, 2, idx, idx + 1,
515
498
                                      gtk.EXPAND | gtk.FILL, gtk.FILL)
532
515
                hbox.pack_start(button, expand=False, fill=True)
533
516
                button.show()
534
517
 
535
 
            button = gtk.Button()
536
 
            revid_label = gtk.Label(str(revid))
537
 
            revid_label.set_ellipsize(pango.ELLIPSIZE_MIDDLE)
538
 
            revid_label.set_alignment(0.0, 0.5)
539
 
            button.add(revid_label)
 
518
            button = gtk.Button(revid)
540
519
            button.connect("clicked",
541
520
                    lambda w, r: self.set_revision(self._repository.get_revision(r)), revid)
542
521
            button.set_use_underline(False)
543
 
            hbox.pack_start(button, expand=True, fill=True)
544
 
            button.show_all()
 
522
            hbox.pack_start(button, expand=False, fill=True)
 
523
            button.show()
545
524
 
546
525
    def _create_general(self):
547
526
        vbox = gtk.VBox(False, 6)
570
549
        self.table.set_col_spacings(6)
571
550
        self.table.show()
572
551
 
573
 
        row = 0
574
 
 
 
552
        align = gtk.Alignment(1.0, 0.5)
575
553
        label = gtk.Label()
576
 
        label.set_alignment(1.0, 0.5)
577
554
        label.set_markup("<b>Revision Id:</b>")
578
 
        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()
579
558
        label.show()
580
559
 
 
560
        align = gtk.Alignment(0.0, 0.5)
581
561
        revision_id = gtk.Label()
582
 
        revision_id.set_ellipsize(pango.ELLIPSIZE_MIDDLE)
583
 
        revision_id.set_alignment(0.0, 0.5)
584
562
        revision_id.set_selectable(True)
585
563
        self.connect('notify::revision', 
586
564
                lambda w, p: revision_id.set_text(self._revision.revision_id))
587
 
        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()
588
568
        revision_id.show()
589
569
 
590
 
        row += 1
 
570
        align = gtk.Alignment(1.0, 0.5)
591
571
        self.author_label = gtk.Label()
592
 
        self.author_label.set_alignment(1.0, 0.5)
593
572
        self.author_label.set_markup("<b>Author:</b>")
594
 
        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()
595
576
        self.author_label.show()
596
577
 
 
578
        align = gtk.Alignment(0.0, 0.5)
597
579
        self.author = gtk.Label()
598
 
        self.author.set_ellipsize(pango.ELLIPSIZE_END)
599
 
        self.author.set_alignment(0.0, 0.5)
600
580
        self.author.set_selectable(True)
601
 
        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()
602
584
        self.author.show()
603
585
        self.author.hide()
604
586
 
605
 
        row += 1
 
587
        align = gtk.Alignment(1.0, 0.5)
606
588
        label = gtk.Label()
607
 
        label.set_alignment(1.0, 0.5)
608
589
        label.set_markup("<b>Committer:</b>")
609
 
        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()
610
593
        label.show()
611
594
 
 
595
        align = gtk.Alignment(0.0, 0.5)
612
596
        self.committer = gtk.Label()
613
 
        self.committer.set_ellipsize(pango.ELLIPSIZE_END)
614
 
        self.committer.set_alignment(0.0, 0.5)
615
597
        self.committer.set_selectable(True)
616
 
        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()
617
601
        self.committer.show()
618
602
 
619
 
        row += 1
 
603
        align = gtk.Alignment(0.0, 0.5)
620
604
        label = gtk.Label()
621
 
        label.set_alignment(1.0, 0.5)
622
605
        label.set_markup("<b>Branch nick:</b>")
623
 
        self.table.attach(label, 0, 1, row, row+1, gtk.FILL, gtk.FILL)
 
606
        align.add(label)
 
607
        self.table.attach(align, 0, 1, 3, 4, gtk.FILL, gtk.FILL)
624
608
        label.show()
 
609
        align.show()
625
610
 
 
611
        align = gtk.Alignment(0.0, 0.5)
626
612
        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
613
        self.branchnick_label.set_selectable(True)
630
 
        self.table.attach(self.branchnick_label, 1, 2, row, row+1, gtk.EXPAND | gtk.FILL, gtk.FILL)
 
614
        align.add(self.branchnick_label)
 
615
        self.table.attach(align, 1, 2, 3, 4, gtk.EXPAND | gtk.FILL, gtk.FILL)
631
616
        self.branchnick_label.show()
 
617
        align.show()
632
618
 
633
 
        row += 1
 
619
        align = gtk.Alignment(1.0, 0.5)
634
620
        label = gtk.Label()
635
 
        label.set_alignment(1.0, 0.5)
636
621
        label.set_markup("<b>Timestamp:</b>")
637
 
        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()
638
625
        label.show()
639
626
 
 
627
        align = gtk.Alignment(0.0, 0.5)
640
628
        self.timestamp = gtk.Label()
641
 
        self.timestamp.set_ellipsize(pango.ELLIPSIZE_END)
642
 
        self.timestamp.set_alignment(0.0, 0.5)
643
629
        self.timestamp.set_selectable(True)
644
 
        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()
645
633
        self.timestamp.show()
646
634
 
647
 
        row += 1
 
635
        align = gtk.Alignment(1.0, 0.5)
648
636
        self.tags_label = gtk.Label()
649
 
        self.tags_label.set_alignment(1.0, 0.5)
650
637
        self.tags_label.set_markup("<b>Tags:</b>")
651
 
        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)
652
641
        self.tags_label.show()
653
642
 
 
643
        align = gtk.Alignment(0.0, 0.5)
654
644
        self.tags_list = gtk.Label()
655
 
        self.tags_list.set_ellipsize(pango.ELLIPSIZE_MIDDLE)
656
 
        self.tags_list.set_alignment(0.0, 0.5)
657
 
        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()
658
648
        self.tags_list.show()
659
649
 
660
650
        self.connect('notify::revision', self._add_tags)