/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 branchview/treeview.py

  • Committer: Scott Scriven
  • Date: 2008-07-10 06:23:54 UTC
  • mto: This revision was merged to the branch mainline in revision 549.
  • Revision ID: ubuntu@toykeeper.net-20080710062354-tfrqs1jflq2alkv1
The 'vis' treeview was updating twice per cursor motion.  Fixed.
(this makes the diff panel less slow)
The root cause might be a bug in pygtk.  The TreeView widget was 
emitting 'cursor-changed' twice instead of once, so this patch works 
around the issue by using only the first event per cursor position.

Show diffs side-by-side

added added

removed removed

Lines of Context:
325
325
        if set_tooltip is not None:
326
326
            set_tooltip(treemodel.MESSAGE)
327
327
 
 
328
        self._prev_cursor_path = None
328
329
        self.treeview.connect("cursor-changed",
329
330
                self._on_selection_changed)
330
331
 
400
401
    def _on_selection_changed(self, treeview):
401
402
        """callback for when the treeview changes."""
402
403
        (path, focus) = treeview.get_cursor()
403
 
        if path is not None:
 
404
        if (path is not None) and (path != self._prev_cursor_path):
 
405
            self._prev_cursor_path = path # avoid emitting twice per click
404
406
            self.iter = self.model.get_iter(path)
405
407
            self.emit('revision-selected')
406
408