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