/b-gtk/fix-viz

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/b-gtk/fix-viz
0.8.43 by Szilveszter Farkas (Phanatic)
Implemented Log functionality (via bzrk).
1
# Modified for use with Olive:
2
# Copyright (C) 2006 by Szilveszter Farkas (Phanatic) <szilveszter.farkas@gmail.com>
3
# Original copyright holder:
4
# Copyright (C) 2005 by Canonical Ltd. (Scott James Remnant <scott@ubuntu.com>)
5
#
6
# This program is free software; you can redistribute it and/or modify
7
# it under the terms of the GNU General Public License as published by
8
# the Free Software Foundation; either version 2 of the License, or
9
# (at your option) any later version.
10
#
11
# This program is distributed in the hope that it will be useful,
12
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
# GNU General Public License for more details.
15
#
16
# You should have received a copy of the GNU General Public License
17
# along with this program; if not, write to the Free Software
18
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19
20
"""Application object.
21
22
This module contains the application object that manages the windows
23
on screen, and can be used to create new windows of various types.
24
"""
25
26
__copyright__ = "Copyright © 2005 Canonical Ltd."
27
__author__    = "Scott James Remnant <scott@ubuntu.com>"
28
29
30
import pygtk
31
pygtk.require("2.0")
32
33
import gtk
34
35
from branchwin import BranchWindow
36
from diffwin import DiffWindow
37
38
39
class BzrkApp(object):
40
    """Application manager.
41
42
    This object manages the bzrk application, creating and managing
43
    individual branch windows and ensuring the application exits when
44
    the last window is closed.
45
    """
46
47
    def show(self, branch, start, maxnum):
48
        """Open a new window to show the given branch."""
49
        window = BranchWindow(self)
50
        window.set_branch(branch, start, maxnum)
51
        window.show()
52
53
    def show_diff(self, branch, revid, parentid):
54
        """Open a new window to show a diff between the given revisions."""
55
        window = DiffWindow()
56
        rev_tree = branch.repository.revision_tree(revid)
57
        parent_tree = branch.repository.revision_tree(parentid)
58
        description = revid + " - " + branch.nick
59
        window.set_diff(description, rev_tree, parent_tree)
60
        window.show()