/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

Reuse the viz treeview in the revision browser.

Show diffs side-by-side

added added

removed removed

Lines of Context:
75
75
        'revision-selected': (gobject.SIGNAL_RUN_FIRST,
76
76
                              gobject.TYPE_NONE,
77
77
                              ()),
 
78
        'revision-activated': (gobject.SIGNAL_RUN_FIRST,
 
79
                              gobject.TYPE_NONE,
 
80
                              (gobject.TYPE_PYOBJECT, gobject.TYPE_PYOBJECT)),
78
81
        'tag-added': (gobject.SIGNAL_RUN_FIRST,
79
82
                              gobject.TYPE_NONE,
80
83
                              (gobject.TYPE_STRING, gobject.TYPE_STRING))
282
285
 
283
286
        return False
284
287
 
285
 
    def show_diff(self, revid=None, parentid=None):
286
 
        """Open a new window to show a diff between the given revisions."""
287
 
        from bzrlib.plugins.gtk.diff import DiffWindow
288
 
        window = DiffWindow(parent=self)
289
 
 
290
 
        parents = self.get_parents()
291
 
 
292
 
        if revid is None:
293
 
            revid = self.get_revision().revision_id
294
 
 
295
 
            if parentid is None and len(parents) > 0:
296
 
                parentid = parents[0]
297
 
 
298
 
        if parentid is None:
299
 
            parentid = NULL_REVISION
300
 
 
301
 
        rev_tree    = self.branch.repository.revision_tree(revid)
302
 
        parent_tree = self.branch.repository.revision_tree(parentid)
303
 
 
304
 
        description = revid + " - " + self.branch.nick
305
 
        window.set_diff(description, rev_tree, parent_tree)
306
 
        window.show()
307
 
 
308
288
    def construct_treeview(self):
309
289
        self.treeview = gtk.TreeView()
310
290
 
422
402
            menu.popup(None, None, None, event.button, event.get_time())
423
403
 
424
404
    def _on_revision_activated(self, widget, path, col):
425
 
        # TODO: more than one parent
426
 
        """Callback for when a treeview row gets activated."""
427
 
        revision_id = self.model[path][treemodel.REVID]
428
 
        parents = self.model[path][treemodel.PARENTS]
429
 
 
430
 
        if len(parents) == 0:
431
 
            parent_id = None
432
 
        else:
433
 
            parent_id = parents[0]
434
 
 
435
 
        self.show_diff(revision_id, parent_id)
436
 
        self.treeview.grab_focus()
 
405
        self.emit('revision-activated', path, col)