bzr branch
http://gegoxaren.bato24.eu/bzr/b-gtk/fix-viz
0.1.1
by Dan Loda
First working version of xannotate. |
1 |
# Copyright (C) 2005 Dan Loda <danloda@gmail.com>
|
175
by Jelmer Vernooij
Add very simple gmissing command. |
2 |
# Copyright (C) 2007 Jelmer Vernooij <jelmer@samba.org>
|
0.1.1
by Dan Loda
First working version of xannotate. |
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 |
||
18 |
import pygtk |
|
19 |
pygtk.require("2.0") |
|
20 |
import gtk |
|
21 |
import pango |
|
399.1.9
by Daniel Schierbeck
Merged with trunk. |
22 |
import gobject |
423.14.1
by Jelmer Vernooij
Add bugs tab to display bug status change metadata. |
23 |
import subprocess |
0.1.1
by Dan Loda
First working version of xannotate. |
24 |
|
399.1.19
by Jelmer Vernooij
Add utility function for finding icon paths. |
25 |
from bzrlib.plugins.gtk import icon_path |
0.1.1
by Dan Loda
First working version of xannotate. |
26 |
from bzrlib.osutils import format_date |
412.1.8
by Daniel Schierbeck
Only import the bdecode function from the bzrlib.util.bencode package. |
27 |
from bzrlib.util.bencode import bdecode |
0.1.1
by Dan Loda
First working version of xannotate. |
28 |
|
423.14.2
by Jelmer Vernooij
Move bugs tab to separate widget. |
29 |
def _open_link(widget, uri): |
30 |
subprocess.Popen(['sensible-browser', uri], close_fds=True) |
|
31 |
||
32 |
gtk.link_button_set_uri_hook(_open_link) |
|
33 |
||
450.6.1
by Daniel Schierbeck
Made bug tab prettier. |
34 |
class BugsTab(gtk.VBox): |
423.14.2
by Jelmer Vernooij
Move bugs tab to separate widget. |
35 |
def __init__(self): |
450.6.1
by Daniel Schierbeck
Made bug tab prettier. |
36 |
super(BugsTab, self).__init__(False, 6) |
37 |
||
38 |
table = gtk.Table(rows=2, columns=2) |
|
39 |
||
40 |
table.set_row_spacings(6) |
|
450.6.2
by Daniel Schierbeck
Further improved the look of the bug tab. |
41 |
table.set_col_spacings(12) |
450.6.1
by Daniel Schierbeck
Made bug tab prettier. |
42 |
|
43 |
image = gtk.Image() |
|
44 |
image.set_from_file(icon_path("bug.png")) |
|
45 |
table.attach(image, 0, 1, 0, 1, gtk.FILL) |
|
46 |
||
450.6.2
by Daniel Schierbeck
Further improved the look of the bug tab. |
47 |
align = gtk.Alignment(0.0, 0.1) |
450.6.1
by Daniel Schierbeck
Made bug tab prettier. |
48 |
label = gtk.Label() |
49 |
label.set_markup("<b>Bugs</b>\nThis revision has one or more bug associations.") |
|
50 |
align.add(label) |
|
51 |
table.attach(align, 1, 2, 0, 1, gtk.FILL) |
|
52 |
||
53 |
treeview = self.construct_treeview() |
|
54 |
table.attach(treeview, 1, 2, 1, 2, gtk.FILL | gtk.EXPAND) |
|
55 |
||
56 |
self.set_border_width(6) |
|
57 |
self.pack_start(table, expand=False) |
|
58 |
||
59 |
self.hide_all() |
|
60 |
||
61 |
def construct_treeview(self): |
|
62 |
self.bugs = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_STRING) |
|
63 |
self.treeview = gtk.TreeView(self.bugs) |
|
64 |
||
65 |
uri_column = gtk.TreeViewColumn('Bug URI', gtk.CellRendererText(), text=0) |
|
66 |
status_column = gtk.TreeViewColumn('Status', gtk.CellRendererText(), text=1) |
|
67 |
||
68 |
self.treeview.append_column(uri_column) |
|
69 |
self.treeview.append_column(status_column) |
|
70 |
||
71 |
win = gtk.ScrolledWindow() |
|
72 |
win.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) |
|
73 |
win.set_shadow_type(gtk.SHADOW_IN) |
|
74 |
win.add(self.treeview) |
|
75 |
||
76 |
return win |
|
423.14.2
by Jelmer Vernooij
Move bugs tab to separate widget. |
77 |
|
78 |
def clear(self): |
|
450.6.1
by Daniel Schierbeck
Made bug tab prettier. |
79 |
self.bugs.clear() |
448
by Jelmer Vernooij
Add bugs tab in branch view. |
80 |
self.hide_all() # Only shown when there are bugs |
423.14.2
by Jelmer Vernooij
Move bugs tab to separate widget. |
81 |
|
82 |
def add_bug(self, url, status): |
|
450.6.1
by Daniel Schierbeck
Made bug tab prettier. |
83 |
self.bugs.append([url, status]) |
448
by Jelmer Vernooij
Add bugs tab in branch view. |
84 |
self.show_all() |
423.14.2
by Jelmer Vernooij
Move bugs tab to separate widget. |
85 |
|
86 |
||
399.1.15
by Jelmer Vernooij
Move signature tab to a separate class. |
87 |
class SignatureTab(gtk.VBox): |
88 |
def __init__(self): |
|
89 |
from gpg import GPGSubprocess |
|
90 |
self.gpg = GPGSubprocess() |
|
91 |
super(SignatureTab, self).__init__(False, 6) |
|
92 |
signature_box = gtk.Table(rows=1, columns=2) |
|
93 |
signature_box.set_col_spacing(0, 12) |
|
94 |
||
95 |
self.signature_image = gtk.Image() |
|
96 |
signature_box.attach(self.signature_image, 0, 1, 0, 1, gtk.FILL) |
|
97 |
||
98 |
self.signature_label = gtk.Label() |
|
99 |
signature_box.attach(self.signature_label, 1, 2, 0, 1, gtk.FILL) |
|
100 |
||
101 |
signature_info = gtk.Table(rows=1, columns=2) |
|
102 |
signature_info.set_row_spacings(6) |
|
103 |
signature_info.set_col_spacings(6) |
|
104 |
||
105 |
align = gtk.Alignment(1.0, 0.5) |
|
106 |
label = gtk.Label() |
|
107 |
label.set_markup("<b>Key Id:</b>") |
|
108 |
align.add(label) |
|
109 |
signature_info.attach(align, 0, 1, 0, 1, gtk.FILL, gtk.FILL) |
|
110 |
||
111 |
align = gtk.Alignment(0.0, 0.5) |
|
112 |
self.signature_key_id = gtk.Label() |
|
113 |
self.signature_key_id.set_selectable(True) |
|
114 |
align.add(self.signature_key_id) |
|
115 |
signature_info.attach(align, 1, 2, 0, 1, gtk.EXPAND | gtk.FILL, gtk.FILL) |
|
116 |
||
117 |
self.set_border_width(6) |
|
118 |
self.pack_start(signature_box, expand=False) |
|
119 |
self.pack_start(signature_info, expand=False) |
|
120 |
self.show_all() |
|
121 |
||
399.1.16
by Jelmer Vernooij
Move logic showing images to the SignatureTab widget. |
122 |
def show_no_signature(self): |
123 |
self.signature_key_id.set_text("") |
|
399.1.19
by Jelmer Vernooij
Add utility function for finding icon paths. |
124 |
self.signature_image.set_from_file(icon_path("sign-unknown.png")) |
399.1.16
by Jelmer Vernooij
Move logic showing images to the SignatureTab widget. |
125 |
self.signature_label.set_text("This revision has not been signed.") |
126 |
||
127 |
def show_signature(self, text): |
|
128 |
signature = self.gpg.verify(text) |
|
129 |
||
130 |
if signature.key_id is not None: |
|
131 |
self.signature_key_id.set_text(signature.key_id) |
|
132 |
||
133 |
if signature.is_valid(): |
|
399.1.19
by Jelmer Vernooij
Add utility function for finding icon paths. |
134 |
self.signature_image.set_from_file(icon_path("sign-ok.png")) |
399.1.16
by Jelmer Vernooij
Move logic showing images to the SignatureTab widget. |
135 |
self.signature_label.set_text("This revision has been signed.") |
136 |
else: |
|
399.1.19
by Jelmer Vernooij
Add utility function for finding icon paths. |
137 |
self.signature_image.set_from_file(icon_path("sign-bad.png")) |
399.1.16
by Jelmer Vernooij
Move logic showing images to the SignatureTab widget. |
138 |
self.signature_label.set_text("This revision has been signed, " + |
139 |
"but the authenticity of the signature cannot be verified.") |
|
140 |
||
399.1.15
by Jelmer Vernooij
Move signature tab to a separate class. |
141 |
|
330.3.1
by Daniel Schierbeck
Renamed logview 'revisionview'. |
142 |
class RevisionView(gtk.Notebook): |
0.1.1
by Dan Loda
First working version of xannotate. |
143 |
""" Custom widget for commit log details. |
144 |
||
145 |
A variety of bzr tools may need to implement such a thing. This is a
|
|
146 |
start.
|
|
147 |
"""
|
|
148 |
||
412.1.1
by Daniel Schierbeck
Added branch and revision properties to the revisionview widget. |
149 |
__gproperties__ = { |
150 |
'branch': ( |
|
151 |
gobject.TYPE_PYOBJECT, |
|
152 |
'Branch', |
|
153 |
'The branch holding the revision being displayed', |
|
154 |
gobject.PARAM_CONSTRUCT_ONLY | gobject.PARAM_WRITABLE |
|
155 |
),
|
|
156 |
||
157 |
'revision': ( |
|
158 |
gobject.TYPE_PYOBJECT, |
|
159 |
'Revision', |
|
160 |
'The revision being displayed', |
|
412.1.2
by Daniel Schierbeck
Moved retrieval of tags into the revisionview itself. |
161 |
gobject.PARAM_READWRITE |
412.1.7
by Daniel Schierbeck
Added file-id property to the revisionview. |
162 |
),
|
163 |
||
412.1.13
by Daniel Schierbeck
Re-added support for displaying the children of a revision. |
164 |
'children': ( |
165 |
gobject.TYPE_PYOBJECT, |
|
166 |
'Children', |
|
167 |
'Child revisions', |
|
168 |
gobject.PARAM_READWRITE |
|
169 |
),
|
|
170 |
||
412.1.7
by Daniel Schierbeck
Added file-id property to the revisionview. |
171 |
'file-id': ( |
172 |
gobject.TYPE_PYOBJECT, |
|
173 |
'File Id', |
|
174 |
'The file id', |
|
175 |
gobject.PARAM_READWRITE |
|
412.1.1
by Daniel Schierbeck
Added branch and revision properties to the revisionview widget. |
176 |
)
|
177 |
}
|
|
178 |
||
179 |
||
412.1.2
by Daniel Schierbeck
Moved retrieval of tags into the revisionview itself. |
180 |
def __init__(self, branch=None): |
324.2.1
by Daniel Schierbeck
Turned the logview into a notebook. |
181 |
gtk.Notebook.__init__(self) |
324.2.4
by Daniel Schierbeck
Added 'Changes' page to logview. |
182 |
|
324.2.1
by Daniel Schierbeck
Turned the logview into a notebook. |
183 |
self._create_general() |
184 |
self._create_relations() |
|
399.1.6
by Daniel Schierbeck
Made signature page label singular. |
185 |
self._create_signature() |
278.1.45
by John Arbash Meinel
Switch to a new tab for per-file messages. |
186 |
self._create_file_info_view() |
423.14.1
by Jelmer Vernooij
Add bugs tab to display bug status change metadata. |
187 |
self._create_bugs() |
324.2.9
by Daniel Schierbeck
Made 'General' the default page of the logview. |
188 |
|
189 |
self.set_current_page(0) |
|
324.2.4
by Daniel Schierbeck
Added 'Changes' page to logview. |
190 |
|
147
by Jelmer Vernooij
Remove a bunch of duplicate functionality. |
191 |
self._show_callback = None |
192 |
self._clicked_callback = None |
|
0.1.1
by Dan Loda
First working version of xannotate. |
193 |
|
412.1.9
by Daniel Schierbeck
Removed the use of RevisionView.set_go_callback(). |
194 |
self._revision = None |
324.2.4
by Daniel Schierbeck
Added 'Changes' page to logview. |
195 |
self._branch = branch |
196 |
||
423.7.4
by Daniel Schierbeck
Made revisionview and branchview update when a tag is added. |
197 |
self.update_tags() |
412.1.2
by Daniel Schierbeck
Moved retrieval of tags into the revisionview itself. |
198 |
|
278.1.3
by John Arbash Meinel
Have the ability to tell the log view that we only care about a specific file_id. |
199 |
self.set_file_id(None) |
0.1.1
by Dan Loda
First working version of xannotate. |
200 |
|
412.1.1
by Daniel Schierbeck
Added branch and revision properties to the revisionview widget. |
201 |
def do_get_property(self, property): |
202 |
if property.name == 'branch': |
|
203 |
return self._branch |
|
204 |
elif property.name == 'revision': |
|
205 |
return self._revision |
|
412.1.13
by Daniel Schierbeck
Re-added support for displaying the children of a revision. |
206 |
elif property.name == 'children': |
207 |
return self._children |
|
412.1.7
by Daniel Schierbeck
Added file-id property to the revisionview. |
208 |
elif property.name == 'file-id': |
209 |
return self._file_id |
|
412.1.1
by Daniel Schierbeck
Added branch and revision properties to the revisionview widget. |
210 |
else: |
211 |
raise AttributeError, 'unknown property %s' % property.name |
|
212 |
||
213 |
def do_set_property(self, property, value): |
|
214 |
if property.name == 'branch': |
|
215 |
self._branch = value |
|
216 |
elif property.name == 'revision': |
|
217 |
self._set_revision(value) |
|
412.1.13
by Daniel Schierbeck
Re-added support for displaying the children of a revision. |
218 |
elif property.name == 'children': |
219 |
self.set_children(value) |
|
412.1.7
by Daniel Schierbeck
Added file-id property to the revisionview. |
220 |
elif property.name == 'file-id': |
221 |
self._file_id = value |
|
412.1.1
by Daniel Schierbeck
Added branch and revision properties to the revisionview widget. |
222 |
else: |
223 |
raise AttributeError, 'unknown property %s' % property.name |
|
224 |
||
147
by Jelmer Vernooij
Remove a bunch of duplicate functionality. |
225 |
def set_show_callback(self, callback): |
226 |
self._show_callback = callback |
|
227 |
||
278.1.3
by John Arbash Meinel
Have the ability to tell the log view that we only care about a specific file_id. |
228 |
def set_file_id(self, file_id): |
229 |
"""Set a specific file id that we want to track. |
|
230 |
||
231 |
This just effects the display of a per-file commit message.
|
|
232 |
If it is set to None, then all commit messages will be shown.
|
|
233 |
"""
|
|
412.1.7
by Daniel Schierbeck
Added file-id property to the revisionview. |
234 |
self.set_property('file-id', file_id) |
278.1.3
by John Arbash Meinel
Have the ability to tell the log view that we only care about a specific file_id. |
235 |
|
412.1.13
by Daniel Schierbeck
Re-added support for displaying the children of a revision. |
236 |
def set_revision(self, revision): |
412.1.9
by Daniel Schierbeck
Removed the use of RevisionView.set_go_callback(). |
237 |
if revision != self._revision: |
238 |
self.set_property('revision', revision) |
|
239 |
||
240 |
def get_revision(self): |
|
241 |
return self.get_property('revision') |
|
412.1.1
by Daniel Schierbeck
Added branch and revision properties to the revisionview widget. |
242 |
|
412.1.15
by Daniel Schierbeck
Removed redundant method argument. |
243 |
def _set_revision(self, revision): |
412.1.1
by Daniel Schierbeck
Added branch and revision properties to the revisionview widget. |
244 |
if revision is None: return |
245 |
||
147
by Jelmer Vernooij
Remove a bunch of duplicate functionality. |
246 |
self._revision = revision |
192
by Jelmer Vernooij
Allow committer to be None. |
247 |
if revision.committer is not None: |
248 |
self.committer.set_text(revision.committer) |
|
249 |
else: |
|
250 |
self.committer.set_text("") |
|
259
by Aaron Bentley
Add author support to gannotate and log viewer |
251 |
author = revision.properties.get('author', '') |
252 |
if author != '': |
|
253 |
self.author.set_text(author) |
|
254 |
self.author.show() |
|
255 |
self.author_label.show() |
|
256 |
else: |
|
257 |
self.author.hide() |
|
258 |
self.author_label.hide() |
|
259 |
||
197
by Jelmer Vernooij
Fix some warnings when displaying ghost revisions. Reported by John. |
260 |
if revision.timestamp is not None: |
261 |
self.timestamp.set_text(format_date(revision.timestamp, |
|
262 |
revision.timezone)) |
|
147
by Jelmer Vernooij
Remove a bunch of duplicate functionality. |
263 |
try: |
264 |
self.branchnick_label.set_text(revision.properties['branch-nick']) |
|
265 |
except KeyError: |
|
266 |
self.branchnick_label.set_text("") |
|
267 |
||
256.2.23
by Gary van der Merwe
Show Children |
268 |
self._add_parents_or_children(revision.parent_ids, |
269 |
self.parents_widgets, |
|
270 |
self.parents_table) |
|
271 |
||
278.1.3
by John Arbash Meinel
Have the ability to tell the log view that we only care about a specific file_id. |
272 |
file_info = revision.properties.get('file-info', None) |
278.1.2
by John Arbash Meinel
Add an extra box that pops up when we have per-file information. |
273 |
if file_info is not None: |
412.1.8
by Daniel Schierbeck
Only import the bdecode function from the bzrlib.util.bencode package. |
274 |
file_info = bdecode(file_info.encode('UTF-8')) |
278.1.2
by John Arbash Meinel
Add an extra box that pops up when we have per-file information. |
275 |
|
276 |
if file_info: |
|
278.1.3
by John Arbash Meinel
Have the ability to tell the log view that we only care about a specific file_id. |
277 |
if self._file_id is None: |
278 |
text = [] |
|
279 |
for fi in file_info: |
|
280 |
text.append('%(path)s\n%(message)s' % fi) |
|
281 |
self.file_info_buffer.set_text('\n'.join(text)) |
|
282 |
self.file_info_box.show() |
|
283 |
else: |
|
284 |
text = [] |
|
285 |
for fi in file_info: |
|
286 |
if fi['file_id'] == self._file_id: |
|
287 |
text.append(fi['message']) |
|
288 |
if text: |
|
289 |
self.file_info_buffer.set_text('\n'.join(text)) |
|
290 |
self.file_info_box.show() |
|
291 |
else: |
|
292 |
self.file_info_box.hide() |
|
278.1.2
by John Arbash Meinel
Add an extra box that pops up when we have per-file information. |
293 |
else: |
294 |
self.file_info_box.hide() |
|
295 |
||
423.14.3
by Jelmer Vernooij
Always show bugs tab. |
296 |
self.bugs_table.clear() |
423.14.1
by Jelmer Vernooij
Add bugs tab to display bug status change metadata. |
297 |
bugs_text = revision.properties.get('bugs', None) |
298 |
if bugs_text: |
|
299 |
for bugline in bugs_text.splitlines(): |
|
300 |
(url, status) = bugline.split(" ") |
|
423.14.2
by Jelmer Vernooij
Move bugs tab to separate widget. |
301 |
self.bugs_table.add_bug(url, status) |
423.14.1
by Jelmer Vernooij
Add bugs tab to display bug status change metadata. |
302 |
|
423.7.4
by Daniel Schierbeck
Made revisionview and branchview update when a tag is added. |
303 |
def update_tags(self): |
304 |
if self._branch is not None and self._branch.supports_tags(): |
|
305 |
self._tagdict = self._branch.tags.get_reverse_tag_dict() |
|
306 |
else: |
|
307 |
self._tagdict = {} |
|
308 |
||
309 |
self._add_tags() |
|
310 |
||
399.1.13
by Daniel Schierbeck
Merged with mainline. |
311 |
def _update_signature(self, widget, param): |
312 |
revid = self._revision.revision_id |
|
313 |
||
314 |
if self._branch.repository.has_signature_for_revision_id(revid): |
|
315 |
signature_text = self._branch.repository.get_signature_text(revid) |
|
399.1.16
by Jelmer Vernooij
Move logic showing images to the SignatureTab widget. |
316 |
self.signature_table.show_signature(signature_text) |
399.1.13
by Daniel Schierbeck
Merged with mainline. |
317 |
else: |
399.1.16
by Jelmer Vernooij
Move logic showing images to the SignatureTab widget. |
318 |
self.signature_table.show_no_signature() |
399.1.13
by Daniel Schierbeck
Merged with mainline. |
319 |
|
412.1.13
by Daniel Schierbeck
Re-added support for displaying the children of a revision. |
320 |
def set_children(self, children): |
321 |
self._add_parents_or_children(children, |
|
322 |
self.children_widgets, |
|
323 |
self.children_table) |
|
324 |
||
147
by Jelmer Vernooij
Remove a bunch of duplicate functionality. |
325 |
def _show_clicked_cb(self, widget, revid, parentid): |
326 |
"""Callback for when the show button for a parent is clicked.""" |
|
327 |
self._show_callback(revid, parentid) |
|
328 |
||
329 |
def _go_clicked_cb(self, widget, revid): |
|
330 |
"""Callback for when the go button for a parent is clicked.""" |
|
331 |
||
412.1.4
by Daniel Schierbeck
Made tag list smarter. |
332 |
def _add_tags(self, *args): |
399.1.13
by Daniel Schierbeck
Merged with mainline. |
333 |
if self._revision is None: |
334 |
return
|
|
423.7.4
by Daniel Schierbeck
Made revisionview and branchview update when a tag is added. |
335 |
|
412.1.4
by Daniel Schierbeck
Made tag list smarter. |
336 |
if self._tagdict.has_key(self._revision.revision_id): |
337 |
tags = self._tagdict[self._revision.revision_id] |
|
338 |
else: |
|
339 |
tags = [] |
|
340 |
||
241
by Jelmer Vernooij
Show tags in bzr viz. |
341 |
if tags == []: |
342 |
self.tags_list.hide() |
|
343 |
self.tags_label.hide() |
|
344 |
return
|
|
345 |
||
423.3.1
by Daniel Schierbeck
Made the tag list be a comma-separated line instead of a vertically stacked box. |
346 |
self.tags_list.set_text(", ".join(tags)) |
347 |
||
241
by Jelmer Vernooij
Show tags in bzr viz. |
348 |
self.tags_list.show_all() |
349 |
self.tags_label.show_all() |
|
350 |
||
256.2.23
by Gary van der Merwe
Show Children |
351 |
def _add_parents_or_children(self, revids, widgets, table): |
352 |
while len(widgets) > 0: |
|
353 |
widget = widgets.pop() |
|
354 |
table.remove(widget) |
|
355 |
||
356 |
table.resize(max(len(revids), 1), 2) |
|
147
by Jelmer Vernooij
Remove a bunch of duplicate functionality. |
357 |
|
256.2.23
by Gary van der Merwe
Show Children |
358 |
for idx, revid in enumerate(revids): |
147
by Jelmer Vernooij
Remove a bunch of duplicate functionality. |
359 |
align = gtk.Alignment(0.0, 0.0) |
256.2.23
by Gary van der Merwe
Show Children |
360 |
widgets.append(align) |
361 |
table.attach(align, 1, 2, idx, idx + 1, |
|
147
by Jelmer Vernooij
Remove a bunch of duplicate functionality. |
362 |
gtk.EXPAND | gtk.FILL, gtk.FILL) |
0.1.1
by Dan Loda
First working version of xannotate. |
363 |
align.show() |
147
by Jelmer Vernooij
Remove a bunch of duplicate functionality. |
364 |
|
365 |
hbox = gtk.HBox(False, spacing=6) |
|
366 |
align.add(hbox) |
|
367 |
hbox.show() |
|
368 |
||
369 |
image = gtk.Image() |
|
370 |
image.set_from_stock( |
|
371 |
gtk.STOCK_FIND, gtk.ICON_SIZE_SMALL_TOOLBAR) |
|
372 |
image.show() |
|
373 |
||
148
by Jelmer Vernooij
Clean up interface a bit: don't show diff button when no diff can be accessed, use label instead of button when there is no callback set. |
374 |
if self._show_callback is not None: |
375 |
button = gtk.Button() |
|
376 |
button.add(image) |
|
377 |
button.connect("clicked", self._show_clicked_cb, |
|
256.2.23
by Gary van der Merwe
Show Children |
378 |
self._revision.revision_id, revid) |
148
by Jelmer Vernooij
Clean up interface a bit: don't show diff button when no diff can be accessed, use label instead of button when there is no callback set. |
379 |
hbox.pack_start(button, expand=False, fill=True) |
380 |
button.show() |
|
147
by Jelmer Vernooij
Remove a bunch of duplicate functionality. |
381 |
|
412.1.9
by Daniel Schierbeck
Removed the use of RevisionView.set_go_callback(). |
382 |
button = gtk.Button(revid) |
383 |
button.connect("clicked", |
|
412.1.14
by Daniel Schierbeck
Fixed bug in the way the child buttons worked. |
384 |
lambda w, r: self.set_revision(self._branch.repository.get_revision(r)), revid) |
147
by Jelmer Vernooij
Remove a bunch of duplicate functionality. |
385 |
button.set_use_underline(False) |
386 |
hbox.pack_start(button, expand=False, fill=True) |
|
387 |
button.show() |
|
0.1.1
by Dan Loda
First working version of xannotate. |
388 |
|
324.2.1
by Daniel Schierbeck
Turned the logview into a notebook. |
389 |
def _create_general(self): |
0.1.1
by Dan Loda
First working version of xannotate. |
390 |
vbox = gtk.VBox(False, 6) |
391 |
vbox.set_border_width(6) |
|
392 |
vbox.pack_start(self._create_headers(), expand=False, fill=True) |
|
324.2.1
by Daniel Schierbeck
Turned the logview into a notebook. |
393 |
vbox.pack_start(self._create_message_view()) |
394 |
self.append_page(vbox, tab_label=gtk.Label("General")) |
|
395 |
vbox.show() |
|
396 |
||
397 |
def _create_relations(self): |
|
398 |
vbox = gtk.VBox(False, 6) |
|
399 |
vbox.set_border_width(6) |
|
291
by Jelmer Vernooij
Put children widget on a new line. |
400 |
vbox.pack_start(self._create_parents(), expand=False, fill=True) |
412.1.13
by Daniel Schierbeck
Re-added support for displaying the children of a revision. |
401 |
vbox.pack_start(self._create_children(), expand=False, fill=True) |
324.2.1
by Daniel Schierbeck
Turned the logview into a notebook. |
402 |
self.append_page(vbox, tab_label=gtk.Label("Relations")) |
0.1.1
by Dan Loda
First working version of xannotate. |
403 |
vbox.show() |
324.2.4
by Daniel Schierbeck
Added 'Changes' page to logview. |
404 |
|
399.1.10
by Daniel Schierbeck
Improved implementation of the Signature page. |
405 |
def _create_signature(self): |
399.1.15
by Jelmer Vernooij
Move signature tab to a separate class. |
406 |
try: |
407 |
self.signature_table = SignatureTab() |
|
399.1.21
by Jelmer Vernooij
Hide signature tab if gpg binary wasn't found. |
408 |
except ValueError: # No GPG found |
399.1.15
by Jelmer Vernooij
Move signature tab to a separate class. |
409 |
self.signature_table = None |
410 |
return
|
|
411 |
self.append_page(self.signature_table, tab_label=gtk.Label('Signature')) |
|
399.1.10
by Daniel Schierbeck
Improved implementation of the Signature page. |
412 |
self.connect_after('notify::revision', self._update_signature) |
413 |
||
0.1.1
by Dan Loda
First working version of xannotate. |
414 |
def _create_headers(self): |
241
by Jelmer Vernooij
Show tags in bzr viz. |
415 |
self.table = gtk.Table(rows=5, columns=2) |
0.1.1
by Dan Loda
First working version of xannotate. |
416 |
self.table.set_row_spacings(6) |
417 |
self.table.set_col_spacings(6) |
|
418 |
self.table.show() |
|
147
by Jelmer Vernooij
Remove a bunch of duplicate functionality. |
419 |
|
420 |
align = gtk.Alignment(1.0, 0.5) |
|
421 |
label = gtk.Label() |
|
422 |
label.set_markup("<b>Revision Id:</b>") |
|
423 |
align.add(label) |
|
424 |
self.table.attach(align, 0, 1, 0, 1, gtk.FILL, gtk.FILL) |
|
425 |
align.show() |
|
426 |
label.show() |
|
427 |
||
428 |
align = gtk.Alignment(0.0, 0.5) |
|
412.1.5
by Daniel Schierbeck
Made the revision id label use signals when updating. |
429 |
revision_id = gtk.Label() |
430 |
revision_id.set_selectable(True) |
|
431 |
self.connect('notify::revision', |
|
432 |
lambda w, p: revision_id.set_text(self._revision.revision_id)) |
|
433 |
align.add(revision_id) |
|
147
by Jelmer Vernooij
Remove a bunch of duplicate functionality. |
434 |
self.table.attach(align, 1, 2, 0, 1, gtk.EXPAND | gtk.FILL, gtk.FILL) |
435 |
align.show() |
|
412.1.5
by Daniel Schierbeck
Made the revision id label use signals when updating. |
436 |
revision_id.show() |
147
by Jelmer Vernooij
Remove a bunch of duplicate functionality. |
437 |
|
0.1.1
by Dan Loda
First working version of xannotate. |
438 |
align = gtk.Alignment(1.0, 0.5) |
259
by Aaron Bentley
Add author support to gannotate and log viewer |
439 |
self.author_label = gtk.Label() |
440 |
self.author_label.set_markup("<b>Author:</b>") |
|
441 |
align.add(self.author_label) |
|
442 |
self.table.attach(align, 0, 1, 1, 2, gtk.FILL, gtk.FILL) |
|
443 |
align.show() |
|
444 |
self.author_label.show() |
|
445 |
||
446 |
align = gtk.Alignment(0.0, 0.5) |
|
447 |
self.author = gtk.Label() |
|
448 |
self.author.set_selectable(True) |
|
449 |
align.add(self.author) |
|
450 |
self.table.attach(align, 1, 2, 1, 2, gtk.EXPAND | gtk.FILL, gtk.FILL) |
|
451 |
align.show() |
|
452 |
self.author.show() |
|
453 |
self.author.hide() |
|
454 |
||
455 |
align = gtk.Alignment(1.0, 0.5) |
|
0.1.1
by Dan Loda
First working version of xannotate. |
456 |
label = gtk.Label() |
457 |
label.set_markup("<b>Committer:</b>") |
|
458 |
align.add(label) |
|
259
by Aaron Bentley
Add author support to gannotate and log viewer |
459 |
self.table.attach(align, 0, 1, 2, 3, gtk.FILL, gtk.FILL) |
0.1.1
by Dan Loda
First working version of xannotate. |
460 |
align.show() |
461 |
label.show() |
|
462 |
||
463 |
align = gtk.Alignment(0.0, 0.5) |
|
464 |
self.committer = gtk.Label() |
|
465 |
self.committer.set_selectable(True) |
|
466 |
align.add(self.committer) |
|
259
by Aaron Bentley
Add author support to gannotate and log viewer |
467 |
self.table.attach(align, 1, 2, 2, 3, gtk.EXPAND | gtk.FILL, gtk.FILL) |
0.1.1
by Dan Loda
First working version of xannotate. |
468 |
align.show() |
469 |
self.committer.show() |
|
470 |
||
147
by Jelmer Vernooij
Remove a bunch of duplicate functionality. |
471 |
align = gtk.Alignment(0.0, 0.5) |
472 |
label = gtk.Label() |
|
473 |
label.set_markup("<b>Branch nick:</b>") |
|
474 |
align.add(label) |
|
259
by Aaron Bentley
Add author support to gannotate and log viewer |
475 |
self.table.attach(align, 0, 1, 3, 4, gtk.FILL, gtk.FILL) |
147
by Jelmer Vernooij
Remove a bunch of duplicate functionality. |
476 |
label.show() |
477 |
align.show() |
|
478 |
||
479 |
align = gtk.Alignment(0.0, 0.5) |
|
480 |
self.branchnick_label = gtk.Label() |
|
481 |
self.branchnick_label.set_selectable(True) |
|
482 |
align.add(self.branchnick_label) |
|
259
by Aaron Bentley
Add author support to gannotate and log viewer |
483 |
self.table.attach(align, 1, 2, 3, 4, gtk.EXPAND | gtk.FILL, gtk.FILL) |
147
by Jelmer Vernooij
Remove a bunch of duplicate functionality. |
484 |
self.branchnick_label.show() |
485 |
align.show() |
|
486 |
||
0.1.1
by Dan Loda
First working version of xannotate. |
487 |
align = gtk.Alignment(1.0, 0.5) |
488 |
label = gtk.Label() |
|
489 |
label.set_markup("<b>Timestamp:</b>") |
|
490 |
align.add(label) |
|
259
by Aaron Bentley
Add author support to gannotate and log viewer |
491 |
self.table.attach(align, 0, 1, 4, 5, gtk.FILL, gtk.FILL) |
0.1.1
by Dan Loda
First working version of xannotate. |
492 |
align.show() |
493 |
label.show() |
|
494 |
||
495 |
align = gtk.Alignment(0.0, 0.5) |
|
496 |
self.timestamp = gtk.Label() |
|
497 |
self.timestamp.set_selectable(True) |
|
498 |
align.add(self.timestamp) |
|
259
by Aaron Bentley
Add author support to gannotate and log viewer |
499 |
self.table.attach(align, 1, 2, 4, 5, gtk.EXPAND | gtk.FILL, gtk.FILL) |
0.1.1
by Dan Loda
First working version of xannotate. |
500 |
align.show() |
501 |
self.timestamp.show() |
|
502 |
||
241
by Jelmer Vernooij
Show tags in bzr viz. |
503 |
align = gtk.Alignment(1.0, 0.5) |
504 |
self.tags_label = gtk.Label() |
|
505 |
self.tags_label.set_markup("<b>Tags:</b>") |
|
506 |
align.add(self.tags_label) |
|
507 |
align.show() |
|
261
by Aaron Bentley
Fix tags formatting |
508 |
self.table.attach(align, 0, 1, 5, 6, gtk.FILL, gtk.FILL) |
241
by Jelmer Vernooij
Show tags in bzr viz. |
509 |
self.tags_label.show() |
510 |
||
511 |
align = gtk.Alignment(0.0, 0.5) |
|
423.3.1
by Daniel Schierbeck
Made the tag list be a comma-separated line instead of a vertically stacked box. |
512 |
self.tags_list = gtk.Label() |
241
by Jelmer Vernooij
Show tags in bzr viz. |
513 |
align.add(self.tags_list) |
261
by Aaron Bentley
Fix tags formatting |
514 |
self.table.attach(align, 1, 2, 5, 6, gtk.EXPAND | gtk.FILL, gtk.FILL) |
241
by Jelmer Vernooij
Show tags in bzr viz. |
515 |
align.show() |
516 |
self.tags_list.show() |
|
517 |
||
412.1.4
by Daniel Schierbeck
Made tag list smarter. |
518 |
self.connect('notify::revision', self._add_tags) |
519 |
||
0.1.1
by Dan Loda
First working version of xannotate. |
520 |
return self.table |
256.2.23
by Gary van der Merwe
Show Children |
521 |
|
291
by Jelmer Vernooij
Put children widget on a new line. |
522 |
def _create_parents(self): |
523 |
hbox = gtk.HBox(True, 3) |
|
256.2.23
by Gary van der Merwe
Show Children |
524 |
|
525 |
self.parents_table = self._create_parents_or_children_table( |
|
526 |
"<b>Parents:</b>") |
|
147
by Jelmer Vernooij
Remove a bunch of duplicate functionality. |
527 |
self.parents_widgets = [] |
256.2.23
by Gary van der Merwe
Show Children |
528 |
hbox.pack_start(self.parents_table) |
291
by Jelmer Vernooij
Put children widget on a new line. |
529 |
|
530 |
hbox.show() |
|
531 |
return hbox |
|
532 |
||
533 |
def _create_children(self): |
|
534 |
hbox = gtk.HBox(True, 3) |
|
535 |
self.children_table = self._create_parents_or_children_table( |
|
536 |
"<b>Children:</b>") |
|
537 |
self.children_widgets = [] |
|
538 |
hbox.pack_start(self.children_table) |
|
256.2.23
by Gary van der Merwe
Show Children |
539 |
hbox.show() |
540 |
return hbox |
|
541 |
||
542 |
def _create_parents_or_children_table(self, text): |
|
543 |
table = gtk.Table(rows=1, columns=2) |
|
544 |
table.set_row_spacings(3) |
|
545 |
table.set_col_spacings(6) |
|
546 |
table.show() |
|
147
by Jelmer Vernooij
Remove a bunch of duplicate functionality. |
547 |
|
548 |
label = gtk.Label() |
|
256.2.23
by Gary van der Merwe
Show Children |
549 |
label.set_markup(text) |
147
by Jelmer Vernooij
Remove a bunch of duplicate functionality. |
550 |
align = gtk.Alignment(0.0, 0.5) |
551 |
align.add(label) |
|
256.2.23
by Gary van der Merwe
Show Children |
552 |
table.attach(align, 0, 1, 0, 1, gtk.FILL, gtk.FILL) |
147
by Jelmer Vernooij
Remove a bunch of duplicate functionality. |
553 |
label.show() |
554 |
align.show() |
|
555 |
||
256.2.23
by Gary van der Merwe
Show Children |
556 |
return table |
147
by Jelmer Vernooij
Remove a bunch of duplicate functionality. |
557 |
|
0.1.1
by Dan Loda
First working version of xannotate. |
558 |
def _create_message_view(self): |
412.1.6
by Daniel Schierbeck
Made the message buffer use signals when updating. |
559 |
msg_buffer = gtk.TextBuffer() |
560 |
self.connect('notify::revision', |
|
561 |
lambda w, p: msg_buffer.set_text(self._revision.message)) |
|
324.2.2
by Daniel Schierbeck
Surrounded the commit message textview with a scrolled window and added a shadow. |
562 |
window = gtk.ScrolledWindow() |
563 |
window.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC) |
|
564 |
window.set_shadow_type(gtk.SHADOW_IN) |
|
412.1.6
by Daniel Schierbeck
Made the message buffer use signals when updating. |
565 |
tv = gtk.TextView(msg_buffer) |
0.1.1
by Dan Loda
First working version of xannotate. |
566 |
tv.set_editable(False) |
567 |
tv.set_wrap_mode(gtk.WRAP_WORD) |
|
399.1.13
by Daniel Schierbeck
Merged with mainline. |
568 |
|
0.1.1
by Dan Loda
First working version of xannotate. |
569 |
tv.modify_font(pango.FontDescription("Monospace")) |
570 |
tv.show() |
|
324.2.2
by Daniel Schierbeck
Surrounded the commit message textview with a scrolled window and added a shadow. |
571 |
window.add(tv) |
572 |
window.show() |
|
573 |
return window |
|
0.1.1
by Dan Loda
First working version of xannotate. |
574 |
|
423.14.1
by Jelmer Vernooij
Add bugs tab to display bug status change metadata. |
575 |
def _create_bugs(self): |
423.14.2
by Jelmer Vernooij
Move bugs tab to separate widget. |
576 |
self.bugs_table = BugsTab() |
423.14.1
by Jelmer Vernooij
Add bugs tab to display bug status change metadata. |
577 |
self.append_page(self.bugs_table, tab_label=gtk.Label('Bugs')) |
578 |
||
278.1.2
by John Arbash Meinel
Add an extra box that pops up when we have per-file information. |
579 |
def _create_file_info_view(self): |
278.1.45
by John Arbash Meinel
Switch to a new tab for per-file messages. |
580 |
self.file_info_box = gtk.VBox(False, 6) |
581 |
self.file_info_box.set_border_width(6) |
|
278.1.2
by John Arbash Meinel
Add an extra box that pops up when we have per-file information. |
582 |
self.file_info_buffer = gtk.TextBuffer() |
278.1.44
by John Arbash Meinel
Merge in trunk, and update logview per-file commit messages. |
583 |
window = gtk.ScrolledWindow() |
584 |
window.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC) |
|
585 |
window.set_shadow_type(gtk.SHADOW_IN) |
|
278.1.2
by John Arbash Meinel
Add an extra box that pops up when we have per-file information. |
586 |
tv = gtk.TextView(self.file_info_buffer) |
587 |
tv.set_editable(False) |
|
588 |
tv.set_wrap_mode(gtk.WRAP_WORD) |
|
589 |
tv.modify_font(pango.FontDescription("Monospace")) |
|
590 |
tv.show() |
|
278.1.44
by John Arbash Meinel
Merge in trunk, and update logview per-file commit messages. |
591 |
window.add(tv) |
592 |
window.show() |
|
593 |
self.file_info_box.pack_start(window) |
|
278.1.2
by John Arbash Meinel
Add an extra box that pops up when we have per-file information. |
594 |
self.file_info_box.hide() # Only shown when there are per-file messages |
278.1.45
by John Arbash Meinel
Switch to a new tab for per-file messages. |
595 |
self.append_page(self.file_info_box, tab_label=gtk.Label('Per-file')) |
278.1.2
by John Arbash Meinel
Add an extra box that pops up when we have per-file information. |
596 |