/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 revbrowser.py

  • Committer: Szilveszter Farkas (Phanatic)
  • Date: 2006-08-07 16:51:21 UTC
  • mto: (0.14.1 main) (93.1.1 win32.bialix)
  • mto: This revision was merged to the branch mainline in revision 83.
  • Revision ID: Szilveszter.Farkas@gmail.com-20060807165121-10fe27c374bbdffd
Added new artwork.

2006-08-07  Szilveszter Farkas <Szilveszter.Farkas@gmail.com>

    * olive.galde: added custom artwork (icons)
    * icons/*: new icons for the toolbar
    * setup.py: install the icons

Show diffs side-by-side

added added

removed removed

Lines of Context:
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
 
 
17
 
from gi.repository import GObject
18
 
from gi.repository import Gtk
19
 
 
20
 
from bzrlib.plugins.gtk.branchview.treeview import TreeView
21
 
from bzrlib.plugins.gtk.i18n import _i18n
22
 
 
23
 
 
24
 
class RevisionBrowser(Gtk.Dialog):
25
 
    """ Revision Browser main window. """
26
 
    def __init__(self, branch, parent=None):
27
 
        GObject.GObject.__init__(self, title="Revision Browser - Olive",
28
 
                                  parent=parent,
29
 
                                  flags=Gtk.DialogFlags.MODAL,
30
 
                                  buttons=(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL))
31
 
 
32
 
        # Get arguments
33
 
        self.branch = branch
34
 
 
35
 
        # Create the widgets
36
 
        self._button_select = Gtk.Button(_i18n("_Select"), use_underline=True)
37
 
        start_revs = [branch.last_revision(),]
38
 
        self.treeview = TreeView(branch, start_revs, None)
39
 
 
40
 
        # Set callbacks
41
 
        self._button_select.connect('clicked', self._on_select_clicked)
42
 
        self.treeview.connect('revision-activated',
43
 
                               self._on_treeview_revision_activated)
44
 
 
45
 
        # Set properties
46
 
        self.set_default_size(600, 400)
47
 
        self.vbox.set_spacing(3)
48
 
        self.treeview.set_property('graph-column-visible', False)
49
 
        self.treeview.set_property('date-column-visible', True)
50
 
        self.treeview.set_property('mainline-only', True)
51
 
 
52
 
        # Construct the dialog
53
 
        self.action_area.pack_end(self._button_select)
54
 
 
55
 
        self.vbox.pack_start(self.treeview, True, True)
56
 
 
57
 
        # Show the dialog
58
 
        self.show_all()
59
 
 
60
 
 
61
 
    def _on_treeview_revision_activated(self, treeview, path, column):
62
 
        """ Double-click on a row should also select a revision. """
63
 
        self._on_select_clicked(treeview)
64
 
 
65
 
    def _on_select_clicked(self, widget):
66
 
        """ Select button clicked handler. """
67
 
 
68
 
        self.selected_revno = self.treeview.get_property('revision-number')
69
 
        self.selected_revid = \
70
 
                    self.treeview.get_property('revision').revision_id
71
 
        self.response(Gtk.ResponseType.OK)