/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 viz/branchwin.py

  • Committer: Jelmer Vernooij
  • Date: 2007-02-03 14:19:20 UTC
  • Revision ID: jelmer@samba.org-20070203141920-cnhba99657gb78ay
Cleanup some more code.

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
    for a particular branch.
27
27
    """
28
28
 
29
 
    def __init__(self, app=None):
 
29
    def __init__(self):
30
30
        gtk.Window.__init__(self, gtk.WINDOW_TOPLEVEL)
31
31
        self.set_border_width(0)
32
32
        self.set_title("bzrk")
33
33
 
34
 
        self.app = app
35
 
 
36
34
        # Use three-quarters of the screen by default
37
35
        screen = self.get_screen()
38
36
        monitor = screen.get_monitor_geometry(0)
246
244
        self.treeview.set_cursor(self.index[self.revisions[revid]])
247
245
        self.treeview.grab_focus()
248
246
 
 
247
    def show_diff(self, branch, revid, parentid):
 
248
        """Open a new window to show a diff between the given revisions."""
 
249
        from bzrlib.plugins.gtk.diff import DiffWindow
 
250
        window = DiffWindow()
 
251
        rev_tree = branch.repository.revision_tree(revid)
 
252
        parent_tree = branch.repository.revision_tree(parentid)
 
253
        description = revid + " - " + branch.nick
 
254
        window.set_diff(description, rev_tree, parent_tree)
 
255
        window.show()
 
256
 
249
257
    def _show_clicked_cb(self, revid, parentid):
250
258
        """Callback for when the show button for a parent is clicked."""
251
 
        if self.app is not None:
252
 
            self.app.show_diff(self.branch, revid, parentid)
 
259
        self.show_diff(self.branch, revid, parentid)
253
260
        self.treeview.grab_focus()
254
261
 
255
262
    def _treeview_row_activated_cb(self, widget, path, col):
260
267
            # Ignore revisions without parent
261
268
            return
262
269
        parent_id = self.parent_ids[revision][0]
263
 
        if self.app is not None:
264
 
            self.app.show_diff(self.branch, revision.revision_id, parent_id)
 
270
        self.show_diff(self.branch, revision.revision_id, parent_id)
265
271
        self.treeview.grab_focus()