/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 19:50:45 UTC
  • mto: This revision was merged to the branch mainline in revision 741.
  • Revision ID: sinzui.is@verizon.net-20110812195045-y86bmaibs3pw5w6d
Updated buffer.getText() calls and ModifierType enums.

Show diffs side-by-side

added added

removed removed

Lines of Context:
129
129
        else:
130
130
            row = lineno - 1
131
131
 
132
 
        tree_path = Gtk.TreePath(path=row)
133
 
        self.annoview.set_cursor(tree_path, None, False)
 
132
        tree_path = Gtk.TreePath.new_from_string(str(row))
 
133
        self.annoview.set_cursor(tree_path, None, None)
134
134
        self.annoview.scroll_to_cell(tree_path, use_align=True)
135
135
 
136
136
 
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
 
        # 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)
 
171
        model.set(iter, HIGHLIGHT_COLOR_COL,
 
172
                  self.annotate_colormap.get_color(revision, now))
174
173
 
175
174
    def _selected_revision(self):
176
175
        (path, col) = self.annoview.get_cursor()
249
248
        self._search.set_target(self.annoview, LINE_NUM_COL)
250
249
 
251
250
    def line_diff(self, tv, path, tvc):
252
 
        row = path.get_indices()[0]
 
251
        row = path[0]
253
252
        revision = self.annotations[row]
254
253
        repository = self.branch.repository
255
254
        if revision.revision_id == CURRENT_REVISION:
398
397
        rev_id = self._selected_revision()
399
398
        if self.file_id in target_tree:
400
399
            offset = self.get_scroll_offset(target_tree)
401
 
            path, col = self.annoview.get_cursor()
402
 
            (row,) = path.get_indices()
 
400
            (row,), col = self.annoview.get_cursor()
403
401
            self.annotate(target_tree, self.branch, self.file_id)
404
402
            new_row = row+offset
405
403
            if new_row < 0:
406
404
                new_row = 0
407
 
            new_path = Gtk.TreePath(path=new_row)
408
 
            self.annoview.set_cursor(new_path, None, False)
 
405
            self.annoview.set_cursor(new_row)
409
406
            return True
410
407
        else:
411
408
            return False
413
410
    def get_scroll_offset(self, tree):
414
411
        old = self.tree.get_file(self.file_id)
415
412
        new = tree.get_file(self.file_id)
416
 
        path, col = self.annoview.get_cursor()
417
 
        (row,) = path.get_indices()
 
413
        (row,), col = self.annoview.get_cursor()
418
414
        matcher = patiencediff.PatienceSequenceMatcher(None, old.readlines(),
419
415
                                                       new.readlines())
420
416
        for i, j, n in matcher.get_matching_blocks():
468
464
        image.set_from_stock('gtk-stop', Gtk.IconSize.BUTTON)
469
465
        button.set_image(image)
470
466
        button.set_relief(Gtk.ReliefStyle.NONE)
471
 
        button.connect("clicked", lambda w: self.hide())
 
467
        button.connect("clicked", lambda w: self.hide_all())
472
468
        self.pack_start(button, False, False, 0)
473
469
 
474
470
        # Search entry
593
589
        for row in iterate(model, start):
594
590
            if self._match(model, row, self._column):
595
591
                path = model.get_path(row)
596
 
                self._view.set_cursor(path, None, False)
 
592
                self._view.set_cursor(path)
597
593
                self._view.scroll_to_cell(path, use_align=True)
598
594
                break