/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 viz/diffwin.py

  • Committer: Aaron Bentley
  • Date: 2006-09-18 13:49:47 UTC
  • mfrom: (81 bzr-gtk)
  • mto: (66.6.5 gtk)
  • mto: This revision was merged to the branch mainline in revision 112.
  • Revision ID: abentley@panoramicfeedback.com-20060918134947-0c9ad79a67b1765f
MergeĀ fromĀ upstream

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
 
15
15
import gtk
16
16
import pango
 
17
import sys
17
18
 
18
19
try:
19
20
    import gtksourceview
21
22
except ImportError:
22
23
    have_gtksourceview = False
23
24
 
24
 
from bzrlib.delta import compare_trees
 
25
import bzrlib
 
26
 
25
27
from bzrlib.diff import show_diff_trees
26
28
from bzrlib.errors import NoSuchFile
27
29
 
49
51
 
50
52
    def construct(self):
51
53
        """Construct the window contents."""
52
 
        hbox = gtk.HBox(spacing=6)
53
 
        hbox.set_border_width(0)
54
 
        self.add(hbox)
55
 
        hbox.show()
 
54
        # The   window  consists  of   a  pane   containing:  the
 
55
        # hierarchical list  of files on  the left, and  the diff
 
56
        # for the currently selected file on the right.
 
57
        pane = gtk.HPaned()
 
58
        self.add(pane)
 
59
        pane.show()
56
60
 
 
61
        # The file hierarchy: a scrollable treeview
57
62
        scrollwin = gtk.ScrolledWindow()
58
63
        scrollwin.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)
59
64
        scrollwin.set_shadow_type(gtk.SHADOW_IN)
60
 
        hbox.pack_start(scrollwin, expand=False, fill=True)
 
65
        pane.pack1(scrollwin)
61
66
        scrollwin.show()
62
67
 
63
68
        self.model = gtk.TreeStore(str, str)
75
80
        column.add_attribute(cell, "text", 0)
76
81
        self.treeview.append_column(column)
77
82
 
78
 
 
 
83
        # The diffs of the  selected file: a scrollable source or
 
84
        # text view
79
85
        scrollwin = gtk.ScrolledWindow()
80
86
        scrollwin.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
81
87
        scrollwin.set_shadow_type(gtk.SHADOW_IN)
82
 
        hbox.pack_start(scrollwin, expand=True, fill=True)
 
88
        pane.pack2(scrollwin)
83
89
        scrollwin.show()
84
90
 
85
91
        if have_gtksourceview:
109
115
        self.parent_tree = parent_tree
110
116
 
111
117
        self.model.clear()
112
 
        delta = compare_trees(self.parent_tree, self.rev_tree)
 
118
        delta = self.rev_tree.changes_from(self.parent_tree)
113
119
 
114
120
        self.model.append(None, [ "Complete Diff", "" ])
115
121
 
160
166
 
161
167
        s = StringIO()
162
168
        show_diff_trees(self.parent_tree, self.rev_tree, s, specific_files)
163
 
        self.buffer.set_text(s.getvalue())
 
169
        self.buffer.set_text(s.getvalue().decode(sys.getdefaultencoding(), 'replace'))