1
# Copyright (C) 2006 by Szilveszter Farkas (Phanatic) <szilveszter.farkas@gmail.com>
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.
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.
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
28
from bzrlib.osutils import format_date
29
from bzrlib.plugins.gtk.branchview.treeview import TreeView
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",
37
flags=gtk.DIALOG_MODAL,
38
buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL))
44
self._button_select = gtk.Button(_("_Select"), use_underline=True)
45
self.treeview = TreeView(branch,branch.last_revision(), None)
48
self._button_select.connect('clicked', self._on_select_clicked)
49
self.treeview.connect('revision-activated',
50
self._on_treeview_revision_activated)
53
self.set_default_size(600, 400)
54
self.vbox.set_spacing(3)
55
self.treeview.set_property('graph-column-visible', False)
56
self.treeview.set_property('date-column-visible', True)
57
self.treeview.set_property('mainline-only', True)
59
# Construct the dialog
60
self.action_area.pack_end(self._button_select)
62
self.vbox.pack_start(self.treeview, True, True)
68
def _on_treeview_revision_activated(self, treeview, path, column):
69
""" Double-click on a row should also select a revision. """
70
self._on_select_clicked(treeview)
72
def _on_select_clicked(self, widget):
73
""" Select button clicked handler. """
75
self.selected_revno = self.treeview.get_property('revision-number')
76
self.selected_revid = \
77
self.treeview.get_property('revision').revision_id
78
self.response(gtk.RESPONSE_OK)