bzr branch
http://gegoxaren.bato24.eu/bzr/b-gtk/fix-viz
231
by Jelmer Vernooij
Add RevisionSelectionBox widget, use in TagDialog. |
1 |
# Copyright (C) 2007 by Szilveszter Farkas (Phanatic) <szilveszter.farkas@gmail.com>
|
2 |
# Copyright (C) 2007 by Jelmer Vernooij <jelmer@samba.org>
|
|
3 |
#
|
|
4 |
# This program is free software; you can redistribute it and/or modify
|
|
5 |
# it under the terms of the GNU General Public License as published by
|
|
6 |
# the Free Software Foundation; either version 2 of the License, or
|
|
7 |
# (at your option) any later version.
|
|
8 |
#
|
|
9 |
# This program is distributed in the hope that it will be useful,
|
|
10 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12 |
# GNU General Public License for more details.
|
|
13 |
#
|
|
14 |
# You should have received a copy of the GNU General Public License
|
|
15 |
# along with this program; if not, write to the Free Software
|
|
16 |
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
17 |
||
734.1.1
by Curtis Hovey
Mechanical changes made by pygi.convert.sh. |
18 |
from gi.repository import Gtk |
231
by Jelmer Vernooij
Add RevisionSelectionBox widget, use in TagDialog. |
19 |
|
734.1.1
by Curtis Hovey
Mechanical changes made by pygi.convert.sh. |
20 |
class RevisionSelectionBox(Gtk.HBox): |
724
by Jelmer Vernooij
Fix formatting, imports. |
21 |
|
231
by Jelmer Vernooij
Add RevisionSelectionBox widget, use in TagDialog. |
22 |
def __init__(self, branch): |
23 |
super(RevisionSelectionBox, self).__init__() |
|
24 |
self._branch = branch |
|
734.1.1
by Curtis Hovey
Mechanical changes made by pygi.convert.sh. |
25 |
self._entry_revid = Gtk.Entry() |
26 |
self._button_revid = Gtk.Button('') |
|
27 |
self._button_revid.set_image(Gtk.Image.new_from_stock( |
|
28 |
Gtk.STOCK_OPEN, Gtk.IconSize.BUTTON)) |
|
231
by Jelmer Vernooij
Add RevisionSelectionBox widget, use in TagDialog. |
29 |
self.pack_start(self._entry_revid, True, True) |
724
by Jelmer Vernooij
Fix formatting, imports. |
30 |
self.pack_start(self._button_revid, False, False) |
231
by Jelmer Vernooij
Add RevisionSelectionBox widget, use in TagDialog. |
31 |
|
32 |
self._button_revid.connect('clicked', self._on_revid_clicked) |
|
33 |
||
34 |
def _on_revid_clicked(self, widget): |
|
35 |
""" Browse for revision button clicked handler. """ |
|
36 |
from revbrowser import RevisionBrowser |
|
724
by Jelmer Vernooij
Fix formatting, imports. |
37 |
|
231
by Jelmer Vernooij
Add RevisionSelectionBox widget, use in TagDialog. |
38 |
# FIXME: Should specific parent window here - how to get to it?
|
39 |
# JRV 20070715
|
|
40 |
revb = RevisionBrowser(self._branch) |
|
41 |
response = revb.run() |
|
734.1.1
by Curtis Hovey
Mechanical changes made by pygi.convert.sh. |
42 |
if response != Gtk.ResponseType.NONE: |
231
by Jelmer Vernooij
Add RevisionSelectionBox widget, use in TagDialog. |
43 |
revb.hide() |
724
by Jelmer Vernooij
Fix formatting, imports. |
44 |
|
734.1.1
by Curtis Hovey
Mechanical changes made by pygi.convert.sh. |
45 |
if response == Gtk.ResponseType.OK: |
231
by Jelmer Vernooij
Add RevisionSelectionBox widget, use in TagDialog. |
46 |
if revb.selected_revno is not None: |
47 |
self._entry_revid.set_text(revb.selected_revid) |
|
724
by Jelmer Vernooij
Fix formatting, imports. |
48 |
|
231
by Jelmer Vernooij
Add RevisionSelectionBox widget, use in TagDialog. |
49 |
revb.destroy() |
50 |
||
51 |
def get_revision_id(self): |
|
52 |
if len(self._entry_revid.get_text()) == 0: |
|
53 |
return None |
|
54 |
else: |
|
55 |
return self._entry_revid.get_text() |