/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 annotate/gannotate.py

  • Committer: Jelmer Vernooij
  • Date: 2006-05-19 16:56:46 UTC
  • mfrom: (0.1.25 gannotate)
  • Revision ID: jelmer@samba.org-20060519165646-0d867938fdbc9097
Merge in Dan Loda's gannotate plugin and put it in annotate/

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
import pango
24
24
 
25
25
from bzrlib.errors import NoSuchRevision
26
 
from bzrlib.revision import NULL_REVISION
27
26
 
28
27
from colormap import AnnotateColorMap, AnnotateColorSaturation
29
28
from logview import LogView
59
58
 
60
59
    def annotate(self, branch, file_id):
61
60
        self.revisions = {}
62
 
        self.annotations = []
63
 
        self.branch = branch
64
 
        self.file_id = file_id
65
61
        
66
62
        # [revision id, line number, committer, revno, highlight color, line]
67
63
        self.annomodel = gtk.ListStore(gobject.TYPE_STRING,
93
89
                                       None,
94
90
                                       line.rstrip("\r\n")
95
91
                                      ])
96
 
                self.annotations.append(revision)
97
92
 
98
93
            if not self.plain:
99
94
                self._set_oldest_newest()
118
113
            row = lineno - 1
119
114
 
120
115
        self.annoview.set_cursor(row)
121
 
        self.annoview.scroll_to_cell(row, use_align=True)
122
116
 
123
117
    def _annotate(self, branch, file_id):
124
118
        rev_hist = branch.revision_history()
186
180
        sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
187
181
        sw.set_shadow_type(gtk.SHADOW_IN)
188
182
        sw.add(self.annoview)
189
 
        self.annoview.gwindow = self
190
183
        sw.show()
191
184
        
192
185
        self.pane = pane = gtk.VPaned()
203
196
 
204
197
        self.add(vbox)
205
198
 
206
 
    def row_diff(self, tv, path, tvc):
207
 
        row = path[0]
208
 
        revision = self.annotations[row]
209
 
        repository = self.branch.repository
210
 
        tree1 = repository.revision_tree(revision.revision_id)
211
 
        if len(revision.parent_ids) > 0:
212
 
            tree2 = repository.revision_tree(revision.parent_ids[0])
213
 
        else:
214
 
            tree2 = repository.revision_tree(NULL_REVISION)
215
 
        from bzrlib.plugins.gtk.viz.diffwin import DiffWindow
216
 
        window = DiffWindow()
217
 
        window.set_diff("Diff for row %d" % (row+1), tree1, tree2)
218
 
        window.set_file(tree1.id2path(self.file_id))
219
 
        window.show()
220
 
 
221
 
 
222
199
    def _create_annotate_view(self):
223
200
        tv = gtk.TreeView()
224
201
        tv.set_rules_hint(False)
225
202
        tv.connect("cursor-changed", self._show_log)
226
203
        tv.show()
227
 
        tv.connect("row-activated", self.row_diff)
228
204
 
229
205
        cell = gtk.CellRendererText()
230
206
        cell.set_property("xalign", 1.0)