/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: Curtis Hovey
  • Date: 2011-08-12 22:58:29 UTC
  • mto: This revision was merged to the branch mainline in revision 741.
  • Revision ID: sinzui.is@verizon.net-20110812225829-qbyn8z2z04rc8jw4
Fixed row/path issues in gannoate.

Show diffs side-by-side

added added

removed removed

Lines of Context:
168
168
    def _highlight_annotation(self, model, path, iter, now):
169
169
        revision_id, = model.get(iter, REVISION_ID_COL)
170
170
        revision = self.revisions[revision_id]
171
 
        model.set(iter, HIGHLIGHT_COLOR_COL,
172
 
                  self.annotate_colormap.get_color(revision, now))
 
171
        # XXX sinzui 2011-08-12: What does get_color return?
 
172
        color = self.annotate_colormap.get_color(revision, now)
 
173
        model.set_value(iter, HIGHLIGHT_COLOR_COL, color)
173
174
 
174
175
    def _selected_revision(self):
175
176
        (path, col) = self.annoview.get_cursor()
248
249
        self._search.set_target(self.annoview, LINE_NUM_COL)
249
250
 
250
251
    def line_diff(self, tv, path, tvc):
251
 
        row = path[0]
 
252
        row = path.get_indices()[0]
252
253
        revision = self.annotations[row]
253
254
        repository = self.branch.repository
254
255
        if revision.revision_id == CURRENT_REVISION:
397
398
        rev_id = self._selected_revision()
398
399
        if self.file_id in target_tree:
399
400
            offset = self.get_scroll_offset(target_tree)
400
 
            (row,), col = self.annoview.get_cursor()
 
401
            path, col = self.annoview.get_cursor()
 
402
            (row,) = path.get_indices()
401
403
            self.annotate(target_tree, self.branch, self.file_id)
402
404
            new_row = row+offset
403
405
            if new_row < 0:
404
406
                new_row = 0
405
 
            self.annoview.set_cursor(new_row)
 
407
            new_path = Gtk.TreePath(path=new_row)
 
408
            self.annoview.set_cursor(new_path, None, False)
406
409
            return True
407
410
        else:
408
411
            return False
410
413
    def get_scroll_offset(self, tree):
411
414
        old = self.tree.get_file(self.file_id)
412
415
        new = tree.get_file(self.file_id)
413
 
        (row,), col = self.annoview.get_cursor()
 
416
        path, col = self.annoview.get_cursor()
 
417
        (row,) = path.get_indices()
414
418
        matcher = patiencediff.PatienceSequenceMatcher(None, old.readlines(),
415
419
                                                       new.readlines())
416
420
        for i, j, n in matcher.get_matching_blocks():