/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: 2007-01-17 06:42:55 UTC
  • mto: This revision was merged to the branch mainline in revision 129.
  • Revision ID: aaron.bentley@utoronto.ca-20070117064255-x4gznz5e0lyjq3gk
Remove usused span selector

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
22
23
    have_gtksourceview = False
23
24
 
24
25
import bzrlib
25
 
if bzrlib.version_info < (0, 9):
26
 
    # function deprecated in 0.9
27
 
    from bzrlib.delta import compare_trees
28
26
 
29
27
from bzrlib.diff import show_diff_trees
30
28
from bzrlib.errors import NoSuchFile
53
51
 
54
52
    def construct(self):
55
53
        """Construct the window contents."""
56
 
        hbox = gtk.HBox(spacing=6)
57
 
        hbox.set_border_width(0)
58
 
        self.add(hbox)
59
 
        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()
60
60
 
 
61
        # The file hierarchy: a scrollable treeview
61
62
        scrollwin = gtk.ScrolledWindow()
62
63
        scrollwin.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)
63
64
        scrollwin.set_shadow_type(gtk.SHADOW_IN)
64
 
        hbox.pack_start(scrollwin, expand=False, fill=True)
 
65
        pane.pack1(scrollwin)
65
66
        scrollwin.show()
66
67
 
67
68
        self.model = gtk.TreeStore(str, str)
79
80
        column.add_attribute(cell, "text", 0)
80
81
        self.treeview.append_column(column)
81
82
 
82
 
 
 
83
        # The diffs of the  selected file: a scrollable source or
 
84
        # text view
83
85
        scrollwin = gtk.ScrolledWindow()
84
86
        scrollwin.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
85
87
        scrollwin.set_shadow_type(gtk.SHADOW_IN)
86
 
        hbox.pack_start(scrollwin, expand=True, fill=True)
 
88
        pane.pack2(scrollwin)
87
89
        scrollwin.show()
88
90
 
89
91
        if have_gtksourceview:
113
115
        self.parent_tree = parent_tree
114
116
 
115
117
        self.model.clear()
116
 
        if bzrlib.version_info < (0, 9):
117
 
            delta = compare_trees(self.parent_tree, self.rev_tree)
118
 
        else:
119
 
            delta = self.rev_tree.changes_from(self.parent_tree)
 
118
        delta = self.rev_tree.changes_from(self.parent_tree)
120
119
 
121
120
        self.model.append(None, [ "Complete Diff", "" ])
122
121
 
167
166
 
168
167
        s = StringIO()
169
168
        show_diff_trees(self.parent_tree, self.rev_tree, s, specific_files)
170
 
        self.buffer.set_text(s.getvalue())
 
169
        self.buffer.set_text(s.getvalue().decode(sys.getdefaultencoding(), 'replace'))