/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

Commit messages never contain config options

Show diffs side-by-side

added added

removed removed

Lines of Context:
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
19
 
from diffwin import DiffWindow
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
 
 
30
 
    def show(self, branch, start, maxnum):
31
 
        """Open a new window to show the given branch."""
32
 
        window = BranchWindow(self)
33
 
        window.set_branch(branch, start, maxnum)
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)
41
 
        window.show()
42
 
 
43
 
    def _destroy_cb(self, widget):
44
 
        """Callback for when a window we manage is destroyed."""
45
 
        self.quit()
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()