bzr branch
http://gegoxaren.bato24.eu/bzr/b-gtk/fix-viz
190.1.1
by Szilveszter Farkas (Phanatic)
Added 'gtags' command and basic Tags window (just a skeleton). |
1 |
# Copyright (C) 2007 by Szilveszter Farkas (Phanatic) <szilveszter.farkas@gmail.com>
|
231
by Jelmer Vernooij
Add RevisionSelectionBox widget, use in TagDialog. |
2 |
# Copyright (C) 2007 by Jelmer Vernooij <jelmer@samba.org>
|
190.1.1
by Szilveszter Farkas (Phanatic)
Added 'gtags' command and basic Tags window (just a skeleton). |
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.4
by Curtis Hovey
Updated commit to gtk3. |
18 |
from gi.repository import GObject |
734.1.1
by Curtis Hovey
Mechanical changes made by pygi.convert.sh. |
19 |
from gi.repository import Gtk |
190.1.1
by Szilveszter Farkas (Phanatic)
Added 'gtags' command and basic Tags window (just a skeleton). |
20 |
|
724
by Jelmer Vernooij
Fix formatting, imports. |
21 |
from bzrlib.plugins.gtk.dialog import error_dialog |
729.1.1
by Jelmer Vernooij
Move i18n support to a separate file, so gettext files aren't loaded unless bzr-gtk is used. |
22 |
from bzrlib.plugins.gtk.i18n import _i18n |
724
by Jelmer Vernooij
Fix formatting, imports. |
23 |
from bzrlib.plugins.gtk.revidbox import RevisionSelectionBox |
330.3.1
by Daniel Schierbeck
Renamed logview 'revisionview'. |
24 |
from bzrlib.plugins.gtk.revisionview import RevisionView |
298.2.1
by Daniel Schierbeck
Refactored the GTK window code, creating a single base window class that handles keyboard events. |
25 |
from bzrlib.plugins.gtk.window import Window |
190.1.1
by Szilveszter Farkas (Phanatic)
Added 'gtags' command and basic Tags window (just a skeleton). |
26 |
|
190.1.3
by Szilveszter Farkas (Phanatic)
Finalized Tags window layout. Added Remove confirmation dialog. |
27 |
|
298.2.1
by Daniel Schierbeck
Refactored the GTK window code, creating a single base window class that handles keyboard events. |
28 |
class TagsWindow(Window): |
190.1.1
by Szilveszter Farkas (Phanatic)
Added 'gtags' command and basic Tags window (just a skeleton). |
29 |
""" Tags window. Allows the user to view/add/remove tags. """ |
30 |
def __init__(self, branch, parent=None): |
|
31 |
""" Initialize the Tags window. """ |
|
298.2.1
by Daniel Schierbeck
Refactored the GTK window code, creating a single base window class that handles keyboard events. |
32 |
Window.__init__(self, parent) |
275.1.3
by Daniel Schierbeck
Close tags window when 'destroy' signal is received. |
33 |
|
190.1.1
by Szilveszter Farkas (Phanatic)
Added 'gtags' command and basic Tags window (just a skeleton). |
34 |
# Get arguments
|
35 |
self.branch = branch |
|
275.1.5
by Daniel Schierbeck
Made windows close correctly on Ctrl-W and made the application quit on Ctrl-Q. |
36 |
|
190.1.1
by Szilveszter Farkas (Phanatic)
Added 'gtags' command and basic Tags window (just a skeleton). |
37 |
# Create the widgets
|
734.1.1
by Curtis Hovey
Mechanical changes made by pygi.convert.sh. |
38 |
self._button_add = Gtk.Button(stock=Gtk.STOCK_ADD) |
39 |
self._button_remove = Gtk.Button(stock=Gtk.STOCK_REMOVE) |
|
40 |
self._button_refresh = Gtk.Button(stock=Gtk.STOCK_REFRESH) |
|
41 |
self._button_close = Gtk.Button(stock=Gtk.STOCK_CLOSE) |
|
42 |
self._model = Gtk.ListStore(str, str) |
|
734.1.11
by Curtis Hovey
Updated gtags to gtk3. |
43 |
self._treeview_tags = Gtk.TreeView(model=self._model) |
734.1.1
by Curtis Hovey
Mechanical changes made by pygi.convert.sh. |
44 |
self._scrolledwindow_tags = Gtk.ScrolledWindow() |
330.3.1
by Daniel Schierbeck
Renamed logview 'revisionview'. |
45 |
self._revisionview = RevisionView() |
734.1.1
by Curtis Hovey
Mechanical changes made by pygi.convert.sh. |
46 |
self._hbox = Gtk.HBox() |
47 |
self._vbox_buttons = Gtk.VBox() |
|
48 |
self._vbox_buttons_top = Gtk.VBox() |
|
49 |
self._vbox_buttons_bottom = Gtk.VBox() |
|
50 |
self._vpaned = Gtk.VPaned() |
|
724
by Jelmer Vernooij
Fix formatting, imports. |
51 |
|
190.1.1
by Szilveszter Farkas (Phanatic)
Added 'gtags' command and basic Tags window (just a skeleton). |
52 |
# Set callbacks
|
190.1.2
by Szilveszter Farkas (Phanatic)
Display list of tags. |
53 |
self._button_add.connect('clicked', self._on_add_clicked) |
190.1.1
by Szilveszter Farkas (Phanatic)
Added 'gtags' command and basic Tags window (just a skeleton). |
54 |
self._button_close.connect('clicked', self._on_close_clicked) |
190.1.4
by Szilveszter Farkas (Phanatic)
Added Refresh button to the Tags window. |
55 |
self._button_refresh.connect('clicked', self._on_refresh_clicked) |
190.1.2
by Szilveszter Farkas (Phanatic)
Display list of tags. |
56 |
self._button_remove.connect('clicked', self._on_remove_clicked) |
57 |
self._treeview_tags.connect('cursor-changed', self._on_treeview_changed) |
|
724
by Jelmer Vernooij
Fix formatting, imports. |
58 |
|
190.1.1
by Szilveszter Farkas (Phanatic)
Added 'gtags' command and basic Tags window (just a skeleton). |
59 |
# Set properties
|
475.1.2
by Vincent Ladeuil
Fix bug #187283 fix replacing _() by _i18n(). |
60 |
self.set_title(_i18n("Tags")) |
190.1.3
by Szilveszter Farkas (Phanatic)
Finalized Tags window layout. Added Remove confirmation dialog. |
61 |
self.set_default_size(600, 400) |
724
by Jelmer Vernooij
Fix formatting, imports. |
62 |
|
734.1.1
by Curtis Hovey
Mechanical changes made by pygi.convert.sh. |
63 |
self._scrolledwindow_tags.set_policy(Gtk.PolicyType.AUTOMATIC, |
64 |
Gtk.PolicyType.AUTOMATIC) |
|
724
by Jelmer Vernooij
Fix formatting, imports. |
65 |
|
190.1.3
by Szilveszter Farkas (Phanatic)
Finalized Tags window layout. Added Remove confirmation dialog. |
66 |
self._hbox.set_border_width(5) |
67 |
self._hbox.set_spacing(5) |
|
68 |
self._vbox_buttons.set_size_request(100, -1) |
|
724
by Jelmer Vernooij
Fix formatting, imports. |
69 |
|
190.1.3
by Szilveszter Farkas (Phanatic)
Finalized Tags window layout. Added Remove confirmation dialog. |
70 |
self._vbox_buttons_top.set_spacing(3) |
724
by Jelmer Vernooij
Fix formatting, imports. |
71 |
|
190.1.3
by Szilveszter Farkas (Phanatic)
Finalized Tags window layout. Added Remove confirmation dialog. |
72 |
self._vpaned.set_position(200) |
724
by Jelmer Vernooij
Fix formatting, imports. |
73 |
|
190.1.1
by Szilveszter Farkas (Phanatic)
Added 'gtags' command and basic Tags window (just a skeleton). |
74 |
# Construct the dialog
|
75 |
self._scrolledwindow_tags.add(self._treeview_tags) |
|
724
by Jelmer Vernooij
Fix formatting, imports. |
76 |
|
734.1.11
by Curtis Hovey
Updated gtags to gtk3. |
77 |
self._vbox_buttons_top.pack_start(self._button_add, False, False, 0) |
78 |
self._vbox_buttons_top.pack_start(self._button_remove, False, False, 0) |
|
79 |
self._vbox_buttons_top.pack_start(self._button_refresh, False, False, 0) |
|
80 |
self._vbox_buttons_bottom.pack_start(self._button_close, False, False, 0) |
|
724
by Jelmer Vernooij
Fix formatting, imports. |
81 |
|
734.1.11
by Curtis Hovey
Updated gtags to gtk3. |
82 |
self._vbox_buttons.pack_start(self._vbox_buttons_top, True, True, 0) |
83 |
self._vbox_buttons.pack_start(self._vbox_buttons_bottom, False, False, 0) |
|
724
by Jelmer Vernooij
Fix formatting, imports. |
84 |
|
190.1.1
by Szilveszter Farkas (Phanatic)
Added 'gtags' command and basic Tags window (just a skeleton). |
85 |
self._vpaned.add1(self._scrolledwindow_tags) |
330.3.1
by Daniel Schierbeck
Renamed logview 'revisionview'. |
86 |
self._vpaned.add2(self._revisionview) |
724
by Jelmer Vernooij
Fix formatting, imports. |
87 |
|
734.1.11
by Curtis Hovey
Updated gtags to gtk3. |
88 |
self._hbox.pack_start(self._vpaned, True, True, 0) |
89 |
self._hbox.pack_start(self._vbox_buttons, False, True, 0) |
|
724
by Jelmer Vernooij
Fix formatting, imports. |
90 |
|
190.1.1
by Szilveszter Farkas (Phanatic)
Added 'gtags' command and basic Tags window (just a skeleton). |
91 |
self.add(self._hbox) |
724
by Jelmer Vernooij
Fix formatting, imports. |
92 |
|
190.1.3
by Szilveszter Farkas (Phanatic)
Finalized Tags window layout. Added Remove confirmation dialog. |
93 |
# Default to no tags
|
94 |
self._no_tags = True |
|
724
by Jelmer Vernooij
Fix formatting, imports. |
95 |
|
190.1.2
by Szilveszter Farkas (Phanatic)
Display list of tags. |
96 |
# Load the tags
|
97 |
self._load_tags() |
|
724
by Jelmer Vernooij
Fix formatting, imports. |
98 |
|
190.1.1
by Szilveszter Farkas (Phanatic)
Added 'gtags' command and basic Tags window (just a skeleton). |
99 |
# Display everything
|
100 |
self._hbox.show_all() |
|
724
by Jelmer Vernooij
Fix formatting, imports. |
101 |
|
190.1.2
by Szilveszter Farkas (Phanatic)
Display list of tags. |
102 |
def _load_tags(self): |
103 |
""" Load the tags into the TreeView. """ |
|
734.1.1
by Curtis Hovey
Mechanical changes made by pygi.convert.sh. |
104 |
tvcol_name = Gtk.TreeViewColumn(_i18n("Tag Name"), |
105 |
Gtk.CellRendererText(), |
|
190.1.3
by Szilveszter Farkas (Phanatic)
Finalized Tags window layout. Added Remove confirmation dialog. |
106 |
text=0) |
107 |
tvcol_name.set_resizable(True) |
|
724
by Jelmer Vernooij
Fix formatting, imports. |
108 |
|
734.1.1
by Curtis Hovey
Mechanical changes made by pygi.convert.sh. |
109 |
tvcol_revid = Gtk.TreeViewColumn(_i18n("Revision ID"), |
110 |
Gtk.CellRendererText(), |
|
190.1.3
by Szilveszter Farkas (Phanatic)
Finalized Tags window layout. Added Remove confirmation dialog. |
111 |
text=1) |
112 |
tvcol_revid.set_resizable(True) |
|
724
by Jelmer Vernooij
Fix formatting, imports. |
113 |
|
190.1.3
by Szilveszter Farkas (Phanatic)
Finalized Tags window layout. Added Remove confirmation dialog. |
114 |
self._treeview_tags.append_column(tvcol_name) |
115 |
self._treeview_tags.append_column(tvcol_revid) |
|
724
by Jelmer Vernooij
Fix formatting, imports. |
116 |
|
190.1.3
by Szilveszter Farkas (Phanatic)
Finalized Tags window layout. Added Remove confirmation dialog. |
117 |
self._treeview_tags.set_search_column(0) |
724
by Jelmer Vernooij
Fix formatting, imports. |
118 |
|
190.1.2
by Szilveszter Farkas (Phanatic)
Display list of tags. |
119 |
self._refresh_tags() |
724
by Jelmer Vernooij
Fix formatting, imports. |
120 |
|
190.1.2
by Szilveszter Farkas (Phanatic)
Display list of tags. |
121 |
def _refresh_tags(self): |
122 |
""" Refresh the list of tags. """ |
|
123 |
self._model.clear() |
|
124 |
if self.branch.supports_tags(): |
|
125 |
tags = self.branch.tags.get_tag_dict() |
|
126 |
if len(tags) > 0: |
|
190.1.3
by Szilveszter Farkas (Phanatic)
Finalized Tags window layout. Added Remove confirmation dialog. |
127 |
self._no_tags = False |
190.1.2
by Szilveszter Farkas (Phanatic)
Display list of tags. |
128 |
for name, target in tags.items(): |
129 |
self._model.append([name, target]) |
|
190.1.6
by Szilveszter Farkas (Phanatic)
Implemented Add tag dialog. |
130 |
self._button_add.set_sensitive(True) |
131 |
self._button_remove.set_sensitive(True) |
|
190.1.2
by Szilveszter Farkas (Phanatic)
Display list of tags. |
132 |
else: |
190.1.3
by Szilveszter Farkas (Phanatic)
Finalized Tags window layout. Added Remove confirmation dialog. |
133 |
self._no_tags = True |
134 |
self._no_tags_available() |
|
190.1.2
by Szilveszter Farkas (Phanatic)
Display list of tags. |
135 |
else: |
190.1.3
by Szilveszter Farkas (Phanatic)
Finalized Tags window layout. Added Remove confirmation dialog. |
136 |
self._no_tags = True |
190.1.2
by Szilveszter Farkas (Phanatic)
Display list of tags. |
137 |
self._tags_not_supported() |
138 |
self._treeview_tags.set_model(self._model) |
|
724
by Jelmer Vernooij
Fix formatting, imports. |
139 |
|
190.1.2
by Szilveszter Farkas (Phanatic)
Display list of tags. |
140 |
def _tags_not_supported(self): |
141 |
""" Tags are not supported. """ |
|
475.1.2
by Vincent Ladeuil
Fix bug #187283 fix replacing _() by _i18n(). |
142 |
self._model.append([_i18n("Tags are not supported by this branch format. Please upgrade."), ""]) |
190.1.2
by Szilveszter Farkas (Phanatic)
Display list of tags. |
143 |
self._button_add.set_sensitive(False) |
144 |
self._button_remove.set_sensitive(False) |
|
724
by Jelmer Vernooij
Fix formatting, imports. |
145 |
|
190.1.3
by Szilveszter Farkas (Phanatic)
Finalized Tags window layout. Added Remove confirmation dialog. |
146 |
def _no_tags_available(self): |
190.1.2
by Szilveszter Farkas (Phanatic)
Display list of tags. |
147 |
""" No tags in the branch. """ |
475.1.2
by Vincent Ladeuil
Fix bug #187283 fix replacing _() by _i18n(). |
148 |
self._model.append([_i18n("No tagged revisions in the branch."), ""]) |
190.1.6
by Szilveszter Farkas (Phanatic)
Implemented Add tag dialog. |
149 |
self._button_add.set_sensitive(True) |
190.1.2
by Szilveszter Farkas (Phanatic)
Display list of tags. |
150 |
self._button_remove.set_sensitive(False) |
724
by Jelmer Vernooij
Fix formatting, imports. |
151 |
|
190.1.2
by Szilveszter Farkas (Phanatic)
Display list of tags. |
152 |
def _on_add_clicked(self, widget): |
153 |
""" Add button event handler. """ |
|
231
by Jelmer Vernooij
Add RevisionSelectionBox widget, use in TagDialog. |
154 |
dialog = AddTagDialog(self.branch.repository, None, |
155 |
self.branch, self) |
|
190.1.6
by Szilveszter Farkas (Phanatic)
Implemented Add tag dialog. |
156 |
response = dialog.run() |
734.1.1
by Curtis Hovey
Mechanical changes made by pygi.convert.sh. |
157 |
if response != Gtk.ResponseType.NONE: |
190.1.6
by Szilveszter Farkas (Phanatic)
Implemented Add tag dialog. |
158 |
dialog.hide() |
734.1.1
by Curtis Hovey
Mechanical changes made by pygi.convert.sh. |
159 |
if response == Gtk.ResponseType.OK: |
232
by Jelmer Vernooij
Make 'Add tag' dialog accessible from bzrk. |
160 |
self.branch.tags.set_tag(dialog.tagname, dialog._revid) |
190.1.6
by Szilveszter Farkas (Phanatic)
Implemented Add tag dialog. |
161 |
self._refresh_tags() |
162 |
dialog.destroy() |
|
724
by Jelmer Vernooij
Fix formatting, imports. |
163 |
|
190.1.1
by Szilveszter Farkas (Phanatic)
Added 'gtags' command and basic Tags window (just a skeleton). |
164 |
def _on_close_clicked(self, widget): |
165 |
""" Close button event handler. """ |
|
166 |
self.destroy() |
|
167 |
if self._parent is None: |
|
734.1.1
by Curtis Hovey
Mechanical changes made by pygi.convert.sh. |
168 |
Gtk.main_quit() |
275.1.5
by Daniel Schierbeck
Made windows close correctly on Ctrl-W and made the application quit on Ctrl-Q. |
169 |
|
190.1.4
by Szilveszter Farkas (Phanatic)
Added Refresh button to the Tags window. |
170 |
def _on_refresh_clicked(self, widget): |
171 |
""" Refresh button event handler. """ |
|
172 |
self._refresh_tags() |
|
724
by Jelmer Vernooij
Fix formatting, imports. |
173 |
|
190.1.2
by Szilveszter Farkas (Phanatic)
Display list of tags. |
174 |
def _on_remove_clicked(self, widget): |
175 |
""" Remove button event handler. """ |
|
176 |
(path, col) = self._treeview_tags.get_cursor() |
|
190.1.6
by Szilveszter Farkas (Phanatic)
Implemented Add tag dialog. |
177 |
if path is None: |
178 |
return
|
|
724
by Jelmer Vernooij
Fix formatting, imports. |
179 |
|
190.1.2
by Szilveszter Farkas (Phanatic)
Display list of tags. |
180 |
tag = self._model[path][0] |
190.1.3
by Szilveszter Farkas (Phanatic)
Finalized Tags window layout. Added Remove confirmation dialog. |
181 |
dialog = RemoveTagDialog(tag, self) |
182 |
response = dialog.run() |
|
734.1.1
by Curtis Hovey
Mechanical changes made by pygi.convert.sh. |
183 |
if response != Gtk.ResponseType.NONE: |
190.1.3
by Szilveszter Farkas (Phanatic)
Finalized Tags window layout. Added Remove confirmation dialog. |
184 |
dialog.hide() |
734.1.1
by Curtis Hovey
Mechanical changes made by pygi.convert.sh. |
185 |
if response == Gtk.ResponseType.OK: |
190.1.3
by Szilveszter Farkas (Phanatic)
Finalized Tags window layout. Added Remove confirmation dialog. |
186 |
self.branch.tags.delete_tag(tag) |
187 |
self._refresh_tags() |
|
188 |
dialog.destroy() |
|
724
by Jelmer Vernooij
Fix formatting, imports. |
189 |
|
190.1.2
by Szilveszter Farkas (Phanatic)
Display list of tags. |
190 |
def _on_treeview_changed(self, *args): |
191 |
""" When a user clicks on a tag. """ |
|
330.3.1
by Daniel Schierbeck
Renamed logview 'revisionview'. |
192 |
# Refresh RevisionView only if there are tags available
|
190.1.3
by Szilveszter Farkas (Phanatic)
Finalized Tags window layout. Added Remove confirmation dialog. |
193 |
if not self._no_tags: |
194 |
(path, col) = self._treeview_tags.get_cursor() |
|
195 |
revision = self._model[path][1] |
|
330.3.1
by Daniel Schierbeck
Renamed logview 'revisionview'. |
196 |
self._revisionview.set_revision(self.branch.repository.get_revision(revision)) |
190.1.3
by Szilveszter Farkas (Phanatic)
Finalized Tags window layout. Added Remove confirmation dialog. |
197 |
|
198 |
||
734.1.1
by Curtis Hovey
Mechanical changes made by pygi.convert.sh. |
199 |
class RemoveTagDialog(Gtk.Dialog): |
190.1.3
by Szilveszter Farkas (Phanatic)
Finalized Tags window layout. Added Remove confirmation dialog. |
200 |
""" Confirm removal of tag. """ |
201 |
def __init__(self, tagname, parent): |
|
734.1.1
by Curtis Hovey
Mechanical changes made by pygi.convert.sh. |
202 |
GObject.GObject.__init__(self, title="Remove tag", |
190.1.3
by Szilveszter Farkas (Phanatic)
Finalized Tags window layout. Added Remove confirmation dialog. |
203 |
parent=parent, |
204 |
flags=0, |
|
734.1.1
by Curtis Hovey
Mechanical changes made by pygi.convert.sh. |
205 |
buttons=(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL)) |
724
by Jelmer Vernooij
Fix formatting, imports. |
206 |
|
190.1.3
by Szilveszter Farkas (Phanatic)
Finalized Tags window layout. Added Remove confirmation dialog. |
207 |
# Get the arguments
|
208 |
self.tag = tagname |
|
724
by Jelmer Vernooij
Fix formatting, imports. |
209 |
|
190.1.3
by Szilveszter Farkas (Phanatic)
Finalized Tags window layout. Added Remove confirmation dialog. |
210 |
# Create the widgets
|
734.1.1
by Curtis Hovey
Mechanical changes made by pygi.convert.sh. |
211 |
self._hbox = Gtk.HBox() |
212 |
self._vbox_question = Gtk.VBox() |
|
213 |
self._image_question = Gtk.Image.new_from_stock(Gtk.STOCK_DIALOG_QUESTION, |
|
214 |
Gtk.IconSize.DIALOG) |
|
215 |
self._label_title = Gtk.Label() |
|
216 |
self._label_question = Gtk.Label() |
|
217 |
self._button_remove = Gtk.Button(_i18n("_Remove tag"), use_underline=True) |
|
724
by Jelmer Vernooij
Fix formatting, imports. |
218 |
|
190.1.3
by Szilveszter Farkas (Phanatic)
Finalized Tags window layout. Added Remove confirmation dialog. |
219 |
# Set callbacks
|
220 |
self._button_remove.connect('clicked', self._on_remove_clicked) |
|
724
by Jelmer Vernooij
Fix formatting, imports. |
221 |
|
190.1.3
by Szilveszter Farkas (Phanatic)
Finalized Tags window layout. Added Remove confirmation dialog. |
222 |
# Set properties
|
223 |
self._hbox.set_border_width(5) |
|
224 |
self._hbox.set_spacing(5) |
|
225 |
self._vbox_question.set_spacing(3) |
|
724
by Jelmer Vernooij
Fix formatting, imports. |
226 |
|
475.1.2
by Vincent Ladeuil
Fix bug #187283 fix replacing _() by _i18n(). |
227 |
self._label_title.set_markup(_i18n("<b><big>Remove tag?</big></b>")) |
190.1.3
by Szilveszter Farkas (Phanatic)
Finalized Tags window layout. Added Remove confirmation dialog. |
228 |
self._label_title.set_alignment(0.0, 0.5) |
475.1.2
by Vincent Ladeuil
Fix bug #187283 fix replacing _() by _i18n(). |
229 |
self._label_question.set_markup(_i18n("Are you sure you want to remove the tag: <b>%s</b>?") % self.tag) |
190.1.3
by Szilveszter Farkas (Phanatic)
Finalized Tags window layout. Added Remove confirmation dialog. |
230 |
self._label_question.set_alignment(0.0, 0.5) |
724
by Jelmer Vernooij
Fix formatting, imports. |
231 |
|
734.1.1
by Curtis Hovey
Mechanical changes made by pygi.convert.sh. |
232 |
self._button_remove.set_image(Gtk.Image.new_from_stock(Gtk.STOCK_REMOVE, |
233 |
Gtk.IconSize.BUTTON)) |
|
234 |
self._button_remove.set_can_default(True) |
|
724
by Jelmer Vernooij
Fix formatting, imports. |
235 |
|
190.1.3
by Szilveszter Farkas (Phanatic)
Finalized Tags window layout. Added Remove confirmation dialog. |
236 |
# Construct the dialog
|
734.1.1
by Curtis Hovey
Mechanical changes made by pygi.convert.sh. |
237 |
self._vbox_question.pack_start(self._label_title, True, True, 0) |
238 |
self._vbox_question.pack_start(self._label_question, True, True, 0) |
|
724
by Jelmer Vernooij
Fix formatting, imports. |
239 |
|
734.1.1
by Curtis Hovey
Mechanical changes made by pygi.convert.sh. |
240 |
self._hbox.pack_start(self._image_question, True, True, 0) |
241 |
self._hbox.pack_start(self._vbox_question, True, True, 0) |
|
724
by Jelmer Vernooij
Fix formatting, imports. |
242 |
|
190.1.3
by Szilveszter Farkas (Phanatic)
Finalized Tags window layout. Added Remove confirmation dialog. |
243 |
self.vbox.add(self._hbox) |
724
by Jelmer Vernooij
Fix formatting, imports. |
244 |
|
190.1.3
by Szilveszter Farkas (Phanatic)
Finalized Tags window layout. Added Remove confirmation dialog. |
245 |
self.action_area.pack_end(self._button_remove) |
724
by Jelmer Vernooij
Fix formatting, imports. |
246 |
|
190.1.3
by Szilveszter Farkas (Phanatic)
Finalized Tags window layout. Added Remove confirmation dialog. |
247 |
# Display dialog
|
248 |
self.vbox.show_all() |
|
724
by Jelmer Vernooij
Fix formatting, imports. |
249 |
|
190.1.3
by Szilveszter Farkas (Phanatic)
Finalized Tags window layout. Added Remove confirmation dialog. |
250 |
# Default to Commit button
|
251 |
self._button_remove.grab_default() |
|
724
by Jelmer Vernooij
Fix formatting, imports. |
252 |
|
190.1.3
by Szilveszter Farkas (Phanatic)
Finalized Tags window layout. Added Remove confirmation dialog. |
253 |
def _on_remove_clicked(self, widget): |
254 |
""" Remove button event handler. """ |
|
734.1.1
by Curtis Hovey
Mechanical changes made by pygi.convert.sh. |
255 |
self.response(Gtk.ResponseType.OK) |
256 |
||
257 |
||
258 |
class AddTagDialog(Gtk.Dialog): |
|
190.1.6
by Szilveszter Farkas (Phanatic)
Implemented Add tag dialog. |
259 |
""" Add tag dialog. """ |
724
by Jelmer Vernooij
Fix formatting, imports. |
260 |
|
231
by Jelmer Vernooij
Add RevisionSelectionBox widget, use in TagDialog. |
261 |
def __init__(self, repository, revid=None, branch=None, parent=None): |
190.1.6
by Szilveszter Farkas (Phanatic)
Implemented Add tag dialog. |
262 |
""" Initialize Add tag dialog. """ |
734.1.1
by Curtis Hovey
Mechanical changes made by pygi.convert.sh. |
263 |
GObject.GObject.__init__(self, title="Add tag", |
190.1.6
by Szilveszter Farkas (Phanatic)
Implemented Add tag dialog. |
264 |
parent=parent, |
265 |
flags=0, |
|
734.1.1
by Curtis Hovey
Mechanical changes made by pygi.convert.sh. |
266 |
buttons=(Gtk.STOCK_CANCEL, |
267 |
Gtk.ResponseType.CANCEL)) |
|
724
by Jelmer Vernooij
Fix formatting, imports. |
268 |
|
190.1.6
by Szilveszter Farkas (Phanatic)
Implemented Add tag dialog. |
269 |
# Get arguments
|
231
by Jelmer Vernooij
Add RevisionSelectionBox widget, use in TagDialog. |
270 |
self._repository = repository |
271 |
self._revid = revid |
|
190.1.6
by Szilveszter Farkas (Phanatic)
Implemented Add tag dialog. |
272 |
self._branch = branch |
724
by Jelmer Vernooij
Fix formatting, imports. |
273 |
|
190.1.6
by Szilveszter Farkas (Phanatic)
Implemented Add tag dialog. |
274 |
# Create the widgets
|
734.1.1
by Curtis Hovey
Mechanical changes made by pygi.convert.sh. |
275 |
self._button_add = Gtk.Button(_i18n("_Add tag"), use_underline=True) |
276 |
self._table = Gtk.Table(2, 2) |
|
277 |
self._label_name = Gtk.Label(label=_i18n("Tag Name:")) |
|
278 |
self._label_revid = Gtk.Label(label=_i18n("Revision ID:")) |
|
279 |
self._entry_name = Gtk.Entry() |
|
232
by Jelmer Vernooij
Make 'Add tag' dialog accessible from bzrk. |
280 |
if self._revid is not None: |
734.1.1
by Curtis Hovey
Mechanical changes made by pygi.convert.sh. |
281 |
self._hbox_revid = Gtk.Label(label=self._revid) |
232
by Jelmer Vernooij
Make 'Add tag' dialog accessible from bzrk. |
282 |
else: |
283 |
self._hbox_revid = RevisionSelectionBox(self._branch) |
|
724
by Jelmer Vernooij
Fix formatting, imports. |
284 |
|
190.1.6
by Szilveszter Farkas (Phanatic)
Implemented Add tag dialog. |
285 |
# Set callbacks
|
286 |
self._button_add.connect('clicked', self._on_add_clicked) |
|
724
by Jelmer Vernooij
Fix formatting, imports. |
287 |
|
190.1.6
by Szilveszter Farkas (Phanatic)
Implemented Add tag dialog. |
288 |
# Set properties
|
289 |
self._label_name.set_alignment(0, 0.5) |
|
290 |
self._label_revid.set_alignment(0, 0.5) |
|
734.1.1
by Curtis Hovey
Mechanical changes made by pygi.convert.sh. |
291 |
self._button_add.set_image(Gtk.Image.new_from_stock(Gtk.STOCK_ADD, |
292 |
Gtk.IconSize.BUTTON)) |
|
293 |
self._button_add.set_can_default(True) |
|
724
by Jelmer Vernooij
Fix formatting, imports. |
294 |
|
190.1.6
by Szilveszter Farkas (Phanatic)
Implemented Add tag dialog. |
295 |
# Construct the dialog
|
296 |
self._table.attach(self._label_name, 0, 1, 0, 1) |
|
297 |
self._table.attach(self._label_revid, 0, 1, 1, 2) |
|
298 |
self._table.attach(self._entry_name, 1, 2, 0, 1) |
|
299 |
self._table.attach(self._hbox_revid, 1, 2, 1, 2) |
|
300 |
self.vbox.add(self._table) |
|
301 |
self.action_area.pack_end(self._button_add) |
|
724
by Jelmer Vernooij
Fix formatting, imports. |
302 |
|
190.1.6
by Szilveszter Farkas (Phanatic)
Implemented Add tag dialog. |
303 |
# Show the dialog
|
304 |
self.vbox.show_all() |
|
724
by Jelmer Vernooij
Fix formatting, imports. |
305 |
|
190.1.6
by Szilveszter Farkas (Phanatic)
Implemented Add tag dialog. |
306 |
def _on_add_clicked(self, widget): |
307 |
""" Add button clicked handler. """ |
|
308 |
if len(self._entry_name.get_text()) == 0: |
|
475.1.2
by Vincent Ladeuil
Fix bug #187283 fix replacing _() by _i18n(). |
309 |
error_dialog(_i18n("No tag name specified"), |
310 |
_i18n("You have to specify the tag's desired name.")) |
|
190.1.6
by Szilveszter Farkas (Phanatic)
Implemented Add tag dialog. |
311 |
return
|
724
by Jelmer Vernooij
Fix formatting, imports. |
312 |
|
232
by Jelmer Vernooij
Make 'Add tag' dialog accessible from bzrk. |
313 |
if self._revid is None: |
314 |
if self._hbox_revid.get_revision_id() is None: |
|
315 |
self._revid = self._branch.last_revision() |
|
316 |
else: |
|
487.3.1
by Javier Derderian
Fixed bug #228709. Can't add tag |
317 |
self._revid = self._hbox_revid.get_revision_id() |
724
by Jelmer Vernooij
Fix formatting, imports. |
318 |
|
190.1.6
by Szilveszter Farkas (Phanatic)
Implemented Add tag dialog. |
319 |
self.tagname = self._entry_name.get_text() |
724
by Jelmer Vernooij
Fix formatting, imports. |
320 |
|
734.1.1
by Curtis Hovey
Mechanical changes made by pygi.convert.sh. |
321 |
self.response(Gtk.ResponseType.OK) |