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

  • Committer: Scott James Remnant
  • Date: 2005-10-17 01:07:49 UTC
  • Revision ID: scott@netsplit.com-20051017010749-15fa95fc2cf09289
Commit the first version of bzrk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/python
1
2
# -*- coding: UTF-8 -*-
2
3
"""Application object.
3
4
 
15
16
import gtk
16
17
 
17
18
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 show(self, branch, start, maxnum):
 
29
    def __init__(self):
 
30
        self._num_windows = 0
 
31
 
 
32
    def show(self, branch, start):
30
33
        """Open a new window to show the given branch."""
31
 
        window = BranchWindow(self)
32
 
        window.set_branch(branch, start, maxnum)
 
34
        self._num_windows += 1
 
35
 
 
36
        window = BranchWindow()
 
37
        window.set_branch(branch, start)
33
38
        window.connect("destroy", self._destroy_cb)
34
39
        window.show()
35
40
 
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
 
 
45
41
    def _destroy_cb(self, widget):
46
42
        """Callback for when a window we manage is destroyed."""
47
 
        self.quit()
 
43
        self._num_windows -= 1
 
44
        if self._num_windows <= 0:
 
45
            self.quit()
48
46
 
49
47
    def main(self):
50
48
        """Start the GTK+ main loop."""