28
29
gpg = GPGSubprocess()
31
def _open_link(widget, uri):
32
subprocess.Popen(['sensible-browser', uri], close_fds=True)
34
gtk.link_button_set_uri_hook(_open_link)
36
class BugsTab(gtk.Table):
38
super(BugsTab, self).__init__(rows=5, columns=2)
39
self.set_row_spacings(6)
40
self.set_col_spacings(6)
44
for c in self.get_children():
47
self.hide_all() # Only shown when there are bugs
49
def add_bug(self, url, status):
50
button = gtk.LinkButton(url, url)
51
self.attach(button, 0, 1, self.count, self.count + 1,
52
gtk.EXPAND | gtk.FILL, gtk.FILL)
53
status_label = gtk.Label(status)
54
self.attach(status_label, 1, 2, self.count, self.count + 1,
55
gtk.EXPAND | gtk.FILL, gtk.FILL)
30
60
class RevisionView(gtk.Notebook):
31
61
""" Custom widget for commit log details.
131
158
def get_revision(self):
132
159
return self.get_property('revision')
134
def set_children(self, children):
135
self._add_parents_or_children(children,
136
self.children_widgets,
139
161
def _set_revision(self, revision):
140
162
if revision is None: return
190
212
self.file_info_box.hide()
214
self.bugs_table.clear()
215
bugs_text = revision.properties.get('bugs', None)
217
for bugline in bugs_text.splitlines():
218
(url, status) = bugline.split(" ")
219
self.bugs_table.add_bug(url, status)
221
def update_tags(self):
222
if self._branch is not None and self._branch.supports_tags():
223
self._tagdict = self._branch.tags.get_reverse_tag_dict()
229
def _update_signature(self, widget, param):
230
revid = self._revision.revision_id
232
if self._branch.repository.has_signature_for_revision_id(revid):
233
signature_text = self._branch.repository.get_signature_text(revid)
234
signature = gpg.verify(signature_text)
236
if signature.key_id is not None:
237
self.signature_key_id.set_text(signature.key_id)
239
if signature.is_valid():
240
self.signature_image.set_from_file("icons/sign-ok.png")
241
self.signature_label.set_text("This revision has been signed.")
243
self.signature_image.set_from_file("icons/sign-bad.png")
244
self.signature_label.set_text("This revision has been signed, " +
245
"but the authenticity of the signature cannot be verified.")
247
self.signature_key_id.set_text("")
248
self.signature_image.set_from_file("icons/sign-unknown.png")
249
self.signature_label.set_text("This revision has not been signed.")
251
def set_children(self, children):
252
self._add_parents_or_children(children,
253
self.children_widgets,
192
256
def _show_clicked_cb(self, widget, revid, parentid):
193
257
"""Callback for when the show button for a parent is clicked."""
194
258
self._show_callback(revid, parentid)
197
261
"""Callback for when the go button for a parent is clicked."""
199
263
def _add_tags(self, *args):
264
if self._revision is None:
200
267
if self._tagdict.has_key(self._revision.revision_id):
201
268
tags = self._tagdict[self._revision.revision_id]
455
522
tv = gtk.TextView(msg_buffer)
456
523
tv.set_editable(False)
457
524
tv.set_wrap_mode(gtk.WRAP_WORD)
458
526
tv.modify_font(pango.FontDescription("Monospace"))
532
def _create_bugs(self):
533
self.bugs_table = BugsTab()
534
self.append_page(self.bugs_table, tab_label=gtk.Label('Bugs'))
464
536
def _create_file_info_view(self):
465
537
self.file_info_box = gtk.VBox(False, 6)
466
538
self.file_info_box.set_border_width(6)
479
551
self.file_info_box.hide() # Only shown when there are per-file messages
480
552
self.append_page(self.file_info_box, tab_label=gtk.Label('Per-file'))
482
def _update_signature(self, widget, param):
483
revid = self._revision.revision_id
485
if self._repository.has_signature_for_revision_id(revid):
486
signature_text = self._repository.get_signature_text(revid)
487
signature = gpg.verify(signature_text)
489
if signature.key_id is not None:
490
self.signature_key_id.set_text(signature.key_id)
492
if signature.is_valid():
493
self.signature_image.set_from_file("icons/sign-ok.png")
494
self.signature_label.set_text("This revision has been signed.")
496
self.signature_image.set_from_file("icons/sign-bad.png")
497
self.signature_label.set_text("This revision has been signed, " +
498
"but the authenticity of the signature cannot be verified.")
500
self.signature_key_id.set_text("")
501
self.signature_image.set_from_file("icons/sign-unknown.png")
502
self.signature_label.set_text("This revision has not been signed.")