/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/bzrkapp.py

  • Committer: Jelmer Vernooij
  • Date: 2006-09-30 10:21:43 UTC
  • Revision ID: jelmer@samba.org-20060930102143-c0ef64d6ca860c21
Merge some files from Olive and bzr-gtk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/usr/bin/python
2
1
# -*- coding: UTF-8 -*-
3
2
"""Application object.
4
3
 
16
15
import gtk
17
16
 
18
17
from branchwin import BranchWindow
 
18
from diffwin import DiffWindow
19
19
 
20
20
 
21
21
class BzrkApp(object):
26
26
    the last window is closed.
27
27
    """
28
28
 
29
 
    def __init__(self):
30
 
        self._num_windows = 0
31
 
 
32
 
    def show(self, branch, start):
 
29
    def show(self, branch, start, maxnum):
33
30
        """Open a new window to show the given branch."""
34
 
        self._num_windows += 1
35
 
 
36
 
        window = BranchWindow()
37
 
        window.set_branch(branch, start)
 
31
        window = BranchWindow(self)
 
32
        window.set_branch(branch, start, maxnum)
38
33
        window.connect("destroy", self._destroy_cb)
39
34
        window.show()
40
35
 
 
36
    def show_diff(self, branch, revid, parentid):
 
37
        """Open a new window to show a diff between the given revisions."""
 
38
        window = DiffWindow()
 
39
        rev_tree = branch.repository.revision_tree(revid)
 
40
        parent_tree = branch.repository.revision_tree(parentid)
 
41
        description = revid + " - " + branch.nick
 
42
        window.set_diff(description, rev_tree, parent_tree)
 
43
        window.show()
 
44
 
41
45
    def _destroy_cb(self, widget):
42
46
        """Callback for when a window we manage is destroyed."""
43
 
        self._num_windows -= 1
44
 
        if self._num_windows <= 0:
45
 
            self.quit()
 
47
        self.quit()
46
48
 
47
49
    def main(self):
48
50
        """Start the GTK+ main loop."""