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