/b-gtk/fix-viz

To get this branch, use:
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
412.1.1 by Daniel Schierbeck
Added branch and revision properties to the revisionview widget.
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
25
from bzrlib.osutils import format_date
412.1.8 by Daniel Schierbeck
Only import the bdecode function from the bzrlib.util.bencode package.
26
from bzrlib.util.bencode import bdecode
0.1.1 by Dan Loda
First working version of xannotate.
27
330.3.1 by Daniel Schierbeck
Renamed logview 'revisionview'.
28
class RevisionView(gtk.Notebook):
0.1.1 by Dan Loda
First working version of xannotate.
29
    """ Custom widget for commit log details.
30
31
    A variety of bzr tools may need to implement such a thing. This is a
32
    start.
33
    """
34
412.1.1 by Daniel Schierbeck
Added branch and revision properties to the revisionview widget.
35
    __gproperties__ = {
36
        'branch': (
37
            gobject.TYPE_PYOBJECT,
38
            'Branch',
39
            'The branch holding the revision being displayed',
40
            gobject.PARAM_CONSTRUCT_ONLY | gobject.PARAM_WRITABLE
41
        ),
42
43
        'revision': (
44
            gobject.TYPE_PYOBJECT,
45
            'Revision',
46
            'The revision being displayed',
412.1.2 by Daniel Schierbeck
Moved retrieval of tags into the revisionview itself.
47
            gobject.PARAM_READWRITE
412.1.7 by Daniel Schierbeck
Added file-id property to the revisionview.
48
        ),
49
412.1.13 by Daniel Schierbeck
Re-added support for displaying the children of a revision.
50
        'children': (
51
            gobject.TYPE_PYOBJECT,
52
            'Children',
53
            'Child revisions',
54
            gobject.PARAM_READWRITE
55
        ),
56
412.1.7 by Daniel Schierbeck
Added file-id property to the revisionview.
57
        'file-id': (
58
            gobject.TYPE_PYOBJECT,
59
            'File Id',
60
            'The file id',
61
            gobject.PARAM_READWRITE
412.1.1 by Daniel Schierbeck
Added branch and revision properties to the revisionview widget.
62
        )
63
    }
64
65
412.1.2 by Daniel Schierbeck
Moved retrieval of tags into the revisionview itself.
66
    def __init__(self, branch=None):
324.2.1 by Daniel Schierbeck
Turned the logview into a notebook.
67
        gtk.Notebook.__init__(self)
324.2.4 by Daniel Schierbeck
Added 'Changes' page to logview.
68
324.2.1 by Daniel Schierbeck
Turned the logview into a notebook.
69
        self._create_general()
70
        self._create_relations()
278.1.45 by John Arbash Meinel
Switch to a new tab for per-file messages.
71
        self._create_file_info_view()
423.14.1 by Jelmer Vernooij
Add bugs tab to display bug status change metadata.
72
        self._create_bugs()
324.2.9 by Daniel Schierbeck
Made 'General' the default page of the logview.
73
74
        self.set_current_page(0)
324.2.4 by Daniel Schierbeck
Added 'Changes' page to logview.
75
        
147 by Jelmer Vernooij
Remove a bunch of duplicate functionality.
76
        self._show_callback = None
77
        self._clicked_callback = None
0.1.1 by Dan Loda
First working version of xannotate.
78
412.1.9 by Daniel Schierbeck
Removed the use of RevisionView.set_go_callback().
79
        self._revision = None
324.2.4 by Daniel Schierbeck
Added 'Changes' page to logview.
80
        self._branch = branch
81
412.1.12 by Daniel Schierbeck
Fixed bug in gmissing.
82
        if self._branch is not None and self._branch.supports_tags():
412.1.2 by Daniel Schierbeck
Moved retrieval of tags into the revisionview itself.
83
            self._tagdict = self._branch.tags.get_reverse_tag_dict()
412.1.3 by Daniel Schierbeck
Fixed problem with branches that do not support tags.
84
        else:
85
            self._tagdict = {}
412.1.2 by Daniel Schierbeck
Moved retrieval of tags into the revisionview itself.
86
278.1.3 by John Arbash Meinel
Have the ability to tell the log view that we only care about a specific file_id.
87
        self.set_file_id(None)
0.1.1 by Dan Loda
First working version of xannotate.
88
412.1.1 by Daniel Schierbeck
Added branch and revision properties to the revisionview widget.
89
    def do_get_property(self, property):
90
        if property.name == 'branch':
91
            return self._branch
92
        elif property.name == 'revision':
93
            return self._revision
412.1.13 by Daniel Schierbeck
Re-added support for displaying the children of a revision.
94
        elif property.name == 'children':
95
            return self._children
412.1.7 by Daniel Schierbeck
Added file-id property to the revisionview.
96
        elif property.name == 'file-id':
97
            return self._file_id
412.1.1 by Daniel Schierbeck
Added branch and revision properties to the revisionview widget.
98
        else:
99
            raise AttributeError, 'unknown property %s' % property.name
100
101
    def do_set_property(self, property, value):
102
        if property.name == 'branch':
103
            self._branch = value
104
        elif property.name == 'revision':
105
            self._set_revision(value)
412.1.13 by Daniel Schierbeck
Re-added support for displaying the children of a revision.
106
        elif property.name == 'children':
107
            self.set_children(value)
412.1.7 by Daniel Schierbeck
Added file-id property to the revisionview.
108
        elif property.name == 'file-id':
109
            self._file_id = value
412.1.1 by Daniel Schierbeck
Added branch and revision properties to the revisionview widget.
110
        else:
111
            raise AttributeError, 'unknown property %s' % property.name
112
147 by Jelmer Vernooij
Remove a bunch of duplicate functionality.
113
    def set_show_callback(self, callback):
114
        self._show_callback = callback
115
278.1.3 by John Arbash Meinel
Have the ability to tell the log view that we only care about a specific file_id.
116
    def set_file_id(self, file_id):
117
        """Set a specific file id that we want to track.
118
119
        This just effects the display of a per-file commit message.
120
        If it is set to None, then all commit messages will be shown.
121
        """
412.1.7 by Daniel Schierbeck
Added file-id property to the revisionview.
122
        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.
123
412.1.13 by Daniel Schierbeck
Re-added support for displaying the children of a revision.
124
    def set_revision(self, revision):
412.1.9 by Daniel Schierbeck
Removed the use of RevisionView.set_go_callback().
125
        if revision != self._revision:
126
            self.set_property('revision', revision)
127
128
    def get_revision(self):
129
        return self.get_property('revision')
412.1.1 by Daniel Schierbeck
Added branch and revision properties to the revisionview widget.
130
423.14.1 by Jelmer Vernooij
Add bugs tab to display bug status change metadata.
131
    def _open_link(self, widget, uri):
132
        subprocess.Popen(['sensible-browser', uri], close_fds=True)
133
412.1.15 by Daniel Schierbeck
Removed redundant method argument.
134
    def _set_revision(self, revision):
412.1.1 by Daniel Schierbeck
Added branch and revision properties to the revisionview widget.
135
        if revision is None: return
136
147 by Jelmer Vernooij
Remove a bunch of duplicate functionality.
137
        self._revision = revision
192 by Jelmer Vernooij
Allow committer to be None.
138
        if revision.committer is not None:
139
            self.committer.set_text(revision.committer)
140
        else:
141
            self.committer.set_text("")
259 by Aaron Bentley
Add author support to gannotate and log viewer
142
        author = revision.properties.get('author', '')
143
        if author != '':
144
            self.author.set_text(author)
145
            self.author.show()
146
            self.author_label.show()
147
        else:
148
            self.author.hide()
149
            self.author_label.hide()
150
197 by Jelmer Vernooij
Fix some warnings when displaying ghost revisions. Reported by John.
151
        if revision.timestamp is not None:
152
            self.timestamp.set_text(format_date(revision.timestamp,
153
                                                revision.timezone))
147 by Jelmer Vernooij
Remove a bunch of duplicate functionality.
154
        try:
155
            self.branchnick_label.set_text(revision.properties['branch-nick'])
156
        except KeyError:
157
            self.branchnick_label.set_text("")
158
256.2.23 by Gary van der Merwe
Show Children
159
        self._add_parents_or_children(revision.parent_ids,
160
                                      self.parents_widgets,
161
                                      self.parents_table)
162
        
278.1.3 by John Arbash Meinel
Have the ability to tell the log view that we only care about a specific file_id.
163
        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.
164
        if file_info is not None:
412.1.8 by Daniel Schierbeck
Only import the bdecode function from the bzrlib.util.bencode package.
165
            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.
166
167
        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.
168
            if self._file_id is None:
169
                text = []
170
                for fi in file_info:
171
                    text.append('%(path)s\n%(message)s' % fi)
172
                self.file_info_buffer.set_text('\n'.join(text))
173
                self.file_info_box.show()
174
            else:
175
                text = []
176
                for fi in file_info:
177
                    if fi['file_id'] == self._file_id:
178
                        text.append(fi['message'])
179
                if text:
180
                    self.file_info_buffer.set_text('\n'.join(text))
181
                    self.file_info_box.show()
182
                else:
183
                    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.
184
        else:
185
            self.file_info_box.hide()
186
423.14.1 by Jelmer Vernooij
Add bugs tab to display bug status change metadata.
187
        bugs_text = revision.properties.get('bugs', None)
188
        if bugs_text:
189
            for c in self.bugs_table.get_children():
190
                self.bugs_table.remove(c)
191
            idx = 0
192
            for bugline in bugs_text.splitlines():
193
                (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)
201
                idx += 1
202
            self.bugs_table.show_all()
203
        else:
204
            self.bugs_table.hide()
205
412.1.13 by Daniel Schierbeck
Re-added support for displaying the children of a revision.
206
    def set_children(self, children):
207
        self._add_parents_or_children(children,
208
                                      self.children_widgets,
209
                                      self.children_table)
210
147 by Jelmer Vernooij
Remove a bunch of duplicate functionality.
211
    def _show_clicked_cb(self, widget, revid, parentid):
212
        """Callback for when the show button for a parent is clicked."""
213
        self._show_callback(revid, parentid)
214
215
    def _go_clicked_cb(self, widget, revid):
216
        """Callback for when the go button for a parent is clicked."""
217
412.1.4 by Daniel Schierbeck
Made tag list smarter.
218
    def _add_tags(self, *args):
219
        if self._tagdict.has_key(self._revision.revision_id):
220
            tags = self._tagdict[self._revision.revision_id]
221
        else:
222
            tags = []
223
            
241 by Jelmer Vernooij
Show tags in bzr viz.
224
        if tags == []:
225
            self.tags_list.hide()
226
            self.tags_label.hide()
227
            return
228
229
        for widget in self.tags_widgets:
230
            self.tags_list.remove(widget)
231
242 by Jelmer Vernooij
Avoid cleanup warning.
232
        self.tags_widgets = []
233
241 by Jelmer Vernooij
Show tags in bzr viz.
234
        for tag in tags:
235
            widget = gtk.Label(tag)
236
            widget.set_selectable(True)
237
            self.tags_widgets.append(widget)
238
            self.tags_list.add(widget)
239
        self.tags_list.show_all()
240
        self.tags_label.show_all()
241
        
256.2.23 by Gary van der Merwe
Show Children
242
    def _add_parents_or_children(self, revids, widgets, table):
243
        while len(widgets) > 0:
244
            widget = widgets.pop()
245
            table.remove(widget)
246
        
247
        table.resize(max(len(revids), 1), 2)
147 by Jelmer Vernooij
Remove a bunch of duplicate functionality.
248
256.2.23 by Gary van der Merwe
Show Children
249
        for idx, revid in enumerate(revids):
147 by Jelmer Vernooij
Remove a bunch of duplicate functionality.
250
            align = gtk.Alignment(0.0, 0.0)
256.2.23 by Gary van der Merwe
Show Children
251
            widgets.append(align)
252
            table.attach(align, 1, 2, idx, idx + 1,
147 by Jelmer Vernooij
Remove a bunch of duplicate functionality.
253
                                      gtk.EXPAND | gtk.FILL, gtk.FILL)
0.1.1 by Dan Loda
First working version of xannotate.
254
            align.show()
147 by Jelmer Vernooij
Remove a bunch of duplicate functionality.
255
256
            hbox = gtk.HBox(False, spacing=6)
257
            align.add(hbox)
258
            hbox.show()
259
260
            image = gtk.Image()
261
            image.set_from_stock(
262
                gtk.STOCK_FIND, gtk.ICON_SIZE_SMALL_TOOLBAR)
263
            image.show()
264
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.
265
            if self._show_callback is not None:
266
                button = gtk.Button()
267
                button.add(image)
268
                button.connect("clicked", self._show_clicked_cb,
256.2.23 by Gary van der Merwe
Show Children
269
                               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.
270
                hbox.pack_start(button, expand=False, fill=True)
271
                button.show()
147 by Jelmer Vernooij
Remove a bunch of duplicate functionality.
272
412.1.9 by Daniel Schierbeck
Removed the use of RevisionView.set_go_callback().
273
            button = gtk.Button(revid)
274
            button.connect("clicked",
412.1.14 by Daniel Schierbeck
Fixed bug in the way the child buttons worked.
275
                    lambda w, r: self.set_revision(self._branch.repository.get_revision(r)), revid)
147 by Jelmer Vernooij
Remove a bunch of duplicate functionality.
276
            button.set_use_underline(False)
277
            hbox.pack_start(button, expand=False, fill=True)
278
            button.show()
0.1.1 by Dan Loda
First working version of xannotate.
279
324.2.1 by Daniel Schierbeck
Turned the logview into a notebook.
280
    def _create_general(self):
0.1.1 by Dan Loda
First working version of xannotate.
281
        vbox = gtk.VBox(False, 6)
282
        vbox.set_border_width(6)
283
        vbox.pack_start(self._create_headers(), expand=False, fill=True)
324.2.1 by Daniel Schierbeck
Turned the logview into a notebook.
284
        vbox.pack_start(self._create_message_view())
285
        self.append_page(vbox, tab_label=gtk.Label("General"))
286
        vbox.show()
287
288
    def _create_relations(self):
289
        vbox = gtk.VBox(False, 6)
290
        vbox.set_border_width(6)
291 by Jelmer Vernooij
Put children widget on a new line.
291
        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.
292
        vbox.pack_start(self._create_children(), expand=False, fill=True)
324.2.1 by Daniel Schierbeck
Turned the logview into a notebook.
293
        self.append_page(vbox, tab_label=gtk.Label("Relations"))
0.1.1 by Dan Loda
First working version of xannotate.
294
        vbox.show()
324.2.4 by Daniel Schierbeck
Added 'Changes' page to logview.
295
0.1.1 by Dan Loda
First working version of xannotate.
296
    def _create_headers(self):
241 by Jelmer Vernooij
Show tags in bzr viz.
297
        self.table = gtk.Table(rows=5, columns=2)
0.1.1 by Dan Loda
First working version of xannotate.
298
        self.table.set_row_spacings(6)
299
        self.table.set_col_spacings(6)
300
        self.table.show()
147 by Jelmer Vernooij
Remove a bunch of duplicate functionality.
301
302
        align = gtk.Alignment(1.0, 0.5)
303
        label = gtk.Label()
304
        label.set_markup("<b>Revision Id:</b>")
305
        align.add(label)
306
        self.table.attach(align, 0, 1, 0, 1, gtk.FILL, gtk.FILL)
307
        align.show()
308
        label.show()
309
310
        align = gtk.Alignment(0.0, 0.5)
412.1.5 by Daniel Schierbeck
Made the revision id label use signals when updating.
311
        revision_id = gtk.Label()
312
        revision_id.set_selectable(True)
313
        self.connect('notify::revision', 
314
                lambda w, p: revision_id.set_text(self._revision.revision_id))
315
        align.add(revision_id)
147 by Jelmer Vernooij
Remove a bunch of duplicate functionality.
316
        self.table.attach(align, 1, 2, 0, 1, gtk.EXPAND | gtk.FILL, gtk.FILL)
317
        align.show()
412.1.5 by Daniel Schierbeck
Made the revision id label use signals when updating.
318
        revision_id.show()
147 by Jelmer Vernooij
Remove a bunch of duplicate functionality.
319
0.1.1 by Dan Loda
First working version of xannotate.
320
        align = gtk.Alignment(1.0, 0.5)
259 by Aaron Bentley
Add author support to gannotate and log viewer
321
        self.author_label = gtk.Label()
322
        self.author_label.set_markup("<b>Author:</b>")
323
        align.add(self.author_label)
324
        self.table.attach(align, 0, 1, 1, 2, gtk.FILL, gtk.FILL)
325
        align.show()
326
        self.author_label.show()
327
328
        align = gtk.Alignment(0.0, 0.5)
329
        self.author = gtk.Label()
330
        self.author.set_selectable(True)
331
        align.add(self.author)
332
        self.table.attach(align, 1, 2, 1, 2, gtk.EXPAND | gtk.FILL, gtk.FILL)
333
        align.show()
334
        self.author.show()
335
        self.author.hide()
336
337
        align = gtk.Alignment(1.0, 0.5)
0.1.1 by Dan Loda
First working version of xannotate.
338
        label = gtk.Label()
339
        label.set_markup("<b>Committer:</b>")
340
        align.add(label)
259 by Aaron Bentley
Add author support to gannotate and log viewer
341
        self.table.attach(align, 0, 1, 2, 3, gtk.FILL, gtk.FILL)
0.1.1 by Dan Loda
First working version of xannotate.
342
        align.show()
343
        label.show()
344
345
        align = gtk.Alignment(0.0, 0.5)
346
        self.committer = gtk.Label()
347
        self.committer.set_selectable(True)
348
        align.add(self.committer)
259 by Aaron Bentley
Add author support to gannotate and log viewer
349
        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.
350
        align.show()
351
        self.committer.show()
352
147 by Jelmer Vernooij
Remove a bunch of duplicate functionality.
353
        align = gtk.Alignment(0.0, 0.5)
354
        label = gtk.Label()
355
        label.set_markup("<b>Branch nick:</b>")
356
        align.add(label)
259 by Aaron Bentley
Add author support to gannotate and log viewer
357
        self.table.attach(align, 0, 1, 3, 4, gtk.FILL, gtk.FILL)
147 by Jelmer Vernooij
Remove a bunch of duplicate functionality.
358
        label.show()
359
        align.show()
360
361
        align = gtk.Alignment(0.0, 0.5)
362
        self.branchnick_label = gtk.Label()
363
        self.branchnick_label.set_selectable(True)
364
        align.add(self.branchnick_label)
259 by Aaron Bentley
Add author support to gannotate and log viewer
365
        self.table.attach(align, 1, 2, 3, 4, gtk.EXPAND | gtk.FILL, gtk.FILL)
147 by Jelmer Vernooij
Remove a bunch of duplicate functionality.
366
        self.branchnick_label.show()
367
        align.show()
368
0.1.1 by Dan Loda
First working version of xannotate.
369
        align = gtk.Alignment(1.0, 0.5)
370
        label = gtk.Label()
371
        label.set_markup("<b>Timestamp:</b>")
372
        align.add(label)
259 by Aaron Bentley
Add author support to gannotate and log viewer
373
        self.table.attach(align, 0, 1, 4, 5, gtk.FILL, gtk.FILL)
0.1.1 by Dan Loda
First working version of xannotate.
374
        align.show()
375
        label.show()
376
377
        align = gtk.Alignment(0.0, 0.5)
378
        self.timestamp = gtk.Label()
379
        self.timestamp.set_selectable(True)
380
        align.add(self.timestamp)
259 by Aaron Bentley
Add author support to gannotate and log viewer
381
        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.
382
        align.show()
383
        self.timestamp.show()
384
241 by Jelmer Vernooij
Show tags in bzr viz.
385
        align = gtk.Alignment(1.0, 0.5)
386
        self.tags_label = gtk.Label()
387
        self.tags_label.set_markup("<b>Tags:</b>")
388
        align.add(self.tags_label)
389
        align.show()
261 by Aaron Bentley
Fix tags formatting
390
        self.table.attach(align, 0, 1, 5, 6, gtk.FILL, gtk.FILL)
241 by Jelmer Vernooij
Show tags in bzr viz.
391
        self.tags_label.show()
392
393
        align = gtk.Alignment(0.0, 0.5)
394
        self.tags_list = gtk.VBox()
395
        align.add(self.tags_list)
261 by Aaron Bentley
Fix tags formatting
396
        self.table.attach(align, 1, 2, 5, 6, gtk.EXPAND | gtk.FILL, gtk.FILL)
241 by Jelmer Vernooij
Show tags in bzr viz.
397
        align.show()
398
        self.tags_list.show()
399
        self.tags_widgets = []
400
412.1.4 by Daniel Schierbeck
Made tag list smarter.
401
        self.connect('notify::revision', self._add_tags)
402
0.1.1 by Dan Loda
First working version of xannotate.
403
        return self.table
404
256.2.23 by Gary van der Merwe
Show Children
405
    
291 by Jelmer Vernooij
Put children widget on a new line.
406
    def _create_parents(self):
407
        hbox = gtk.HBox(True, 3)
256.2.23 by Gary van der Merwe
Show Children
408
        
409
        self.parents_table = self._create_parents_or_children_table(
410
            "<b>Parents:</b>")
147 by Jelmer Vernooij
Remove a bunch of duplicate functionality.
411
        self.parents_widgets = []
256.2.23 by Gary van der Merwe
Show Children
412
        hbox.pack_start(self.parents_table)
291 by Jelmer Vernooij
Put children widget on a new line.
413
414
        hbox.show()
415
        return hbox
416
417
    def _create_children(self):
418
        hbox = gtk.HBox(True, 3)
419
        self.children_table = self._create_parents_or_children_table(
420
            "<b>Children:</b>")
421
        self.children_widgets = []
422
        hbox.pack_start(self.children_table)
256.2.23 by Gary van der Merwe
Show Children
423
        hbox.show()
424
        return hbox
425
        
426
    def _create_parents_or_children_table(self, text):
427
        table = gtk.Table(rows=1, columns=2)
428
        table.set_row_spacings(3)
429
        table.set_col_spacings(6)
430
        table.show()
147 by Jelmer Vernooij
Remove a bunch of duplicate functionality.
431
432
        label = gtk.Label()
256.2.23 by Gary van der Merwe
Show Children
433
        label.set_markup(text)
147 by Jelmer Vernooij
Remove a bunch of duplicate functionality.
434
        align = gtk.Alignment(0.0, 0.5)
435
        align.add(label)
256.2.23 by Gary van der Merwe
Show Children
436
        table.attach(align, 0, 1, 0, 1, gtk.FILL, gtk.FILL)
147 by Jelmer Vernooij
Remove a bunch of duplicate functionality.
437
        label.show()
438
        align.show()
439
256.2.23 by Gary van der Merwe
Show Children
440
        return table
147 by Jelmer Vernooij
Remove a bunch of duplicate functionality.
441
0.1.1 by Dan Loda
First working version of xannotate.
442
    def _create_message_view(self):
412.1.6 by Daniel Schierbeck
Made the message buffer use signals when updating.
443
        msg_buffer = gtk.TextBuffer()
444
        self.connect('notify::revision',
445
                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.
446
        window = gtk.ScrolledWindow()
447
        window.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)
448
        window.set_shadow_type(gtk.SHADOW_IN)
412.1.6 by Daniel Schierbeck
Made the message buffer use signals when updating.
449
        tv = gtk.TextView(msg_buffer)
0.1.1 by Dan Loda
First working version of xannotate.
450
        tv.set_editable(False)
451
        tv.set_wrap_mode(gtk.WRAP_WORD)
452
        tv.modify_font(pango.FontDescription("Monospace"))
453
        tv.show()
324.2.2 by Daniel Schierbeck
Surrounded the commit message textview with a scrolled window and added a shadow.
454
        window.add(tv)
455
        window.show()
456
        return window
0.1.1 by Dan Loda
First working version of xannotate.
457
423.14.1 by Jelmer Vernooij
Add bugs tab to display bug status change metadata.
458
    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
463
        self.append_page(self.bugs_table, tab_label=gtk.Label('Bugs'))
464
278.1.2 by John Arbash Meinel
Add an extra box that pops up when we have per-file information.
465
    def _create_file_info_view(self):
278.1.45 by John Arbash Meinel
Switch to a new tab for per-file messages.
466
        self.file_info_box = gtk.VBox(False, 6)
467
        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.
468
        self.file_info_buffer = gtk.TextBuffer()
278.1.44 by John Arbash Meinel
Merge in trunk, and update logview per-file commit messages.
469
        window = gtk.ScrolledWindow()
470
        window.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)
471
        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.
472
        tv = gtk.TextView(self.file_info_buffer)
473
        tv.set_editable(False)
474
        tv.set_wrap_mode(gtk.WRAP_WORD)
475
        tv.modify_font(pango.FontDescription("Monospace"))
476
        tv.show()
278.1.44 by John Arbash Meinel
Merge in trunk, and update logview per-file commit messages.
477
        window.add(tv)
478
        window.show()
479
        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.
480
        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.
481
        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.
482