/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: Russ Brown
  • Date: 2008-06-06 17:46:26 UTC
  • mto: This revision was merged to the branch mainline in revision 509.
  • Revision ID: pickscrape@gmail.com-20080606174626-vmwq97o813k7vvh6
Added Refresh menu option with keyboard shortcut to viz

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.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
 
 
41
webbrowser.register('sensible-browser', None, webbrowser.GenericBrowser('sensible-browser'), -1)
 
42
webbrowser.register('xdg-open', None, webbrowser.GenericBrowser('xdg-open'), -1)
43
43
 
44
44
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
45
    webbrowser.open(uri)
49
46
 
50
47
gtk.link_button_set_uri_hook(_open_link)
222
219
                                        "This revision has not been signed.")
223
220
 
224
221
    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
 
222
        key = seahorse.verify(crypttext)
236
223
 
237
224
        if key and key.is_available():
238
225
            if key.is_trusted():
334
321
        self._create_general()
335
322
        self._create_relations()
336
323
        # Disabled because testaments aren't verified yet:
337
 
        if has_seahorse:
338
 
            self._create_signature()
 
324
        # if has_seahorse:
 
325
        #    self._create_signature()
339
326
        self._create_file_info_view()
340
327
        self._create_bugs()
341
328
 
509
496
        table.resize(max(len(revids), 1), 2)
510
497
 
511
498
        for idx, revid in enumerate(revids):
512
 
            align = gtk.Alignment(0.0, 0.0, 1, 1)
 
499
            align = gtk.Alignment(0.0, 0.0)
513
500
            widgets.append(align)
514
501
            table.attach(align, 1, 2, idx, idx + 1,
515
502
                                      gtk.EXPAND | gtk.FILL, gtk.FILL)
532
519
                hbox.pack_start(button, expand=False, fill=True)
533
520
                button.show()
534
521
 
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)
 
522
            button = gtk.Button(revid)
540
523
            button.connect("clicked",
541
524
                    lambda w, r: self.set_revision(self._repository.get_revision(r)), revid)
542
525
            button.set_use_underline(False)
543
 
            hbox.pack_start(button, expand=True, fill=True)
544
 
            button.show_all()
 
526
            hbox.pack_start(button, expand=False, fill=True)
 
527
            button.show()
545
528
 
546
529
    def _create_general(self):
547
530
        vbox = gtk.VBox(False, 6)
570
553
        self.table.set_col_spacings(6)
571
554
        self.table.show()
572
555
 
573
 
        row = 0
574
 
 
 
556
        align = gtk.Alignment(1.0, 0.5)
575
557
        label = gtk.Label()
576
 
        label.set_alignment(1.0, 0.5)
577
558
        label.set_markup("<b>Revision Id:</b>")
578
 
        self.table.attach(label, 0, 1, row, row+1, gtk.FILL, gtk.FILL)
 
559
        align.add(label)
 
560
        self.table.attach(align, 0, 1, 0, 1, gtk.FILL, gtk.FILL)
 
561
        align.show()
579
562
        label.show()
580
563
 
 
564
        align = gtk.Alignment(0.0, 0.5)
581
565
        revision_id = gtk.Label()
582
 
        revision_id.set_ellipsize(pango.ELLIPSIZE_MIDDLE)
583
 
        revision_id.set_alignment(0.0, 0.5)
584
566
        revision_id.set_selectable(True)
585
567
        self.connect('notify::revision', 
586
568
                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)
 
569
        align.add(revision_id)
 
570
        self.table.attach(align, 1, 2, 0, 1, gtk.EXPAND | gtk.FILL, gtk.FILL)
 
571
        align.show()
588
572
        revision_id.show()
589
573
 
590
 
        row += 1
 
574
        align = gtk.Alignment(1.0, 0.5)
591
575
        self.author_label = gtk.Label()
592
 
        self.author_label.set_alignment(1.0, 0.5)
593
576
        self.author_label.set_markup("<b>Author:</b>")
594
 
        self.table.attach(self.author_label, 0, 1, row, row+1, gtk.FILL, gtk.FILL)
 
577
        align.add(self.author_label)
 
578
        self.table.attach(align, 0, 1, 1, 2, gtk.FILL, gtk.FILL)
 
579
        align.show()
595
580
        self.author_label.show()
596
581
 
 
582
        align = gtk.Alignment(0.0, 0.5)
597
583
        self.author = gtk.Label()
598
 
        self.author.set_ellipsize(pango.ELLIPSIZE_END)
599
 
        self.author.set_alignment(0.0, 0.5)
600
584
        self.author.set_selectable(True)
601
 
        self.table.attach(self.author, 1, 2, row, row+1, gtk.EXPAND | gtk.FILL, gtk.FILL)
 
585
        align.add(self.author)
 
586
        self.table.attach(align, 1, 2, 1, 2, gtk.EXPAND | gtk.FILL, gtk.FILL)
 
587
        align.show()
602
588
        self.author.show()
603
589
        self.author.hide()
604
590
 
605
 
        row += 1
 
591
        align = gtk.Alignment(1.0, 0.5)
606
592
        label = gtk.Label()
607
 
        label.set_alignment(1.0, 0.5)
608
593
        label.set_markup("<b>Committer:</b>")
609
 
        self.table.attach(label, 0, 1, row, row+1, gtk.FILL, gtk.FILL)
 
594
        align.add(label)
 
595
        self.table.attach(align, 0, 1, 2, 3, gtk.FILL, gtk.FILL)
 
596
        align.show()
610
597
        label.show()
611
598
 
 
599
        align = gtk.Alignment(0.0, 0.5)
612
600
        self.committer = gtk.Label()
613
 
        self.committer.set_ellipsize(pango.ELLIPSIZE_END)
614
 
        self.committer.set_alignment(0.0, 0.5)
615
601
        self.committer.set_selectable(True)
616
 
        self.table.attach(self.committer, 1, 2, row, row+1, gtk.EXPAND | gtk.FILL, gtk.FILL)
 
602
        align.add(self.committer)
 
603
        self.table.attach(align, 1, 2, 2, 3, gtk.EXPAND | gtk.FILL, gtk.FILL)
 
604
        align.show()
617
605
        self.committer.show()
618
606
 
619
 
        row += 1
 
607
        align = gtk.Alignment(0.0, 0.5)
620
608
        label = gtk.Label()
621
 
        label.set_alignment(1.0, 0.5)
622
609
        label.set_markup("<b>Branch nick:</b>")
623
 
        self.table.attach(label, 0, 1, row, row+1, gtk.FILL, gtk.FILL)
 
610
        align.add(label)
 
611
        self.table.attach(align, 0, 1, 3, 4, gtk.FILL, gtk.FILL)
624
612
        label.show()
 
613
        align.show()
625
614
 
 
615
        align = gtk.Alignment(0.0, 0.5)
626
616
        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
617
        self.branchnick_label.set_selectable(True)
630
 
        self.table.attach(self.branchnick_label, 1, 2, row, row+1, gtk.EXPAND | gtk.FILL, gtk.FILL)
 
618
        align.add(self.branchnick_label)
 
619
        self.table.attach(align, 1, 2, 3, 4, gtk.EXPAND | gtk.FILL, gtk.FILL)
631
620
        self.branchnick_label.show()
 
621
        align.show()
632
622
 
633
 
        row += 1
 
623
        align = gtk.Alignment(1.0, 0.5)
634
624
        label = gtk.Label()
635
 
        label.set_alignment(1.0, 0.5)
636
625
        label.set_markup("<b>Timestamp:</b>")
637
 
        self.table.attach(label, 0, 1, row, row+1, gtk.FILL, gtk.FILL)
 
626
        align.add(label)
 
627
        self.table.attach(align, 0, 1, 4, 5, gtk.FILL, gtk.FILL)
 
628
        align.show()
638
629
        label.show()
639
630
 
 
631
        align = gtk.Alignment(0.0, 0.5)
640
632
        self.timestamp = gtk.Label()
641
 
        self.timestamp.set_ellipsize(pango.ELLIPSIZE_END)
642
 
        self.timestamp.set_alignment(0.0, 0.5)
643
633
        self.timestamp.set_selectable(True)
644
 
        self.table.attach(self.timestamp, 1, 2, row, row+1, gtk.EXPAND | gtk.FILL, gtk.FILL)
 
634
        align.add(self.timestamp)
 
635
        self.table.attach(align, 1, 2, 4, 5, gtk.EXPAND | gtk.FILL, gtk.FILL)
 
636
        align.show()
645
637
        self.timestamp.show()
646
638
 
647
 
        row += 1
 
639
        align = gtk.Alignment(1.0, 0.5)
648
640
        self.tags_label = gtk.Label()
649
 
        self.tags_label.set_alignment(1.0, 0.5)
650
641
        self.tags_label.set_markup("<b>Tags:</b>")
651
 
        self.table.attach(self.tags_label, 0, 1, row, row+1, gtk.FILL, gtk.FILL)
 
642
        align.add(self.tags_label)
 
643
        align.show()
 
644
        self.table.attach(align, 0, 1, 5, 6, gtk.FILL, gtk.FILL)
652
645
        self.tags_label.show()
653
646
 
 
647
        align = gtk.Alignment(0.0, 0.5)
654
648
        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)
 
649
        align.add(self.tags_list)
 
650
        self.table.attach(align, 1, 2, 5, 6, gtk.EXPAND | gtk.FILL, gtk.FILL)
 
651
        align.show()
658
652
        self.tags_list.show()
659
653
 
660
654
        self.connect('notify::revision', self._add_tags)