25
25
from bzrlib.osutils import format_date
26
26
from bzrlib.util.bencode import bdecode
28
def _open_link(widget, uri):
29
subprocess.Popen(['sensible-browser', uri], close_fds=True)
31
gtk.link_button_set_uri_hook(_open_link)
33
class BugsTab(gtk.Table):
35
super(BugsTab, self).__init__(rows=5, columns=2)
36
self.set_row_spacings(6)
37
self.set_col_spacings(6)
38
self.hide() # Only shown when there are bugs
41
for c in self.get_children():
45
def add_bug(self, url, status):
46
button = gtk.LinkButton(url, url)
47
self.attach(button, 0, 1, self.count, self.count + 1,
48
gtk.EXPAND | gtk.FILL, gtk.FILL)
49
status_label = gtk.Label(status)
50
self.attach(status_label, 1, 2, self.count, self.count + 1,
51
gtk.EXPAND | gtk.FILL, gtk.FILL)
28
55
class RevisionView(gtk.Notebook):
29
56
""" Custom widget for commit log details.
128
155
def get_revision(self):
129
156
return self.get_property('revision')
131
def _open_link(self, widget, uri):
132
subprocess.Popen(['sensible-browser', uri], close_fds=True)
134
158
def _set_revision(self, revision):
135
159
if revision is None: return
187
211
bugs_text = revision.properties.get('bugs', None)
189
for c in self.bugs_table.get_children():
190
self.bugs_table.remove(c)
192
213
for bugline in bugs_text.splitlines():
193
214
(url, status) = bugline.split(" ")
194
button = gtk.LinkButton(url, url)
195
gtk.link_button_set_uri_hook(self._open_link)
196
self.bugs_table.attach(button, 0, 1, idx, idx + 1,
197
gtk.EXPAND | gtk.FILL, gtk.FILL)
198
status_label = gtk.Label(status)
199
self.bugs_table.attach(status_label, 1, 2, idx, idx + 1,
200
gtk.EXPAND | gtk.FILL, gtk.FILL)
215
self.bugs_table.add_bug(url, status)
202
216
self.bugs_table.show_all()
204
218
self.bugs_table.hide()
458
472
def _create_bugs(self):
459
self.bugs_table = gtk.Table(rows=5, columns=2)
460
self.bugs_table.set_row_spacings(6)
461
self.bugs_table.set_col_spacings(6)
462
self.bugs_table.hide() # Only shown when there are bugs
473
self.bugs_table = BugsTab()
463
474
self.append_page(self.bugs_table, tab_label=gtk.Label('Bugs'))
465
476
def _create_file_info_view(self):