/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 04:26:00 UTC
  • Revision ID: scott@netsplit.com-20051017042600-b3a3265abfffdf53
Split the display in two with a pane, we'll use the bottom half to show
information about the current revision.  Add a Back and Forward button
which figure out which revision is logically the next of previous and
moves the cursor to it.  Handle the cursor-changed event to enable/disable
the buttons (and soon update the bottom pane).

Further split up graph.py so we can stash the internal lists to do the
above; also it may allow us in future to produce partial graphs.

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
 
 
20
 
 
21
class BzrkApp(object):
 
22
    """Application manager.
 
23
 
 
24
    This object manages the bzrk application, creating and managing
 
25
    individual branch windows and ensuring the application exits when
 
26
    the last window is closed.
 
27
    """
 
28
 
 
29
    def __init__(self):
 
30
        self._num_windows = 0
 
31
 
 
32
    def show(self, branch, start):
 
33
        """Open a new window to show the given branch."""
 
34
        self._num_windows += 1
 
35
 
 
36
        window = BranchWindow()
 
37
        window.set_branch(branch, start)
 
38
        window.connect("destroy", self._destroy_cb)
 
39
        window.show()
 
40
 
 
41
    def _destroy_cb(self, widget):
 
42
        """Callback for when a window we manage is destroyed."""
 
43
        self._num_windows -= 1
 
44
        if self._num_windows <= 0:
 
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()