/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: Jelmer Vernooij
  • Date: 2006-07-06 19:34:35 UTC
  • Revision ID: jelmer@samba.org-20060706193435-eaf2ffcc552b4185
Ignore pyc files

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