bzr branch
http://gegoxaren.bato24.eu/bzr/b-gtk/fix-viz
| 
126.1.17
by Szilveszter Farkas (Phanatic)
 Forgot to add the Revision Browser.  | 
1  | 
# Copyright (C) 2006 by Szilveszter Farkas (Phanatic) <szilveszter.farkas@gmail.com>
 | 
2  | 
#
 | 
|
3  | 
# This program is free software; you can redistribute it and/or modify
 | 
|
4  | 
# it under the terms of the GNU General Public License as published by
 | 
|
5  | 
# the Free Software Foundation; either version 2 of the License, or
 | 
|
6  | 
# (at your option) any later version.
 | 
|
7  | 
#
 | 
|
8  | 
# This program is distributed in the hope that it will be useful,
 | 
|
9  | 
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
|
10  | 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
|
11  | 
# GNU General Public License for more details.
 | 
|
12  | 
#
 | 
|
13  | 
# You should have received a copy of the GNU General Public License
 | 
|
14  | 
# along with this program; if not, write to the Free Software
 | 
|
15  | 
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 | 
|
16  | 
||
| 
195.1.23
by Szilveszter Farkas (Phanatic)
 Make the Revision Browser feel faster.  | 
17  | 
import time  | 
18  | 
||
| 
126.1.17
by Szilveszter Farkas (Phanatic)
 Forgot to add the Revision Browser.  | 
19  | 
try:  | 
20  | 
import pygtk  | 
|
21  | 
pygtk.require("2.0")  | 
|
22  | 
except:  | 
|
23  | 
    pass
 | 
|
24  | 
||
25  | 
import gobject  | 
|
26  | 
import gtk  | 
|
27  | 
||
28  | 
from bzrlib.osutils import format_date  | 
|
| 
423.1.17
by Gary van der Merwe
 Reuse the viz treeview in the revision browser.  | 
29  | 
from bzrlib.plugins.gtk.branchview.treeview import TreeView  | 
| 
126.1.17
by Szilveszter Farkas (Phanatic)
 Forgot to add the Revision Browser.  | 
30  | 
|
31  | 
||
32  | 
class RevisionBrowser(gtk.Dialog):  | 
|
33  | 
""" Revision Browser main window. """  | 
|
34  | 
def __init__(self, branch, parent=None):  | 
|
35  | 
gtk.Dialog.__init__(self, title="Revision Browser - Olive",  | 
|
36  | 
parent=parent,  | 
|
37  | 
flags=gtk.DIALOG_MODAL,  | 
|
38  | 
buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL))  | 
|
39  | 
||
40  | 
        # Get arguments
 | 
|
41  | 
self.branch = branch  | 
|
42  | 
||
43  | 
        # Create the widgets
 | 
|
44  | 
self._button_select = gtk.Button(_("_Select"), use_underline=True)  | 
|
| 
463.2.3
by Javier Derderian
 Fixed revbrowser.RevisionBrowser call to TreeView() to pass start revision as list  | 
45  | 
start_revs = [branch.last_revision(),]  | 
| 
466
by Jelmer Vernooij
 Merge Compare With option from Javier.  | 
46  | 
self.treeview = TreeView(branch, start_revs, None)  | 
| 
126.1.17
by Szilveszter Farkas (Phanatic)
 Forgot to add the Revision Browser.  | 
47  | 
|
48  | 
        # Set callbacks
 | 
|
49  | 
self._button_select.connect('clicked', self._on_select_clicked)  | 
|
| 
423.1.17
by Gary van der Merwe
 Reuse the viz treeview in the revision browser.  | 
50  | 
self.treeview.connect('revision-activated',  | 
51  | 
self._on_treeview_revision_activated)  | 
|
| 
126.1.17
by Szilveszter Farkas (Phanatic)
 Forgot to add the Revision Browser.  | 
52  | 
|
53  | 
        # Set properties
 | 
|
| 
423.1.17
by Gary van der Merwe
 Reuse the viz treeview in the revision browser.  | 
54  | 
self.set_default_size(600, 400)  | 
| 
126.1.17
by Szilveszter Farkas (Phanatic)
 Forgot to add the Revision Browser.  | 
55  | 
self.vbox.set_spacing(3)  | 
| 
423.1.18
by Gary van der Merwe
 Add options to viz treeview to not show the line graph, and to only show the main line.  | 
56  | 
self.treeview.set_property('graph-column-visible', False)  | 
57  | 
self.treeview.set_property('date-column-visible', True)  | 
|
58  | 
self.treeview.set_property('mainline-only', True)  | 
|
| 
126.1.17
by Szilveszter Farkas (Phanatic)
 Forgot to add the Revision Browser.  | 
59  | 
|
60  | 
        # Construct the dialog
 | 
|
61  | 
self.action_area.pack_end(self._button_select)  | 
|
62  | 
||
| 
423.1.17
by Gary van der Merwe
 Reuse the viz treeview in the revision browser.  | 
63  | 
self.vbox.pack_start(self.treeview, True, True)  | 
| 
195.1.23
by Szilveszter Farkas (Phanatic)
 Make the Revision Browser feel faster.  | 
64  | 
|
65  | 
        # Show the dialog
 | 
|
66  | 
self.show_all()  | 
|
| 
423.1.17
by Gary van der Merwe
 Reuse the viz treeview in the revision browser.  | 
67  | 
|
68  | 
||
69  | 
def _on_treeview_revision_activated(self, treeview, path, column):  | 
|
| 
126.1.17
by Szilveszter Farkas (Phanatic)
 Forgot to add the Revision Browser.  | 
70  | 
""" Double-click on a row should also select a revision. """  | 
71  | 
self._on_select_clicked(treeview)  | 
|
72  | 
||
73  | 
def _on_select_clicked(self, widget):  | 
|
74  | 
""" Select button clicked handler. """  | 
|
| 
423.1.17
by Gary van der Merwe
 Reuse the viz treeview in the revision browser.  | 
75  | 
|
76  | 
self.selected_revno = self.treeview.get_property('revision-number')  | 
|
77  | 
self.selected_revid = \  | 
|
78  | 
self.treeview.get_property('revision').revision_id  | 
|
| 
126.1.17
by Szilveszter Farkas (Phanatic)
 Forgot to add the Revision Browser.  | 
79  | 
self.response(gtk.RESPONSE_OK)  |