/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-05 02:17:19 UTC
  • Revision ID: jelmer@samba.org-20060905021719-90e2eda34c41604b
Handle empty files more gracefully. Fixes #58951.

Show diffs side-by-side

added added

removed removed

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