/b-gtk/fix-viz

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/b-gtk/fix-viz
1 by Scott James Remnant
Commit the first version of bzrk.
1
#!/usr/bin/python
2
# -*- coding: UTF-8 -*-
3
"""Application object.
4
5
This module contains the application object that manages the windows
6
on screen, and can be used to create new windows of various types.
7
"""
8
9
__copyright__ = "Copyright © 2005 Canonical Ltd."
10
__author__    = "Scott James Remnant <scott@ubuntu.com>"
11
12
13
import pygtk
14
pygtk.require("2.0")
15
16
import gtk
17
18
from branchwin import BranchWindow
10 by Scott James Remnant
Add an extra window type, clicking the little icons next to a parent
19
from diffwin import DiffWindow
1 by Scott James Remnant
Commit the first version of bzrk.
20
21
22
class BzrkApp(object):
23
    """Application manager.
24
25
    This object manages the bzrk application, creating and managing
26
    individual branch windows and ensuring the application exits when
27
    the last window is closed.
28
    """
29
40 by David Allouche
remove --robust, pyflakes fixes, update README
30
    def show(self, branch, start, maxnum):
1 by Scott James Remnant
Commit the first version of bzrk.
31
        """Open a new window to show the given branch."""
10 by Scott James Remnant
Add an extra window type, clicking the little icons next to a parent
32
        window = BranchWindow(self)
40 by David Allouche
remove --robust, pyflakes fixes, update README
33
        window.set_branch(branch, start, maxnum)
10 by Scott James Remnant
Add an extra window type, clicking the little icons next to a parent
34
        window.connect("destroy", self._destroy_cb)
35
        window.show()
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(self)
40
        window.set_diff(branch, revid, parentid)
1 by Scott James Remnant
Commit the first version of bzrk.
41
        window.show()
42
43
    def _destroy_cb(self, widget):
44
        """Callback for when a window we manage is destroyed."""
17 by Scott James Remnant
stop managing windows so much, just quit when the viz window is closed
45
        self.quit()
1 by Scott James Remnant
Commit the first version of bzrk.
46
47
    def main(self):
48
        """Start the GTK+ main loop."""
49
        gtk.main()
50
51
    def quit(self):
52
        """Stop the GTK+ main loop."""
53
        gtk.main_quit()